How to disable wifi power save to prevent disconnects

I saw some posts about how weak the wifi is, and indeed it is… It kept losing signal and closing my ssh so I decided to try an old trick of mine. (Which happens to be an issue in all the Single Board Computers i have tried)

Since I disabled the chipset power saving mode I haven´t had disconnects, so It might be useful to you.

iw wlan0 set power_save off

image

Edit: I have to add that not only doesn´t disconnect anymore but it increased the speed of transfering files too.

Note:
This is not permanent, on reboot it gets restored to “on”

Edit: July 28, 2018

How to set it on boot.

To set it to off on boot you need to create the following scrip in:

/etc/network/if-up.d/powesave_off

#! /bin/sh

set -e

# Don't bother for loopback
if [ "$IFACE" = lo ]; then
        exit 0
fi

# Only run from ifup.
if [ "$MODE" != start ]; then
        exit 0
fi

# Only do it once (skip for inet6).
if [ "$ADDRFAM" != inet ]; then
        exit 0
fi

/sbin/iw dev wlan0 set power_save off

exit 0

And don´t forget to set exec permissions:

chmod +x /etc/network/if-up.d/powersave_off (or whatever name you put to it)

I found the solution here: GitHub - fordsfords/wlan_pwr: Improve CHIP wireless perf and reliability by turning off power mgt

9 Likes

cool, it’s a great trick

It would be better to integrate it in the ui

It seems desktop linux default power_save is off

I think it’s better to enable this in the next kernel

UI seems is not the best for this job

What you think? :grinning:

Yes but desktop makes sense, as it doesnt run normally on batteries. People have the router with no walls and at 5m so they dont have that problem, their device would have less battery time

yeah u r right
That’s why airplane mode existed

at that time I dont know about this power_save

but I guess even We off the power_save default ,wont make too much difference on battery time

it’s a good trick I think
:slight_smile:

Thanks, this helped!

But - Isn’t it possible to add this line to init.d or something, that it get’s executed each boot?

Developers told me it will get eventually to the launcher.

To add it at init.d you need to make a script. I tried it to run it at boot with crontab but didn´t work

@Kenny_Ken @hal

Figured how to do it on boot, add this script to

/etc/network/if-up.d/

And don´t forget to set exec permissions:

chmod +x /etc/network/if-up.d/powersave_off (or whatever name you put to it)

set -e

# Don't bother for loopback
if [ "$IFACE" = lo ]; then
        exit 0
fi

# Only run from ifup.
if [ "$MODE" != start ]; then
        exit 0
fi

# Only do it once (skip for inet6).
if [ "$ADDRFAM" != inet ]; then
        exit 0
fi

/sbin/iw dev wlan0 set power_save off

exit 0

I found the solution here: GitHub - fordsfords/wlan_pwr: Improve CHIP wireless perf and reliability by turning off power mgt

i tried that command in winscp and it didnt work

bash line 11 iw:

command not found

sudo iw wlan0 set power_save off

and to check the wlan0 power_save status ,just

sudo iw wlan0 get power_save

these commands requires super privilege so need to use sudo

1 Like

Thanks a lot!!! I was ripping my hair off, because every other tips didnt work :confused:
But this script works perfectly - thanks!

i haven’t had any WIFI problems, except not connecting automatically when turning on, which isn’t too bothersome.

Since I wrote this posts, this mode has been integrated in the launcher, it should be in one of the power modes. Maybe performance ?