Day 315: wifi disable powersaving ubuntu debian-based

Always ON

wifi

A laptop has many features.

First and foremost is portability.

To be able to have portability, you need to be able to conserve your battery.

And this is where powersaving (or Power Management) comes into play.

What is Power Management?

It is a feature that lowers the power draw of your wifi adapter so as to increase battery standby time.

Check if enabled

On debian-based systems, you would run the command:

iwconfig
#which would output something like this
wlan0     IEEE 802.11  ESSID:"Light21"  
          Mode:Managed  Frequency:2.427 GHz  Access Point: 3C:37:86:8x:xx:xx   
          Bit Rate=144.4 Mb/s   Tx-Power=22 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=63/70  Signal level=-47 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:4   Missed beacon:0

Normally Power Management would be set to on by default.

Disable power management

I have tried not using an actual script to do it.

But turns out that it’s way more complicated than it seems.

So here’s the script excerpt from askubuntu.com

#Create custom script
vim /etc/network/if-up.d/wifi-powerman-off

#Add contents below to script
#!/bin/sh

IWCONFIG=/sbin/iwconfig
WLAN_IFACE=<your wireless device here>

if [ ! -x $IWCONFIG ]; then
    exit 1
fi

if [ "$IFACE" = $WLAN_IFACE ]; then
    $IWCONFIG $IFACE power off
fi

You would normally substitute your wlan interface name here: WLAN_IFACE=wlan0 (in my case)

And that’s all! It applies when connecting :)

Sources

Askubuntu post

Featured image courtesy

Written on November 11, 2021