9

I'm trying to disable the wireless power save on my RPI3, but can't do it:

$ sudo iwconfig wlan0 power off
Error for wireless request "Set Power Management" (8B2C):
    SET failed on device wlan0 ; Invalid argument.

Is it possible, or simply not supported?

Regardless, if I don't get any problems while using the wifi card as Soft AP, is there any advantage is disabling power management?

Jacobm001
  • 11,797
  • 7
  • 45
  • 56
Marcus
  • 193
  • 1
  • 1
  • 4

4 Answers4

16

I'm running current kernel (4.1.19-v7+ #853), which exhibits the problem. Updating to BRANCH=next didn't help, so I rolled back.

For me, although iwconfig wlan0 power off doesn't work, the alternative iw dev wlan0 set power_save off does work.

So I've commented-out wireless-power off in /etc/network/interfaces, and replaced by:

allow-hotplug wlan0
iface wlan0 inet manual
#   wireless-power off
    post-up iw dev $IFACE set power_save off
Greenonline
  • 2,448
  • 4
  • 18
  • 33
Colin Dean
  • 161
  • 3
5

Try

sudo iw dev wlan0 set power_save off
Aloha
  • 7,078
  • 1
  • 25
  • 52
  • when you say sudo iw dev wlan0 set power_save off do you mean I open terminal and type the above words and it will not automatically shut off my wifi? – 6suns Apr 04 '17 at 21:44
4

upgrade to "next" firmware branch:

sudo BRANCH=next rpi-update

mine is now kernel 4.4.3 and firmware 41f8b4812ad653abf321b8c54cb4bee57ebdb129 and now accepts the power off command. My connection was constantly dropping, this appears to have sorted it!

Tom
  • 56
  • 1
2

Here's a way I used that should work on any Pi- or any Debian Based distro on a Pi- to PERSISTENTLY disable Power Management as a systemd service.

Just copy the below bash script into a file, chmod 700 it and sudo ./fileName will setup a service that ensures Power Management stays down across reboots. Tested and known to work correctly on Raspbian Buster:

if [ -d /root/scripts ]; then
    mkdir /root/scripts
fi

apt-get -y install iw
apt-get -y install wireless-tools

cat <<EOF> /root/scripts/pwr-mgmnt-wifi-disable.sh
#!/bin/bash
iw dev wlan0 set power_save off
EOF

chmod 700 /root/scripts/pwr-mgmnt-wifi-disable.sh


cat <<EOF> /etc/systemd/system//pwr-mgmnt-wifi-disable.service
[Unit]
Description=Disable WiFi Power Management
Requires=network-online.target
After=hostapd.service

[Service]
User=root
Group=root
Type=oneshot
ExecStart=/root/scripts/pwr-mgmnt-wifi-disable.sh

[Install]
WantedBy=multi-user.target

EOF

chmod 644 /etc/systemd/system/pwr-mgmnt-wifi-disable.service

systemctl enable pwr-mgmnt-wifi-disable.service
systemctl start pwr-mgmnt-wifi-disable.service
F1Linux
  • 1,589
  • 1
  • 9
  • 28
  • `User=root` and `Group=root` is not needed, that's default. Why using a bash script? `ExecStart=/sbin/iw dev wlan0 set power_save off` will do the same job. Installing `iw` and `wireless-tools` is not needed. They are available out of the box. – Ingo Aug 27 '19 at 11:47
  • Anytime I'm giving technical guidance, I avoid ambiguity like the plague. If it's not expressly defined, a user my decide to specify the "pi" user as service owner. As for installing the tools, since `iw` is key to the solution, I expressly describe it as required. The bash script is merely to install the service. – F1Linux Aug 27 '19 at 11:54