Disabling wireless power management in Ubuntu

I recently installed 10.10 on my MacBook Pro and noticed that whenever I went into battery mode, my wireless connectivity was severely crippled. A look at iwconfig confirmed that the wifi power management was being enabled every time I yanked the plug. I scoured /etc and couldn’t find any acpi or pm event that would trigger this.

After digging through the filesystem, I found that Ubuntu has a default set of power events set in /usr/lib/pm-utils/power.d. Therein I found a “wireless” script which enabled power management mode whenever a battery power event was triggered.

The script didn’t appear to have any way to configure an override for this behaviour, and I *abhor* doing any form of config management in /usr. Luckily, I found a somewhat non-intuitive solution. Any script in the /usr/lib/pm-utils/ directory can be overridden simply by creating a script of the same name in /etc/pm. I created a blank file called “/etc/pm/power.d/wireless” and voila, no more wireless power management.

Update

A few users have mentioned that placing the blank file in their power.d directory did not work for them. I should note that creating this file simply stops the power-management system from executing the contents of /usr/lib/pm-utils/power.d/wireless, it does nothing to actually switch your interface back. It appears that in some actions, such as closing the laptop and opening it back up, can trigger the hardware itself to go into power management mode. You can forcefully prevent that by placing the following in the “/etc/pm/power.d/wireless” file.

#!/bin/sh

/sbin/iwconfig eth1 power off
Share and Enjoy:
  • StumbleUpon
  • Facebook
  • Twitter
  • Reddit
    • fellow
    • November 13th, 2010

    Well Done! I’ve found this command elsewhere, but I like the placement to override the problem from occurring. In my case, the wiresless issues with BCM4322 on a Macbook Pro 5,2 only happened when on battery.

    • Perhaps I spoke too soon. I added the script in /etc/pm/power.d/wireless, but if I boot on battery, I cannot connect to any wireless network. Anyone know if the 3-4 updates on Broadcom’s site for the STA drivers work better with the BCM4322 (rev 01) network controller?

        • jharvey
        • November 15th, 2010

        Hmm, on a Macbook Pro 5,4 here which has the 4322 rev01, and I’m not able to reproduce that problem. I’m running the default STA drivers available in Ubuntu 10.10. What output do you get when running “iwconfig”?

        You might also try forcefully unloading and reloading the STA driver by running “rmmod bcm5974″ followed by “modprobe bcm5974″. (Be warned that when I did this a few yrs ago on an old macbook, it caused it to crash & reboot.)

        If you find a solution, let me know and I’ll add it to the post.

        Good luck.

    • Paulo
    • December 8th, 2010

    Works perfectly for me, thanks from Brazil

      • Tiago Marques
      • April 19th, 2012

      Fala Paulo, fazendo isso resolve o problema de lerdeza usando wireless do ubuntu 11.10 ?

      Minha internet tem 10mb, quando uso o linux ubuntu no wireless cai para 1 mb, eu testei no windows usando wireless tb, e bateu 8mb…

      Será que fazendo essa alteração, resolve o meu problema ?

    • FL
    • January 2nd, 2011

    Thank you!

    • anonymous person
    • January 3rd, 2011

    Thank you, this also worked for me on a desktop. I am using a WUSB54GC.

      • anonymous person
      • January 3rd, 2011

      Also, just to note I updated the command as noted below.

      Before:

      #!/bin/sh

      /sbin/iwconfig eth1 power off

      After:

      #!/bin/sh

      /sbin/iwconfig wlan0 power off

    • Marcelo Marchiori
    • January 17th, 2011

    Thanks… Well done. Really works.

    • Martin
    • March 31st, 2011

    Thanks! Works for me too! :)

  1. Hi guys,

    I’m running 10.10 on macbook pro 7.1. Disabling power management helps indeed to make wifi at least to work. But I do experience maybe less important but still annoying issue quite flaky wifi connection. Its like ping to router gets every 10th packet of ping latency about 200ms. Makes website comes noticable slower than it should.
    Have a look to this bug https://bugs.launchpad.net/ubuntu/+source/wl/+bug/681445
    Have you got similar issues?

  2. Hey, this worked a treat for me. Was really puzzled over why battery mode was effecting wifi like it was. Turning power management off fixed it for good.
    Thanks!

    • Brian
    • April 12th, 2011

    I have just installed 10.10 netbook on a new samsung N150 and I am having the same problem “No or weak Wireless on battery power”

    Tried to use this solution but there is no wireless file in power.d

    Am i missing the point somewhere ?.

      • jharvey
      • April 13th, 2011

      The solution is to create a blank file named ‘wireless’ in /etc/pm/power.d. This will override the /usr/lib/pm-utils/power.d setting.

      Cheers,
      Jason

    • Jens
    • April 15th, 2011

    Thanks!

    • Nils
    • May 15th, 2011

    Thanks alot!
    This works also for me with my old MSI sub notebook. Tried several stuff mentioned in different threads or bug reports but this did it finally.

    • durandal00
    • June 12th, 2011

    I was having the same issue with my Toshiba NB505. I just installed Linux Mint 11 and started noticing considerable network performance drop when using battery power and quite frankly I was really close to putting Windows back on the machine when I stumbled across this post. Thank you to the original author. However, after implementing the above suggestion I noticed I lost connectivity completely when waking my laptop from sleep mode. So what I finally did was an alternative solution that worked for me was to back up the /usr/lib/pm-utils/power.d/wireless file to another location and then edited the file changing all entries that reference battery power to the same setting as AC power. I also changed all “power on” settings to “power off” to disable any power management. If you crack open the file you will see what I am talking about as it is pretty obvious. Making these changes basically tells Linux to use the same power settings for AC and battery power in regards to the wireless card. Doing this will knock some more time off the battery time which is already pretty bad under Linux. When running Windows 7 on this laptop I could get about 8 hours of use on a battery charge (unless I watched movies). On Linux it is about half that and with this change probably about a third so that is something that needs improvement in Linux. Hope this helps someone else encountering this problem.

      • maddy
      • October 6th, 2011

      kindly explain in detail step wise how did u perform all those actions.
      i am new to linux and love it , but for the slow internet.

      thx..

      • Bruno
      • May 7th, 2012

      I’ve tried the solution proposed in the post, but it didn’t worked. I think I forgot of setting the executing flags to the wireless config file (maybe you’ve forgotten this step?). So I managed to a solution similar to what was proposed by durandal00.

      Copy the original file:

      sudo cp /usr/lib/pm-utils/power.d/wireless /etc/pm/power.d

      Edit the new file to use the same configuration on both ac and battery power .

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

      This can be done by switching the following lines in the final of the script

      case $1 in
      true) wireless_powersave off ;;
      false) wireless_powersave on ;;
      *) exit $NA ;;
      esac

      to this:

      case $1 in
      true) wireless_powersave off ;;
      false) wireless_powersave off ;;
      *) exit $NA ;;
      esac

  3. Thanks, that did is for me. I use Natty 11.04.

    • Ulisses Penna
    • June 24th, 2011

    Thank you very much. It worked just fine.
    Every time I took off the energy plug, my netbook drops ping (ICMP) packets. It used to loose more than 80% of the packets.
    With the solution you provided, now I can plug off (and keep using battery only) and the wifi is usable and all the ping packets are ok!

    • cascagrossa
    • July 29th, 2011

    Same situation with Kubuntu 11.04 on Dell Vostro 3500. The solution worked fine.

    • Mark
    • August 2nd, 2011

    I had the same problem on an MSI CR620 laptop and this fixed it. Cheers!

    • TNK
    • August 2nd, 2011

    You are a star! That was driving me crazy. Thanks.

    • tajunta
    • August 21st, 2011

    Thanks! This works like a charm, and boy have I been splitting my hair with this issue. The blank file didn’t work, but the updated section of your advice did the trick.

    • Miikka
    • August 22nd, 2011

    Thank you. I had the same problem and this solution is simple and effective.

  4. I didn’t encountered yet this kind of problem. But whenever I encounter wireless issues I will try your script posted here. This might be a great solution.

  5. Thanks!! This is a great gift

    • 5erko
    • October 28th, 2011

    perfect! thanks from slovakia ;)

  6. OMG!Do you know how much i love you now? Thanks a lot, it works! :-*

    • bogstryder
    • December 28th, 2011

    I had the same problem with Linux Mint 11 running on my Dell XPS 15z, and this worked. Thanks.

    It strikes me we are going to have problems like this until the day when proper linux drivers are available for all OEM hardware.Until then anyone compiling a distribution just has to provide defaults which may or may not work as hoped.

    In this case though, it would appear the defaults need some work.

    • Tim Taylor
    • January 31st, 2012

    Thank you! That solved my problem with Kubuntu 11.10 on an HP Pavilion dm1-4020sa.

  7. thank for all information here.http://www.plasticasilicone.com

    • Agus
    • May 27th, 2012

    Hi all..

    I just want to asking how to make connection via lan cable for ubuntu 10.10?

    • aaaa
    • June 8th, 2012

    please where i can put this file “”" the link

    • aaaa
    • June 8th, 2012

    i get wireless file but i don’t know where i put in my laptop

    • mo….
    • June 14th, 2012

    Thanks for trying but it still won’t work for me on Ubuntu 12.04 and Toshiba AC100.

    I’ve even made the “power off” change in both files and it still goes back to “on” when I login.

    I am starting to tear my hair out with this one…. There is obvioulsy still something overriding these files?

    • dedieko
    • June 27th, 2012

    Thanks for this tips. This script will kicks in when you switch your power mode ( plug and unplugged).

    This post might be helpful:
    http://ubuntuforums.org/showpost.php?p=11254836&postcount=12

    i followed the instructions as indicated above, but my system was still booting with the wlan0 powersave “on.”

    so i tried entering this command in a file that allows you to enter sudo commands and it will execute those commands at startup. (note: there seems to be dozens of ways to run a sudo command at startup. i found this one to be the best):

    the file name is:

    rc.local

    edit the following file by entering:

    sudo gedit /etc/rc.local

    add the lines to disable wlan0 wireless:
    sleep 10 (this gives the wireless dongle/card time to to load, before executing the command below)
    “iwconfig wlan0 power off”

    important! make sure there is a line at the very end that reads:

    “exit 0″

    this will bypass any errors and allow the system to continue to boot.

    you can add other startup commands here as well – very useful.

    it should look like this:

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will “exit 0″ on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    sleep 10
    iwconfig wlan0 power off
    exit 0

    • rodrigo
    • August 27th, 2012

    I am having a really annoying issue with my wireless card. Every time I unplug the AC cable, the wireless goes down. The wireless card itself disappear: I can’t see it using iwconfig or ipconfig. I’ve been trying, in vain, for the last couple of weeks to fix it. Can anybody help me with this?

  1. January 19th, 2011
    Trackback from : Bizarre Wireless Latency
  2. March 28th, 2011
  3. April 13th, 2011
  4. May 12th, 2011
  5. July 31st, 2011
  6. December 8th, 2011
  7. December 21st, 2011
  8. March 26th, 2013
    Trackback from : Deutsch
  9. March 27th, 2013
    Trackback from : lån penge
  10. June 8th, 2014
    Trackback from : how to hack wifi
  11. August 7th, 2014
    Trackback from : cscs card mock test
  12. September 5th, 2014
    Trackback from : cash
  13. September 24th, 2014
    Trackback from : Federal Law Firm