User avatar
jbeale
Posts: 3254
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Thu May 02, 2013 8:48 pm

Note that with the current firmware (sudo rpi-update) I no longer have a problem that most people would notice. The wifi adapter drops out occasionally, according to /var/log/daemon.log but now it is always restarting itself within 3 seconds, so from the user perspective it looks like the link stays up, unless you try a connection during those few seconds. This is true both with the wifi on a 4-port hub, and also direct into the Model A USB port.

Finally, if you want to avoid that issue, use a wifi adapter based on Realtek RTL8188CUS chip (thumbnail-sized device, about $10 from http://www.ebay.com/itm/190806204365 ). I have both a Model A and Model B unit using that model, and the wifi has never dropped out on its own. The model B with RTL8188CUS has an uptime of almost 6 months.

jonaslejon
Posts: 1
Joined: Sat May 11, 2013 12:32 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sat May 11, 2013 12:35 pm

I'm also having the same problem. Most recent weezy + rbp firmware.

Log output:

[53317.300900] cfg80211: Calling CRDA to update world regulatory domain
[53317.490909] cfg80211: World regulatory domain updated:
[53317.490945] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[53317.490962] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[53317.490976] cfg80211: (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[53317.491016] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[53317.491031] cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[53317.491044] cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[53318.942597] wlan0: authenticate with e0:91:f5:cc:ab:cd
[53319.029569] wlan0: send auth to e0:91:f5:cc:ab:cd (try 1/3)
[53319.236731] wlan0: send auth to e0:91:f5:cc:ab:cd (try 2/3)
[53319.446727] wlan0: send auth to e0:91:f5:cc:ab:cd (try 3/3)
[53319.656817] wlan0: authentication with e0:91:f5:cc:ab:cd timed out
Triop AB

FreakHavoc
Posts: 49
Joined: Sun Dec 11, 2011 9:47 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sun May 19, 2013 7:05 pm

jbeale wrote:Note that with the current firmware (sudo rpi-update) I no longer have a problem that most people would notice.
Sadly I still have the same problem with the latest rpi-update. Pi model A.

FreakHavoc
Posts: 49
Joined: Sun Dec 11, 2011 9:47 am

Re: wifi cuts out after several hours, needs reboot?

Sun May 19, 2013 8:24 pm

pluggy wrote:I have

wireless-power off

in my /etc/network/interfaces file with my RT5570 adaptor. The adaptor has a power saving function and this apparently turns it off. It does the same trick as yours without it.
Where in the file do you put this line? I put it above the "allow hotplug wlan 0" line and it still says "power management:on" when I reboot and type "iwconfig". Thanks

nmgeek
Posts: 3
Joined: Sun Oct 28, 2012 2:23 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sat Jun 01, 2013 5:44 pm

I've had a chance to experiment with both the RA RT5370 and the Edimax EW-7811Un (aka RTL8188CUS).

Yes, the latest distribution reduces the problem with the 5370 to only the occasional quick disconnect/reconnect cycle. However, I found that I had to move the Pi with the 5370 much
closer to the wireless AP than I wanted. I want to operate my Pi at 40 feet away (and through two
walls) from the AP. At this distance the 5370 is regularly disconnecting and reconnecting.

When I use the Edimax adapter I get good signal strength and no disconnects at 40 feet
away.

My 5370 is the 'WiPi' model sold by Newark/Element 14. It's got some plastic shell with the branding
stamped on it so it is considerably larger than the pictures I see on the internet for a standard 5370 adapter. Perhaps the modification to make it 'WiPi' messed up the antenna?

I paid about $15 for each of these units. I would have to conclude that the Edimax adapter is a much better unit for the cost.

udenfox
Posts: 6
Joined: Wed Aug 21, 2013 11:49 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 8:32 am

Have the same problem with RT5370 dongle.

rpi-update didn't help me - wifi still cuts out at least once in 24 hours.
The problem is that I need my script working 24/7.

I will buy another wifi dongle to solve that issue soon, but now: anyone can give me a working cron-script to solve that with restarting a wifi? There two scripts in theard, but whiich one is working?

Thanks in advance.

pjc123
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 11:41 am

udenfox wrote: There two scripts in thread, but which one is working?
Without trying them out I don't know how someone can tell you which one is going to work for your specific network issue, network hardware or driver version, pi revision, operating system or application. After experimenting and tweaking different methods, I discovered that the technique I use in my script is the only method that works for me 100% of the time when either I don't get an ip address at boot or my network will not automatically reconnect after disconnecting. Some claim that the other method works fine for them.
Last edited by pjc123 on Tue Oct 08, 2013 12:33 pm, edited 1 time in total.
My Raspberry Pi Project Page:
http://www.flaminghellmet.com/launch/

udenfox
Posts: 6
Joined: Wed Aug 21, 2013 11:49 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 12:31 pm

pjc123 wrote: Without trying them out I don't know how someone can tell you which one is going to work for your specific network issue, hardware, or application.
Okay, I got it.
I'll try your script today. One more question: How frequently you run the script? It is enough to run it every 3 minutes, or something like that?

pjc123
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 12:42 pm

udenfox wrote:
pjc123 wrote: Without trying them out I don't know how someone can tell you which one is going to work for your specific network issue, hardware, or application.
Okay, I got it.
I'll try your script today. One more question: How frequently you run the script? It is enough to run it every 3 minutes, or something like that?
Depends on what you or your users can tolerate. Since my main problem is that I only intermittently get an ip address at boot I don't want to wait too long to be able to ssh into my pi, so I do it every minute. If you can afford a little down time, then make it longer. Don't forget to make sure the two variables in the script are set for your application (pingip and wlan).

I will post the exact procedure I used, and my latest script.....give me a couple of minutes.
Last edited by pjc123 on Tue Oct 08, 2013 1:03 pm, edited 1 time in total.
My Raspberry Pi Project Page:
http://www.flaminghellmet.com/launch/

pjc123
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 12:56 pm

From my documentation, here are the installation instructions for the reconnect script:

Install wireless reconnect script.

Copy the following into the file /usr/local/bin/wificheck and chmod to 755:

Code: Select all

#!/bin/bash
##################################################################
# NOTE: THIS SCRIPT HAS BEEN MODIFIED FROM ITS ORIGINAL VERSION.
# SEE THE BELOW WEB SITE FOR THE ORIGINAL AUTHOR'S SCRIPT:
#
# A Project of TNET Services, Inc
#
# Title:     WiFi_Check
# Author:    Kevin Reed (Dweeber)
#            dweeber.dweebs@gmail.com
# Project:   Raspberry Pi Stuff
#
# Copyright: Copyright (c) 2012 Kevin Reed <kreed@tnet.com>
#            https://github.com/dweeber/WiFi_Check
#
# Purpose:
#
# Script checks to see if WiFi has a network IP and if not
# restart WiFi
#
# Uses a lock file which prevents the script from running more
# than one at a time.  If lockfile is old, it removes it
#
# Instructions:
#
# o Install where you want to run it from like /usr/local/bin
# o chmod 0755 /usr/local/bin/WiFi_Check
# o Add to crontab
#
# Run Every 5 mins - Seems like ever min is over kill unless
# this is a very common problem.  If once a min change */5 to *
# once every 2 mins */5 to */2 ... 
#
# */5 * * * * /usr/local/bin/WiFi_Check 
#
##################################################################
# Settings
# Where and what you want to call the Lockfile
lockfile='/var/run/WiFi_Check.pid'
# Which Interface do you want to check/fix
wlan='wlan0'
# Which address do you want to ping to see if you can connect
pingip='192.168.1.1'
##################################################################
echo
echo "Starting WiFi check for $wlan"
date
echo 

# Check to see if there is a lock file
if [ -e $lockfile ]; then
    # A lockfile exists... Lets check to see if it is still valid
    pid=`cat $lockfile`
    if kill -0 &>1 > /dev/null $pid; then
        # Still Valid... lets let it be...
        #echo "Process still running, Lockfile valid"
        exit 1
    else
        # Old Lockfile, Remove it
        #echo "Old lockfile, Removing Lockfile"
        rm $lockfile
    fi
fi
# If we get here, set a lock file using our current PID#
#echo "Setting Lockfile"
echo $$ > $lockfile

# We can perform check
echo "Performing Network check for $wlan"
/bin/ping -c 2 -I $wlan $pingip > /dev/null 2> /dev/null
if [ $? -ge 1 ] ; then
    echo "Network connection down! Attempting reconnection."
    /sbin/ifdown $wlan
    sleep 5
    /sbin/ifup --force $wlan
else
    echo "Network is Okay"	
fi


# Check is complete, Remove Lock file and exit
#echo "process is complete, removing lockfile"
rm $lockfile
exit 0

##################################################################
# End of Script
NOTE: I made the following changes to the original script:
(1) Under “Settings” I added the following
(a) pingip='192.168.1.1'

(2) I changed the “We can perform check” section from a ifconfig test to a ping test because the ifconfig test was not working. The Model B Rev 2 board required 2 ping counts instead of 1 for reliable results.


Before using the script, make sure that the following is correct for the pi being used:
(1) wlan
(a) For example wlan0, wlan1, etc.
(2) pingip (I use the current router gateway address. You can use any internal/external address here.)
(a) For example pingip= 192.168.1.1, 192.168.2.1, etc.

Add the program to the cron (Adjust the time per your needs).
(1) Crontab -e
(2) Add the following at the end:

* * * * * /usr/local/bin/wificheck

(3) Ctrl-O to save, then accept file by hitting enter, then Crl-X to exit.
(4) NOTE: the following can be used to view std out and stderr if debugging is necessary (change path as necessary):

* * * * * /usr/local/bin/wificheck >>/root/cron.script.log 2>>/root/cron.script.errlog

Slight Disclaimer: This has been tested as operational with a TP-Link TL-WN722N wifi dongle, Raspbian OS (Revision 04-13-2013), and Model B Rev 2 raspberry pi.
My Raspberry Pi Project Page:
http://www.flaminghellmet.com/launch/

udenfox
Posts: 6
Joined: Wed Aug 21, 2013 11:49 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 08, 2013 2:30 pm

Thanks a lot!
I know how to use crontab, but anyway - it can be very helpful for the beginners in linux :)
Going to try it now.
Thank you again for answering.

paulv
Posts: 521
Joined: Tue Jan 15, 2013 12:10 pm
Location: Netherlands

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Wed Oct 09, 2013 3:12 am

The symptoms you all see seem to be very common, hopefully the cause can be found so a real fix can be made.

In the meantime, I use the following Python program. It's embedded in my main program, but it's easy to make it standalone and have it executed every 10 minutes or so by cron.

Code: Select all

import subprocess

WLAN_check_flg = False  # Variable to check what kind of LAN issue we're dealing with
try_WLAN = 1            # Counter to give the system some time to recover by itself

def WLAN_check():
    '''
    This function checks if the WLAN is still up by pinging the router.
    If there is no connection, we'll give the system 3 more tries to recover by itself
    before we reset the WLAN connection.
    If that does not work after 3 tries, we need to reboot the Pi.

    '''
    global WLAN_check_flg, try_WLAN

    ping_ret = subprocess.call(['ping -c 2 -w 1 -q 192.168.1.1 |grep "1 received" > /dev/null 2> /dev/null'], shell=True)

    if ping_ret:
        # we lost the WLAN connection.
        # the system may recover by itself, so give it some time to do that
        # did we try that already?
        if WLAN_check_flg:
            # we have a serious problem and need to reboot the Pi to recover the WLAN connection
            subprocess.call(['logger "WLAN Down, cannot recover, Pi is forcing a reboot"'], shell=True)
            WLAN_check_flg = False
            try_WLAN = 1
#            mail_alarm("error", "WLAN down, cannot recover, Pi is forcing a reboot")
            sleep(5) # allow for the email to get out
            subprocess.call(['sudo reboot'], shell=True)
        else:
            subprocess.call(['logger "WLAN down : try to recover"'], shell=True)
            if try_WLAN > 4:
                # try to recover the connection by resetting the WLAN
                subprocess.call(['logger "WLAN is down, Pi is resetting WLAN connection"'], shell=True)
                if try_WLAN > 8: WLAN_check_flg = True  # give up, try to recover with a reboot
                subprocess.call(['sudo /sbin/ifdown wlan0 && sleep 10 && sudo /sbin/ifup --force wlan0'], shell=True)
#                mail_alarm("WLAN was down, system could not recover! Pi resetted the WLAN connection.")
            try_WLAN += 1
    else:
        # we have a connection, reset the flags
        WLAN_check_flg = False
        try_WLAN = 1


udenfox
Posts: 6
Joined: Wed Aug 21, 2013 11:49 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Wed Oct 09, 2013 8:46 am

Seems like pjc123 's script working just fine for me with running it every 2 minutes.

But I still want to buy Realtek-chipped adapter. What is bad - that Realtek-based adapters have no antenna.

pjc123
Posts: 911
Joined: Thu Mar 29, 2012 3:37 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Wed Oct 09, 2013 10:54 am

udenfox wrote:Seems like pjc123 's script working just fine for me with running it every 2 minutes.

But I still want to buy Realtek-chipped adapter. What is bad - that Realtek-based adapters have no antenna.
The external antenna is one of the main reasons I bought my TP-Links (However, Atheros AR9271 chipset). After first trying an Edimax clone, I found it to have terrible range. The TP-Links have fantastic range and sensitivity, and the external antenna gives me a lot of flexibility with antenna form factor/gain as well as antenna placement. They also have both monitor and injection capability. Actually the issues are not with the wifi dongle, but rather the pi, because the dongles work just fine with three different versions of Linux and two versions of Windows operating systems that I am running on various x86 computers.
My Raspberry Pi Project Page:
http://www.flaminghellmet.com/launch/

PiBoi
Posts: 13
Joined: Sun Oct 20, 2013 11:53 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Mon Oct 21, 2013 9:12 pm

Same problem I have a wi-pi usb wifi dongle which is a RT5370 according to lsusb
ruining headless, no users logged in either, ruining a web server connected over wifi

kernel:
3.6.11+ #557 PREEMPT Wed Oct 2 18:49:09 BST 2013 armv6l GNU/Linux

firmware:
Oct 12 2013 22:24:23
Copyright (c) 2012 Broadcom
version 7886c07c77a1caafd1f08448c8fcd9c3895ab5ca (clean) (release)

wpasupplicant 1.0-3

wifi configured by wpa supplicant

I noticed lots of frequent disconnects in /var/log/messages
adding wireless-power off to /etc/network/interfaces didn't stop
the disconnects although iwconfig was now reporting power off

I did notice dmesg reporting CRDA country code ES which was wrong
that started me down the track at trying to find out why CRDA country code was was wrong. I configured the correct country code in /etc/defaults/crda

run crda , command not found
sudo apt-get install crda,

Code: Select all

$ crda
COUNTRY environment variable not set.
I don't no why crda is still reporting country environment not set Once installed crda I did notice a big reduction in disconnect messages in /var/log/messages. With wifi disconnected dmesg now reports the connect country code

strangely with the wifi dongle connected but unconfigured by wpa supplicant iw reg get
reports the correct country code and iwconfig shows the correct power level
for the CDRA country code
I can change country code at will with iw reg set AU GB US etc. iw reg get reports whatever country code I try
iwconfig reports the changes with different power levels etc for each country.
As soon as wpa supplicant is configured to connect to the existing wireless AP dmesg reports country CRDA code has changed to ES and iwconfig
confirms it's changed. If I try to change country code back to the correct setting using iw reg set, the country code changes to 98 (confirmed with iw reg get) and changes to country code 00 on subsequent attempts no matter what iw reg set country code is used. Only a reboot seems to clear this.

I don't know what's going on with that, why the country code is reverting to ES when wpa supplicant connects to the wireless AP perhaps the dongle or wifi driver itself

Before installing crda and setting my correct country code in /etc/default/crda
I was getting very frequent wifi CTRL-EVENT-DISCONNECTED messages in /var/log/messages
and the wifi would eventually stop all together at random times sometimes within days or weeks.

It's to early to say if installing crda has fixed the problem altogether but it certainly seems to have reduced the disconnect messages. I am running a cron script to restart the wifi if it can't ping the router.

PiBoi
Posts: 13
Joined: Sun Oct 20, 2013 11:53 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sun Oct 27, 2013 6:18 am

I was still getting random disconnect messages in /var/log/messages, far fewer than I was originally seeing
I discovered a rouge AP which would randomly appear with the same SSID as my wireless. Even though the signal strength appeared to be very low on the rogue AP the rpi tried to connect to it causing drop outs and disconnections.

I changed my SSID, since then I've not had any disconnections or attempts to connect to the rogue AP. no more disconnect reason xx in var/log/messages so far. Early days though.

Still haven't resolved why the country code is reverting to ES

121212
Posts: 1
Joined: Sun Nov 17, 2013 8:26 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sun Nov 17, 2013 8:36 am

Raspberry Pi + RAlink 5370

--> 1-12 hours normal operation but then raspberry offline.
Speed is slow (terminal is stuttering ) , although iwconfig shows link quality 35/70 and speed 53,7 mb/s

Ping ist between 100 und 500 ms.

Now all fine. Ping 3 - 5 ms / speed ok and online after 24 hours .

What have i done:

Code: Select all

apt-get install ralink-firmware
/etc/network/interfaces

Code: Select all

auto lo

iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.20
netmask 255.255.255.0
gateway 192.168.0.1
wireless-power off
wpa-ssid WLANSIID
wpa-psk WLANPASSWORD

This deactive the power management:
iwconfig:
wlan0 IEEE 802.11bgn ESSID:"WLAN_2"
Mode:Managed Frequency:2.437 GHz Access Point: 90:94:E4:B3:2B:9A
Bit Rate=26 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=39/70 Signal level=-71 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:20 Invalid misc:272 Missed beacon:0

User avatar
Dandelion
Posts: 3
Joined: Tue Oct 02, 2012 1:07 pm
Location: Cheadle, Cheshire, UK

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Jan 21, 2014 3:20 pm

I was encountering this issue on a daily basis, until I followed the following steps. I have not encountered it since.
/var/log/messages contained:

Code: Select all

ieee80211 phy0: rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 10 in queue 2
(obviously the entry number and queue number could differ per log line)
The WiFi would not recover from this until restarting the hardware/networking.

So I ran:

Code: Select all

sudo rpi-update
to get the latest firmware/kernel, and set power management to off in
/etc/network/interfaces
by adding

Code: Select all

wireless-power off
within the iface wlan0 stanza

Since then, no complaints in /var/log/messages or other logs, and solid connectivity.

ubuuntu
Posts: 1
Joined: Mon Feb 03, 2014 1:14 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Mon Feb 03, 2014 1:21 pm

Just to note, none of the above fixes worked out for me. Just disappears off the network after a couple of hours. No amount of clever scripting could outdo wonky firmware so I am switching to realtek based dongle.

nyk
Posts: 4
Joined: Wed Dec 19, 2012 10:34 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Fri Jul 25, 2014 10:13 pm

The scripts from this thread didn't work with my Asus USB-N10 (r8712u module).
I came up with this after some experimenting. I tested it and it works fine, so far. Rebooting was the only thing that worked.

Code: Select all

#!/usr/bin/python
import subprocess, time
wifi_device = 'wlan0'
ssid = 'my_linksys'
logfile = '/var/log/wlan_fixer.log'

def logg(x):
 t = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
 open(logfile, 'a').write('%s\t%s\n' % (t,x) )

def is_connected(wifi_device, ssid):
 cmd = ['/sbin/iwconfig', wifi_device]
 output, error = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()
 if ssid in output: return True

if is_connected(wifi_device, ssid): logg('OK'); exit()
logg('reboot')
subprocess.call( ['/sbin/reboot'] )

User avatar
DougieLawson
Posts: 28819
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Fri Jul 25, 2014 10:29 pm

I have no trouble with my RT5370 cutting out.

Code: Select all

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
post-up iwconfig wlan0 power off
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.7
gateway 192.168.1.1
netmask 24
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

MrEngman
Posts: 3524
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Sat Jul 26, 2014 12:24 am

nyk wrote:The scripts from this thread didn't work with my Asus USB-N10 (r8712u module).
I came up with this after some experimenting. I tested it and it works fine, so far. Rebooting was the only thing that worked.

Code: Select all

#!/usr/bin/python
import subprocess, time
wifi_device = 'wlan0'
ssid = 'my_linksys'
logfile = '/var/log/wlan_fixer.log'

def logg(x):
 t = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
 open(logfile, 'a').write('%s\t%s\n' % (t,x) )

def is_connected(wifi_device, ssid):
 cmd = ['/sbin/iwconfig', wifi_device]
 output, error = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()
 if ssid in output: return True

if is_connected(wifi_device, ssid): logg('OK'); exit()
logg('reboot')
subprocess.call( ['/sbin/reboot'] )
You might find this useful. Saves having to reboot.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

JAYT22
Posts: 2
Joined: Fri Aug 15, 2014 7:44 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Fri Aug 15, 2014 8:18 pm

I'm a bit behind the times, but would like to thank jbeale for his/her script which solved the problem for me on a Pi that I'm looking after remotely. (So the hang was a real irritation, leading to a 10 minute car journey to reset the Pi several times in the last few weeks.

uname -r
3.12.25+

I made a couple of tweaks to the script, mainly to maintain a permanent log to see how often the WiFi was going down. Seems to be 2-3 times a day.

Code: Select all

wlan='wlan0'
# Which address do you want to ping to see if you can connect
pingip='192.168.1.254'
dt=`date`

# Perform the network check and reset if necessary
/bin/ping -c 2 -I $wlan $pingip > /dev/null 2> /dev/null
if [ $? -ge 1 ] ; then
    echo "$dt Network is DOWN.  Perform a reset."
    /sbin/ifdown $wlan
    sleep 5
    /sbin/ifup --force $wlan
else
    echo "$dt Network is UP. Just exit the program."   
fi
My crontab entries look like this:

Code: Select all

1,16,31,46 * * * * /root/scripts/reset_wifi.sh >>/root/scripts/logs/reset_wifi.log 2>&1
* * 1 * * rm /root/scripts/logs/reset_wifi.log.old;mv /root/scripts/logs/reset_wifi.log /root/scripts/logs/reset_wifi.log.old
(So the monthly job will rename delete the previous month's log, and rename the last one, so I don't fill up the Pi's SD card too much over time.)

Some version details:

Code: Select all

uname -r
3.12.25+

# lsusb
...
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
The log contains details like this:

Code: Select all

Thu Aug 14 05:01:01 UTC 2014 Network is UP. Just exit the program.
Thu Aug 14 05:16:01 UTC 2014 Network is DOWN.  Perform a reset.
/sbin/ifdown: interface wlan0 not configured
ioctl[SIOCSIWAP]: Operation not permitted
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Thu Aug 14 05:31:01 UTC 2014 Network is UP. Just exit the program.
And here's what the Pi is being used for:

http://pvoutput.org/intraday.jsp?id=330 ... t=20140815

oberon
Posts: 1
Joined: Mon Aug 25, 2014 1:14 pm

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Mon Aug 25, 2014 1:30 pm

Hi there. I'm brand new to Pi having just bought one for my 10 year old boy in the hope that we could learn to do some coding together. I have no experience of linux and what I've just read in this thread is far more technical than I'm used to. I'm having a couple of problems and I hope you will be able to help me though in simple terms.

1/ I've set up my pi and it boots to the desktop. I'm using a RT5370 to try and get wifi. When I use the wifi configure wizard no networks come up in the list at all. Why is this? How do I get the pi to connect to my wireless network?

2/ I'm using a wireless keyboard and mouse. When I opened Idle to try and type in some exercises with my son to begin learning Python the keyboard wouldn't type after the prompt. I think the keyboard is working as the arrow keys worked fin during configuring the pi.

I know this is probaby ridiculously basic and sorry if it is - I guess we all start somewhere...

Tr33x0rs
Posts: 5
Joined: Tue Oct 13, 2015 5:27 am

Re: RT5370 WiFi cuts out after some hours, needs reboot?

Tue Oct 13, 2015 5:31 am

I'm not sure if anyone still looks at this forum. I recently bought my pi and have been having problems with it freezing. I am using it headless, so I just assumed it froze, when tonight I realized it is likely the wireless adapter freezing. I'm using the "Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter" that came with my canakit from amazon.

I just did "sudo rpi-update", so I'm hoping this fixes the issue. When I tried adding "wireless-power off" my wifi stopped working completely. Here is what my /etc/network/interfaces looks like:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
#allow-hotplug wlan0
#wireless-power off
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#auto wlan1
#allow-hotplug wlan1
#iface wlan1 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

I know I can setup a cron job if i have to, but i'd rather not, if at all possible. Any help is greatly appreciated! You have no clue how happy I am to have found this thread after searching and posting elsewhere for a week with no success!

Return to “Troubleshooting”

Who is online

Users browsing this forum: chrisoh, raspi-owner and 56 guests