Q How can I make
iw wlan0 set power_save off permanent for stretch? What's the proper way to do it?
Edit I'm using an r-Pi 1 Mod. B with an Edimax wifi dongle and Raspian stretch.
Power save mode was an issue years ago on older versions of Raspbian. But it is fixed for a long time. Now it is disabled by default with the WiFi driver brcmfmac. You will find it if you grep the journal for the driver:
rpi ~$ journalctl | grep brcmfmac: Apr 14 22:13:28 raspberrypi kernel: brcmfmac: F1 signature read @0x18000000=0x15264345 Apr 14 22:13:28 raspberrypi kernel: brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43455-sdio.bin for chip 0x004345(17221) rev 0x000006 Apr 14 22:13:28 raspberrypi kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04 Apr 14 22:13:28 raspberrypi kernel: brcmfmac: brcmf_c_preinit_dcmds: CLM version = API: 12.2 Data: 9.10.105 Compiler: 1.29.4 ClmImport: 1.36.3 Creation: 2018-03-09 18:56:28 Apr 17 09:01:27 raspberrypi kernel: brcmfmac: power management disabled
As you see, it is
power management disabled. So there is no need to worry about it. You don't need to disable it again.
Update after getting information about used hardware:
If you do not have an on-board WiFi and using an USB/WiFi dongle then you will not find
brcmfmac because there is another driver loaded for the dongle. To execute programs on boot up you can use a systemd Unit file. I will give you here a bit more comfortable example for switching off or on power_save. Create a Unit file with:
rpi ~$ sudo systemctl --full --force edit wifi_powersave@.service
In the empty editor insert these statements, save them and quit the editor:
[Unit] Description=Set WiFi power save %i After=sys-subsystem-net-devices-wlan0.device [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/iw dev wlan0 set power_save %i [Install] WantedBy=sys-subsystem-net-devices-wlan0.device
Now enable just what you want on boot up:
rpi ~$ sudo systemctl disable firstname.lastname@example.org rpi ~$ sudo systemctl enable email@example.com # or rpi ~$ sudo systemctl disable firstname.lastname@example.org rpi ~$ sudo systemctl enable email@example.com
I did it by simply adding a line to /etc/rc.local
/sbin/iwconfig wlan0 power off
Add that ahead of
and it will run at every boot.