Prevent wireless from turning off when lid goes down
I frequently leave my laptop idle and close the lid when i do so. Problem is that the wireless turns off if i do so and my downloads can't happen.
Is there anyway to prevent that from happening? I am using 10.04.
P.S. I have already disabled suspend from happening on default
Solution 1:
All we need to do is run a couple of commands and create or edit a file in /etc/pm/power.d that will basically tell Ubuntu to turn the wi-fi power management off and to keep it off permanently when in battery mode, so we can use the wi-fi wherever and whenever we choose to.To apply the fix, follow the steps below or the following link
Step 1 – Check that wi-fi power management is turned on
In order to turn off the power management we first need to ensure that it is turned on.
*Open a terminal window by pressing Ctrl+Alt+t
*Now type: iwconfig and press Enter
‘iwconfig’ will then list all the available wireless devices connected to your system.
Step 2 – Turning Power Management off
*Type: sudo iwconfig wlan0 power off – This disables the wi-fi power management
Step 3 - will show us how to make this fix permanent by firstly moving to another directory and then editing or creating (if it doesn’t exist already) the file /etc/pm/power.d/wireless
Step 3 – Making the fix permanent – Moving to /etc/pm/power.d directory
We must now move to the directory/etc/pm/power.d we do this by typing the command below into the terminal (see image below)- Note, if the directory does not exist you must create it by typing: mkdir /etc/pm/power.d
*Type: cd /etc/pm/power.d and press Enter
Above: Moving to the /etc/pm/power.d directory
Step 4 – Creating the wireless file in the /etc/pm/power.d directory
Once we are in /etc/pm/power.d we must create the wireless file.
*Type: sudo pico /etc/pm/power.d/wireless into the terminal command and press enter, this will create the wireless file and open the file for editing as a root user.
Step 5 – Add a couple of lines of code to the wireless file, save and exit and its all done !
Now that you are in /etc/pm/power.d/wireless we add two lines of code which tell Ubuntu to stop managing the power management of our wireless device, thus keeping the wi-fi power management permanently turned off (even if we shut down or restart the system)
*Type: #!/bin/sh
/sbin/iwconfig wlan0 power off
Above: Add two lines of code to the file: /etc/pm/power.d/wireless
Now save and exit – note if you can’t find a save button just close the terminal window and restart your laptop/notebook. The changes will take effect. Also note that when you reboot, do it on battery power, reopen the terminal and type iwconfig’ and check that the power management for your wlan0 device reads: OFF.
Solution 2:
Not only the wireless goes off, but the whole machine goes to sleep mode - disk spins down, CPU stops - the energy is only spent on keeping RAM alive. So, as you understand, in sleep mode downloads can't happen anyway.
The way to fix it is to adjust power settings to not to send the computer to sleep when the lid is closed. This, obviously, would result in power consumption similar to that when the lid is open.
UPDATE: If you already disabled suspend on lid close and the wireless still turns off, it suggests there may be some bug/glitch/misconfiguration in some versions of Ubuntu. I searched Ubuntu bug database but couldn't find anything similar - however, as this forum thread shows, there are other users who experienced similar problems.
So, if you really love to code as your avatar suggests, you may start from investigating /etc/acpi/lid.sh
script, which, as I understand, is invoked when the lid is closed, and go from there - hopefully you will be able to find the cause of the problem, fix the issue for yourself and then report the bug+solution to the Ubuntu bugtracker.