Wireless power management in Ubuntu

Feb 15, 2012
Tested on: Ubuntu 11.04 (natty)

I have been experiencing extremely slow network connection whenever my laptop has been on battery. Speedtest results showed a 50 fold speed reduction when my laptop was on battery. I speculated that lower speed has to do with power-management, which reduces network speed in order to save battery. Ubuntu, like other operating systems, also has power management options installed by default. There is a frontend/GUI for Power Management preferences. But I could not find any thing related to wireless or Wi-Fi in the GUI. Looking around on internet, I found many pages. Here is a log of the things I found.
  • Confirming the behaviour: In order to make sure that power-management is the culprit of the slow network access run following command both when on power and when on battery.iwconfig The output should look like following: wlan0 IEEE 802.11bgn ESSID:"USC Wireless" Mode:Managed Frequency:2.462 GHz Access Point: 00:00:00:00:00:00 Bit Rate=65 Mb/s Tx-Power=15 dBm Retry long limit:7 RTS thr:off Fragment thr:off Power Management:on Link Quality=68/70 Signal level=-42 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:27329 Invalid misc:204 Missed beacon:0 Notice line five of the output. If it says anything other than Power Management:off while on battery, then it could be power management which is slowing down then network. Check power argument in iwconfig man page for other possible options.

  • Temporarily disable the power-management: While on battery, run following command (replace wlan0 with your Ethernet name) sudo iwconfig wlan0 power off This will only affect the wireless settings of power management. and should change the output of previous command to Power Management:off and most-likely revert the network speed to usual speed. However, on restarting the system the power management will be enabled.

  • Permanently disable power-management for wireless: If you do not want to keep running the above command each time you restart you laptop, create a file /etc/pm/power.d/wireless with following content: #!/bin/sh /sbin/iwconfig wlan0 power off Make the file executable by running following command:sudo chmod +x /etc/pm/power.d/wireless This new file will override the default wireless script run by power management and will also make sure that wireless power management is turned off. The above trick is taken from Ubuntu Documentation (Check few lines before the example). It says:

    When you run pm-powersave it combines the scripts in these two directories and executes them in sorted order. If both directories contain a script with the same name, the one in /etc/pm/power.d/ has a higher precedence and only this one will be executed. Therefore to disable a script from /usr/lib/pm-utils/power.d/ simply create an empty file in /etc/pm/power.d/ with the same name and without the execute bit set.


Read more ...