How to Stop Ubuntu Linux from Automatically Suspending the Wi-Fi Adapter

The Dropping Connection

If you use Ubuntu Linux on a laptop, you might experience a frustrating issue where your Wi-Fi connection randomly drops after a period of inactivity. You might leave your computer to make coffee, and when you return, your SSH sessions have disconnected and web pages refuse to load until you manually turn the Wi-Fi off and on again. This happens because Ubuntu’s default power management system is aggressively trying to save battery life by cutting power to the wireless network adapter when it thinks you aren’t using it.

How to Disable Wi-Fi Power Management (Network Manager)

The most direct way to fix this is to edit the global configuration file for the Network Manager service, explicitly telling it to never put the Wi-Fi card to sleep.

1. Open your terminal application (Ctrl+Alt+T).

2. Run the following command to open the Network Manager configuration file with root privileges:

sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

3. You will see a very short file with a section that looks like this:

[connection]
wifi.powersave = 3

4. Change the value from 3 to 2. (In this configuration, 3 means “enabled,” and 2 means “disabled”).

5. Save the file by pressing Ctrl+O then Enter. Exit the editor by pressing Ctrl+X.

6. Restart the Network Manager service to apply the changes immediately:

sudo systemctl restart NetworkManager

Alternative: Disabling PCIe Active State Power Management (ASPM)

If changing the Network Manager setting does not stop the disconnects, the Linux kernel itself might be cutting power to the PCI Express slot where the Wi-Fi card sits. You can disable this at the bootloader level.

1. Open the terminal.

2. Edit the GRUB configuration file:

sudo nano /etc/default/grub

3. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT.

4. Add pcie_aspm=off inside the quotation marks. For example:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=off"

5. Save and exit (Ctrl+O, Enter, Ctrl+X).

6. Update the bootloader by running sudo update-grub and then reboot your laptop.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.