Fixing WLAN disconnects in Ubuntu 10.10 (Maverick Meerkat)

Jul 31, 2011 13:22 · 427 words · 3 minutes read Linux

For some time now I have been plagued by a flakey WLAN connection on my Ubuntu desktop PC. I finally managed to fix it by using the solution described here.

Seems like Ubuntu thought it was a wise idea to power down the wireless connection while I am listening to online radio (have a look at Soma FM btw., they are awesome). Why in the world do they do that on a desktop PC? I bet the amount of energy saved by powering down my USB-Stick was enormous! That should fix global warming no doubt. Not to mention the 1.6¢ that saved me. Well worth being disconnected every 5 mins or so.

Anyway, what did the trick for me was just running the console command provided in the above mentioned blog post to disable power management for my wireless device.

sudo iwconfig wlan0 power off

Note that you have to use the correct name for your wireless interface (wlan0 in my case). Common names are wlan0, ath0 or eth1. To list your active network interfaces, use the following command:

ifconfig

You should get an output like this:

eth0      Link encap:Ethernet  HWaddr 00:22:15:20:2c:09  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:45 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4237 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4237 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:285177 (285.1 KB)  TX bytes:285177 (285.1 KB)
wlan0     Link encap:Ethernet  HWaddr 00:aa:bb:cc:11:22  
          inet addr:192.168.42.43  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: abcd::ef0:1234:5678:abcd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1217156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:657860 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1767823314 (1.7 GB)  TX bytes:54545789 (54.5 MB)

You will most likely have one lo device (local loopback) and one eth0 (normal ethernet connection) device. The third one generally is the wireless device. If you have the Gnome network manager applet and an active connection you can also right-click on the Wireless taskbar icon and choose “Connection Information”. It will tell you which device it is using.

To make the changes permanent so you do not have to re-enter it after every reboot, run

sudo gedit /etc/pm/power.d/wireless

(this will create or edit a configuration file that will override the default powermanagement behavior) and enter the following:

#!/bin/sh

/sbin/iwconfig wlan0 power off

Again make sure you use the proper device name.

Hope that works for you! As for me, I can finally enjoy uninterrupted internet radio again!