Post info:

Disabling WiFi Power Management Permanently for Raspberry PI 3 with Raspbian Jessie

One problem I found when playing with my Raspberry PI3 (running Raspbian Jessie), is that the WiFi would drop after a certain amount of inactivity.  This was problematic at VMUG Meetings, and due to lack of having a screen to connect, I was forced to power-cycle the unit to get it back online.  After doing some googling, I found the built-in WiFi for the Raspberry PI 3 had some Power Management features, which were enabled by default.

You can check the status by running the follow command:

sudo iwconfig wlan


I found a simple command to disable the power management features, however the command only lasted until the next reboot and then went back to the default setting. The command is below

sudo iwconfig wlan0 power off

After doing some investigating, I came across this blog post on how to run a script at startup.  This enabled me to put the above command into a script and run it at startup!

The steps were simple.

1.  Make sure you’re in the /home/pi directory

2.  Run the command below to create a script :

sudo nano


3.  Enter the command above into the new file.  Don’t forget to include the first line though, or it won’t run properly.  You also don’t need SUDO before iwconfig here, as the script is being run at an elevated level already. 🙂

#!/bin/sh -
iwconfig wlan0 power off

CTRL-X then Y and Enter will save the file.

4.  Next, we have to create a configuration file (aka a unit file) that tells systemd what we want to do when…

sudo nano /lib/systemd/system/myscript.service


5.  Enter the text below into the text editor

Description=My Script Service




6. The permissions on the unit file need to be set to 644.

sudo chmod 644 /lib/systemd/system/myscript.service

7.  Verify the permissions were set properly.

ls –l /lib/systemd/system/myscript*



8. Now that the unit file has been defined, we can tell systemd to start it during the boot sequence.

sudo systemctl daemon-reload



9. Next.

sudo systemctl enable myscript.service



10. Finally, REBOOT!

sudo reboot



11. Once your PI is back online, login and check the status now…

sudo iwconfig wlan0

2017-02-12 13_28_44-2017-02-12 13_18_32-pi@raspberrypi_ ~.png - Paint




Ben Liebowitz, VCP, vExpert
NJ VMUG Leader



Share This:

24 thoughts on “Disabling WiFi Power Management Permanently for Raspberry PI 3 with Raspbian Jessie

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.