Ubuntu – Wifi power management turns back on when connecting

15.04networkingpower-managementwireless

I've been having wifi connectivity issues, and I've narrowed the problem down. Wifi power management seems to mess with my connectivity. I can turn it off with:

sudo iwconfig wlan0 power off

But every time I connect to a network, power management turns back on. I've searched for solutions, but I've only found ways to make sure power management stays off when you login, reboot, etc. I think I might be able to sort this out with systemd hooks, but I don't know how that all works.

Here's what I've got:

  • Ubuntu 15.04
  • Lenovo thinkpad yoga
  • Intel Wireless 7260
  • driver: iwlwifi
  • kernel version 3.19.0-22-generic

Any ideas?

This is not a duplicate of Why doesn't Ubuntu automatically disable wireless networking when a wired connection is active? , but information from that post was relevant to this.

Best Answer

From the comment by @waltinator here's what I did. As of right now, it looks like this has fixed things.

Make a file in /etc/network/if-up.d called wifipower (the name doesn't matter):

sudo -H gedit /etc/network/if-up.d/wifipower

And write in it:

#!/bin/bash
iwconfig wlan0 power off

Save and make it executable with

sudo chmod a+x wifipower

Basically, every time a connection is established the script wifipower will be executed and turn power management off.