How can I prevent iwconfig power management from being turned on?
Solution 1
Wireless powermanagement is run by a hook in pm-utils
. You can turn it off in any of the following way:
Create a file in /etc/pm/config.d
.
I have named it blacklist:
gksu gedit /etc/pm/config.d/blacklist
and inside the file keep:
HOOK_BLACKLIST="wireless"
If you want to disable any other hooks, default hooks are located at /usr/lib/pm-utils/power.d/
.
OR
You can just create an empty hook in either /etc/pm/sleep.d
or /etc/pm/power.d
. See which one works for you.
i.e.
Just do
sudo touch /etc/pm/sleep.d/wireless
OR
sudo touch /etc/pm/power.d/wireless
Solution 2
Type iwconfig
and look at the output. You should see the name of your chip-set as well as the whether power management is off or on. If it doesn't say, it is probably off.
To turn off power management, go to /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
and you will see
[connection]
wifi.powersave = 3
Change the 3
to a 2
and reboot.
Then run iwconfig
and if it worked you should see Power Management:off
.
Source: https://sites.google.com/site/easylinuxtipsproject/internet
Solution 3
If turning off power management for your wireless interface speeds up internet like this:
sudo iwconfig wlan0 power off
Than to make it permanent run command as follows:
cd /etc/pm/power.d
-
sudo gedit wifi_pwr_off
This will open an empty file, copy the code below into it:
#!/bin/sh /sbin/iwconfig wlan0 power off
-
Save the file, remember to
sudo chmod +x wifi_pwr_off
and restart.
Solution 4
My preferred way is to add the following line in /etc/network/interfaces
to my wireless interface's settings:
post-up iwconfig wlan0 power off
Here's a complete example:
auto wlan0
iface wlan0 inet static
address 192.168.1.2
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254
post-up iwconfig wlan0 power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Note that man interfaces
says the behaviour of post-up
may change in the future.
Solution 5
For some reason, the top-voted solutions didn't work for me and power management kept turning back on. I ended up doing the following:
sudo gedit /etc/rc.local
And added the following line before exit 0
:
( sleep 30 && iwconfig wlan0 power off )&
That turns off power management 30 seconds after logging in...
Edit: Actually that wasn't enough. I kept trying a bunch of stuff, including https://askubuntu.com/a/614245 which I think solved my problem (I hope).
Related videos on Youtube
Alex
Updated on September 18, 2022Comments
-
Alex over 1 year
I am affected by this bug: 869502.
A workaround which seems to stop the kernel panics for me is to disable wlan0 power management:
sudo iwconfig wlan0 power off
However it seems to automatically turn power management back on when I unplug the power cable and I think at many other times, too.
Is there something that might be causing this? Does anyone know how I can prevent it?
-
Qasim almost 11 years
-
Ufos over 6 years7 years and counting. Is this a bug or a feature?
-
Ufos over 6 years
-
-
Alex over 12 yearsI used the first method. It's working. Thanks!
-
Mihai Capotă over 12 yearsNone of the methods work for me.
-
Murhaf Sousli about 10 yearsWhen i write
sudo iwconfig wlan0 power off
i get this message : Error for wireless request "Set Power Management" (8B2C) : SET failed on device wlan0 ; No such device. -
Meghna Natraj about 10 yearsRun iwconfig without any agrument
sudo iwconfig
and check which interface has wireless extension. Sometimes it iseth1
. -
RyanNerd over 7 yearsI hope this works. I hope, I hope, I hope!!! Tired of Linux tossing my wifi connection at random times. /rant Ubuntu 16.04 has some major issues here /endrant
-
Emad Arshad Alam over 7 yearscould we do
chmod -x /usr/lib/pm-utils/power.d/wireless
instead ? -
user3273814 over 7 yearsThis seemed to turn off my power management!
-
RyanNerd about 7 yearsNope didn't work. Intel 7260 is a piece of crap! I've given up.
-
MerlinTheMagic over 6 yearsThis solution is far better than scripting a power off. The solutions involving a sleep before the power off is that if the client fails to associate before the sleep expires wlan0 stays down, even when the network comes within range.
-
Jagoliveira over 6 yearsThis option works like a charm on Raspbian Stretch. For me is the better option.
-
Ufos over 6 yearsthis also seems to be the right way to do it
-
josephwb over 6 yearsThis worked for me on Ubuntu 17.10. Seems far more straightforward and easily reversible than the other approaches (e.g. blacklisting).
-
Abdul Rauf almost 4 yearsworked perfectly in Ubuntu 20.04 for Qualcomm atheros QCA9377
-
Danijel over 3 yearsHere are all the possible values and the meaning:
NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0)
: use the default valueNM_SETTING_WIRELESS_POWERSAVE_IGNORE (1)
: don't touch existing settingNM_SETTING_WIRELESS_POWERSAVE_DISABLE (2)
: disable powersaveNM_SETTING_WIRELESS_POWERSAVE_ENABLE (3)
: enable powersave. The source: gist.github.com/jcberthon/ea8cfe278998968ba7c5a95344bc8b55. -
Phantômaxx about 3 yearsI don't have the gksu command (Ubuntu Studio 20.10).
-
yelly about 3 yearsGreat answer. Thanks a lot!
-
Mehdi almost 3 yearsThis answer seems limited to Network Manager usage...