Comment 19 for bug 651008

Revision history for this message
David A. Rountree (darountree) wrote : Re: Regression in wireless performance under Maverick when on battery power (broadcom)

OK, I’ve made significant progress on what has turned out to be two manifestations of the same problem (at least they seem to be the same problem on my machine, a Dell Studio 1558 with a Broadcom 43224 wireless card, using the Broadcom STA driver). It stems from the pm-utils package, apparently. The two bug reports are:

https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/662998

and

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/651008

You, like me, might be affected by both these bugs. If so, go on. If not, I wouldn’t recommend making all of these changes for no reason.

The fix for the 662998 bug (System freezes while running on battery) has been to either go back to a 2.6.34 or earlier kernel, OR to go back to the Lucid Lynx version of pm-utils. The fix for the 651008 bug (Regression in wireless performance under Maverick when on battery power (broadcom)) is to set iwconfig to turn off power saving for the wireless card. This can be done by the command “sudo iwconfig ethx power off”, AFTER you unplug the ac power supply (where ethx is eth1, eth2, etc, whatever Ethernet device is your wireless card). Comment #9 in the 651008 bug report above tells how to do this as a permanent work-around by editing the file /usr/lib/pm-utils/power.d/wireless.

My work-around for fixing both problems involves going back to the Lucid Lynx version of pm-utils, but keeping the modified script /usr/lib/pm-utils/power.d/wireless, which is only found in the Maverick version of pm-utils. This solves the freezing on battery power problem and keeps network performance up to par while on battery power, all while letting you use the latest kernel.

Assuming you’re starting with a Maverick Ubuntu or Kubuntu installation, go to /usr/lib/pm-utils/power.d and make a copy of the file ‘wireless’, say, copying it to the file ‘wireless.orig’. The command is ‘sudo cp /usr/lib/pm-utils/power.d/wireless /usr/lib/pm-utils/power.d/wireless.orig’. We’ll use that file later.

Next, uninstall the package ‘pm-utils’ using Synaptic or KPackageKit or the command line programs. This will remove the file ‘wireless’ from /usr/lib/pm-utils/power.d, which is why we just made a copy of it, so we can use it later. On my system, the package acpi-support was removed as well, so make note of any packages that were removed along with pm-utils.

Next, edit your sources in KPackageKit or Synaptic to add ‘deb http://us.archive.ubuntu.com/ubuntu/ lucid main’ (note the space after the last ‘/’ (for US users; those in other countries can use ‘deb http://archive.ubuntu.com/ubuntu/ lucid main’). This is so we can grab the previous version of pm-utils.

Now you need to install the previous version of pm-utils. First, check the available versions of pm-utils by going to the command line (Terminal or Konsole) and typing ‘apt-cache showpkg pm-utils’. Both the current and previous versions should be displayed somewhere in the output. Then install the old Lucid version of pm-utils. I did this using the command line, like so: ‘sudo apt-get install pm-utils=1.3.0-1ubuntu1’. Be sure to reinstall acpi-support or any other packages that were previously uninstalled.

To keep the pm-utils package from being upgraded when Update Manager does it’s next update, go to the command line and temporarily become root:

‘sudo su’

Then tell dpkg to hold back the version number of pm-utils:

‘echo “pm-utils hold” | dpkg –set-selections’

(note that the double quotes around “pm-utils hold” actually need to be typed in the command line).

Now exit being root:

‘exit’

You should see the command prompt say your normal user name instead of root.

Now you can go back in to Synaptic or KPackageKit and remove the Lucid sources in your sources list.

Finally, go to the folder /usr/lib/pm-utils/power.d/ and edit the file ‘wireless.orig’ in accordance with comment #9 in this thread: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/651008. Basically, look for the section of the file that looks similar to that below. Change all the "batt" variables to have the same values as the "ac" variables. The text below shows what the final edit should look like.

    case $driver in
        ipw2100) iwpriv_ac="set_power 0"
            iwpriv_batt="set_power 0"
            iwconfig_ac="power on"
            iwconfig_batt="power on";;
        ipw3945)
            iwpriv_ac="set_power 6"
            iwpriv_batt="set_power 6";;
        iwl*) if [ -f "/sys/class/net/$1/device/power_level" ]; then
                 iwlevel_ac=0
                 iwlevel_batt=0
              else
                 iwconfig_ac="power off"
                 iwconfig_batt="power off"
              fi;;
        *) iwconfig_ac="power off"
           iwconfig_batt="power off";;
    esac

Save the file. However, be careful NOT to have two versions of the file ‘wireless’ in the folder /usr/lib/pm-utils/power.d/. In both pm-utils 1.3 and pm-utils 1.4, apparently scripts in that folder are executed when unplugging the ac power. If you have one script with the fix and one without it, they might be both executed and you’ll end up with the original problem, depending on which one is executed last.

You might have to reboot to make all this take effect.