WLAN disappears after some time


20 posts
by holzi » Thu Aug 01, 2013 4:51 pm
I'm using a TP-Link TL-WN725N Wlan-Adapter connect to a powered Usb-Hub with 2A with my Pi. After booting it works correct but after some time not used it seems to shut down itself. The Wlan disappears and the light of adapter turns out. After a reboot everything works again.

Any ideas how to keep Wlan running?
Posts: 6
Joined: Thu Aug 01, 2013 4:26 pm
by joan » Thu Aug 01, 2013 5:21 pm
It may be power management kicking in. You can switch power management off.

sudo iwconfig wlan0 power off

Alternatively just have ping running in the background.

ping router >/dev/null &

where router is your router's address.
User avatar
Posts: 5360
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by holzi » Thu Aug 01, 2013 5:51 pm
If i try
sudo iwconfig wlan0 power off
I get the message:
Error for wireless request "Set Power Management" (8B2C) :
SET failed on device wlan0 ; Operation not permitted.


The command
ping router >/dev/null &
probably won't work for me because I use the Pi as my router.

It seems to affect the other USB-Devices too. When the wlan disappears and I look at the pi's desktop via VNC the "Open external device"-dialog appears for my external HDD. Maybe it was shut down too and restarted for some reasons.
Might there be some kind of USB-energy-savers active?

I'm using Raspbian with the NOOBS-installer.
Posts: 6
Joined: Thu Aug 01, 2013 4:26 pm
by joan » Thu Aug 01, 2013 6:15 pm
You can ping any address external to the Pi. I suggested router as it would be local to you. Any other box would do just as well.
User avatar
Posts: 5360
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by MrEngman » Thu Aug 01, 2013 7:16 pm
There appears to be certain anomalies with wifi power management. I can issue command iwconfig and it will always report power management is off.

The 8192cu driver has three power management settings, off, min and max and is compile with min power management enabled. iwconfig always reports power management is off regardless.

It is possible to set the 8192cu power management parameter to off by generating the 8192cu.conf file with command sudo nano /etc/modprobe.d/8192cu.conf and adding the lines
Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0
Before generating the file command cat /sys/module/8192cu/parameters/rtw_power_mgnt will return 1 - the setting for min power management. After generating the 8192cu.conf file and rebooting command cat /sys/module/8192cu/parameters/rtw_power_mgnt will return 0 - power management is off.

These settings are for the TL-WN725N V1 using the rtl8188cus chip. If your wifi is the TL-WN725N V2 with the rtl8188eu chip the same commands can be used except you need to replace all occurrences of 8192cu with 8188eu.

A couple of other possibilities I suppose could be that the hub is going into power down mode or reduced power mode especially if the USB is idle for any length of time or may be the DHCP lease has expired and is not being refreshed.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1843
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by holzi » Thu Aug 01, 2013 9:26 pm
I just noticed that my additional USB-Ethernet-adapter (eth1) deativates itself too. It looks like it's not just a WiFi problem. It seems all unused USB-devices are deactivated after some time.

@joan:
I will try that with the pinging but most of the time there aren't any devices connected to wlan0 or eth1 so there is nothing to ping there. I could only ping my modem over the internal eth0 which for some reason isn't affected by this bug. Will it still work?
Maybe I could try to force the affected adapters to ping some non existent adresses to keep them busy but I'm not sure what command could do this.


@MrEngman:
Thanks for the help but it's probably caused by something different. I still tried just it. Can't hurt.
Posts: 6
Joined: Thu Aug 01, 2013 4:26 pm
by holzi » Sat Aug 03, 2013 12:52 am
It seems like the usb-hub reconnects itself from time to time. When I plug the WiFi-adapter directly into the Pi it keeps running forever.
Posts: 6
Joined: Thu Aug 01, 2013 4:26 pm
by melekhov88 » Fri Sep 27, 2013 4:45 pm
I had the same problem - after a moment of working, WiFI dongle was off. I tried almost everything:
- add wireless-power off inf /etc/network/interfaces
- create a file /etc/modprobe.d/8188eu.conf with the following contents: options 8188eu rtw_power_mgnt=0 rtw_enusbss=0
- add bash script with: echo "0" > /sys/module/8192cu/parameters/rtw_power_mgnt

And there was still the same problem. Finally, I did this:
http://tech.enekochan.com/2013/05/29/co ... -raspbian/

but in file rpi-rtl8188eu/Makefile I changed this line
CONFIG_POWER_SAVING=y to CONFIG_POWER_SAVING=n
Posts: 1
Joined: Fri Sep 27, 2013 4:31 pm
by maddin1234 » Mon Feb 10, 2014 9:33 pm
Hi,
I have some Pis and some Edimax and I found out, that my problem is related to the stick.
When swapping the Edimax from one Pi to another, the problem is also swaped to the
other Pi.

I also found out, that there is also a problem ping the eth0 ip adress.
When the error is there, I get no response when pinging both interfaces.
As soon as I disconnect the Edimax, eth0 responds to pings.

I hope I can find out more.
Posts: 68
Joined: Sat Aug 04, 2012 8:33 pm
by DougieLawson » Tue Feb 11, 2014 1:07 am
How are you assigning IP addresses?
Is it DHCP for everyone or do some/all interfaces have static addresses?
Are you trying to assign the same static address to more than one interface?
Are you trying to assign static addresses that are in your router's DHCP address pool?

Each MAC address needs a unique IP address.

For your Edimax dongle, have you disabled power saving in /etc/modprobe.d/8192cu.conf?
Hacker on ZX80 and Microtan65
Unemployed mainframe database specialist.
Linux hacker since 1995.
RPi owner since 2012.
Twitter: @DougieLawson

Gaffer tape is "The Force", it has a dark side and a light side and it holds the Universe together.
User avatar
Posts: 5733
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by maddin1234 » Tue Feb 11, 2014 7:44 am
Hello,
my /etc/network/interfaces looks like this

Code: Select all
auto lo

iface lo inet loopback
iface eth0 inet static
        address 192.168.0.1
        netmask 255.255.0.0

allow-hotplug wlan0
iface wlan0 inet static
   address 192.168.0.101
   netmask 255.255.0.0


Each Pi has its own address, and the problem is also there,
when only one Pi is powered on.

In the /etc/modprobe.d/8192cu.conf I have
Code: Select all
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0


And the problem is there directly after booting, so I do not think that
it has something to do with power saving.

In another blog I found, that someone wrote, that his Webcam is not working,
when the WLAN is not responding to a ping.
Maybe it is something similar here with eth0. As far as I remember, the ethernet
chip is connected by USB to th ARM core.
Posts: 68
Joined: Sat Aug 04, 2012 8:33 pm
by MrEngman » Tue Feb 11, 2014 9:17 am
maddin1234 wrote:Hello,
my /etc/network/interfaces looks like this

Code: Select all
auto lo

iface lo inet loopback
iface eth0 inet static
        address 192.168.0.1
        netmask 255.255.0.0

allow-hotplug wlan0
iface wlan0 inet static
   address 192.168.0.101
   netmask 255.255.0.0


Each Pi has its own address, and the problem is also there,
when only one Pi is powered on.

In the /etc/modprobe.d/8192cu.conf I have
Code: Select all
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0


And the problem is there directly after booting, so I do not think that
it has something to do with power saving.

In another blog I found, that someone wrote, that his Webcam is not working,
when the WLAN is not responding to a ping.
Maybe it is something similar here with eth0. As far as I remember, the ethernet
chip is connected by USB to th ARM core.

For a network using 192.168.0.xx I would expect the netmask to be 255.255.255.0. Does that make any difference?


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1843
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by maddin1234 » Tue Feb 11, 2014 11:57 am
Hello,
I do not think that it has something to do with the subnet mask. Because lots of them work with this setting and also another Edimax works on exactly this Pi fine.

Today I tried iwconfig to look if Powermanagment is off and there I found something strange.
After a ping from the Laptop, the Link Quality and the Signal level ramp up and then down
again. This is the output of some iwconfig commands, time about 5 sec between each command.
It is the same with a EDIMAX with or without ping problem.

Code: Select all
wlan0     IEEE 802.11bgn  ESSID:"meine_SSID"  Nickname:"<WIFI@REALTEK>"
          Mode:Master  Frequency:2.422 GHz  Access Point: 80:1F:02:82:A2:BC
          Bit Rate:150 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=2/100  Signal level=2/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
...
          Link Quality=2/100  Signal level=2/100  Noise level=0/100
...
          Link Quality=35/100  Signal level=35/100  Noise level=0/100
...
          Link Quality=82/100  Signal level=82/100  Noise level=0/100
...
          Link Quality=92/100  Signal level=92/100  Noise level=0/100
...
          Link Quality=28/100  Signal level=28/100  Noise level=0/100
...
          Link Quality=9/100  Signal level=9/100  Noise level=0/100
...
          Link Quality=4/100  Signal level=4/100  Noise level=0/100
...
          Link Quality=2/100  Signal level=2/100  Noise level=0/100

The signal level at the laptop is perfect all the time.
But maybe its the transmit power of the laptop that is reduced.
Last edited by maddin1234 on Tue Feb 11, 2014 4:47 pm, edited 1 time in total.
Posts: 68
Joined: Sat Aug 04, 2012 8:33 pm
by maddin1234 » Tue Feb 11, 2014 4:41 pm
Hello,
and one more finding.
Also with a good Edimax, there is influence between eth0 and wlan0
(normaly there is only wlan0 connected, so this cannot be the cause of my problem)

When booting only with wlan0, ping works for wlan ip
then connection eth0, ping doesn't work on both interfaces
then disconnecting and reconnection Edimax, ping works on both interfaces
but no accesspoint there
service udhcpd restart, ping works on both interfaces
service hostapd restart, ping works on both interfaces
and accesspoint is there

looks strange for me
Posts: 68
Joined: Sat Aug 04, 2012 8:33 pm
by maddin1234 » Tue Feb 11, 2014 5:45 pm
Hello again,
might be it has something to do with the USB power.

I tried to use a powered hub and with this it seems to work fine every time.
Connected to the Pis USB directly the Edimax makes problems.

ifconfig with Edimax directly at Pi
Code: Select all
wlan0     Link encap:Ethernet  Hardware Adresse 80:1f:02:82:a2:bc
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:136 errors:0 dropped:1065 overruns:0 frame:0
          TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX bytes:47123 (46.0 KiB)  TX bytes:23705 (23.1 KiB)

ifconfig with Edimax on powered hub
Code: Select all
wlan0     Link encap:Ethernet  Hardware Adresse 80:1f:02:82:a2:bc
          inet Adresse:192.168.0.137  Bcast:192.168.255.255  Maske:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:39 errors:0 dropped:130 overruns:0 frame:0
          TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX bytes:6582 (6.4 KiB)  TX bytes:5746 (5.6 KiB)

Maybe some Edimax need better or higher power than most others.

Greetings maddin1234
Posts: 68
Joined: Sat Aug 04, 2012 8:33 pm
by itimpi » Tue Feb 11, 2014 6:38 pm
It could well be pwer relayed! That would explain why activating eth0 stops wlan0 working. The extra power required by eth0 is not leaving enough for the EdiMax.
Posts: 1034
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom
by Dumle29 » Wed Apr 23, 2014 2:24 pm
So I still have this issue. Tried splicing a usb extender, and I'm now powering the edimax with a lab PSU, so there's plenty of power, however the problem still persists. disabling power_mgnt didn't work either.

Pinging the pi 192.168.1.15 from windows returns
reply from 192.168.1.76: Not available

Pinging from the pi is no problem.

I think there might be more than just an issue with the edimax dongle, as I remember using these without this problem a year back.
Posts: 10
Joined: Tue Mar 05, 2013 9:32 pm
by MrEngman » Wed Apr 23, 2014 4:54 pm
Dumle29 wrote:So I still have this issue. Tried splicing a usb extender, and I'm now powering the edimax with a lab PSU, so there's plenty of power, however the problem still persists. disabling power_mgnt didn't work either.

Pinging the pi 192.168.1.15 from windows returns
reply from 192.168.1.76: Not available

Pinging from the pi is no problem.

I think there might be more than just an issue with the edimax dongle, as I remember using these without this problem a year back.

How did you disable power management? sudo iwconfig wlan0 power off or adding wireless-power off to file /etc/network/interfaces and stuff like that has no effect for devices using rtl8188cus chips.

Generate file 8192cu.conf using sudo nano /etc/modprobe.d/8192cu.conf and add the following into it
Code: Select all
# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
The rtl8188cus driver has minimum power management enabled and this turns off the power management. You will need to reboot to make it take effect.

With power management enabled command cat /sys/module/8192cu/parameters/rtw_power_mgnt returns a value of 1. With it disabled it returns a value of 0 (zero).

If you still have problems its more likely a PSU or USB bus problem.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1843
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Dumle29 » Wed Apr 23, 2014 5:24 pm
Yeah I added that file, USB power shouldn't be the issue, as I'm powering the dongle with my lap lab PSU, the dongle only draws 60~70mA at any time, but my supply can supply 5.1A (I have it set at 500mA tho)
Posts: 10
Joined: Tue Mar 05, 2013 9:32 pm
by MrEngman » Wed Apr 23, 2014 6:39 pm
Dumle29 wrote:Yeah I added that file, USB power shouldn't be the issue, as I'm powering the dongle with my lap lab PSU, the dongle only draws 60~70mA at any time, but my supply can supply 5.1A (I have it set at 500mA tho)

60-70mA when idle. I recently saw what appeared to be an official spec that mentioned 600mA max usage which I though was rather excessive, although I have seen another on a Chinese web site that claimed using 129mA max transmitting. My own current measurements would agree with a max of around 130mA transmitting, around 90-95mA receiving and 60-70mA when idle.

There are other things that could cause issues, interference from other wifi devices, mobiles, poor connection due to distance to AP and any walls etc between wifi and AP and of course issues with the Pi.

I have 4 Pi's using EW7811Un's which I connect to from my windows laptop using SSH and they occasionally dropped connections, some rather more frequently than others, but adding the file /etc/modprobe.d/8192cu.conf stopped pretty much all problems. I do now very, very infrequently find an SSH connection to one of my Pi's is dropped but I can reconnect without needing to do anything to the Pi, just start a new SSH connection. That Pi is separated from the AP by two brick walls and is upstairs on the opposite side of the house to the AP which is downstairs. However, I'm certain it is mainly due to issues with my network and not the Pi as I see the odd message about loosing and then restoring connections between my windows laptop and various devices on my domain such as printer and mail server so it's not specific to the Pi. The remaining three Pi's just stay connected. And the wifi adaptors are all connected to the Pi's directly or connected using a USB extension cable so are powered off the PI's psu.

One Pi has a USB reader connected with a second SD card plugged into it. I do get occasional problems accessing the SD card in the reader and usually have to unplug the reader and plug it back in to be able to access the second SD card again. Similar to problems with wifi's stopping working but this time a different device connected to the USB bus.

If your wifi has a separate PSU the problem could be much more likely to be with the Pi and it's PSU, or possibly a clogged up USB bus. It's just that when the wifi stops working it's rather obvious but it could just be an indication of some sort of problem somewhere else with the Pi and not anything to do directly with the wifi as such.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1843
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK