Ubuntu crashes when on battery power

I've had the same problem ever since I upgraded to version 13.04. I switched to the latest Mint version, and then did a clean reinstall of Lubuntu 13.04, but the problem remained, whereas 12.10 and previous versions used to run flawlessly. I found a discussion about that --- apparently not so new --- issue on this blog. I seem to be doing fine since I used the solution below (my network adapter is also a Broadcom):

Start of the quote:

Carl Parkinson • 2 years ago

Hi,

I have been having problems with my Dell Studio 15 freezing intermittently when on battery for months. I have read many, many posts on this topic and tried many different tweaks to no avail. Reverting to an earlier version of pm_utils worked, but I lost the ability to put my laptop on standby, so that was no good. I decided it was time for me to do some analysis and try a few tweaks of my own. Well, it looks like I have come up with a successful work around that should work for any type of wireless card.

I run Mint 10 and have the latest version of pm-utils installed - 1.4.1. tailing /var/log/pm-powersave.log reveals that /usr/lib/pm-utils/power.d/wireless is called to put the wireless card into powersave mode when the power cord is removed. I found the specific section of code that makes that change is at the end of the script:

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

I simply changed it to:

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

This results in the card never being put into powersave mode and has stopped the freezing. This change does not appear to affect the power consumption either. So, all is well and I have said goodbye a very frustrating problem. I hope it works for you too.

FYI, my wireless card is a Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)

End of the quote


Try disabling USB Auto-Suspend:

sudo apt-get install powernap
sudo powernap-action --disable usb_autosuspend

Source: https://askubuntu.com/a/266908/24155