The Power Struggle
Battery life is a constant battle on Linux laptops. To extend battery longevity, Ubuntu often relies on power management frameworks (like the built-in systemd tools, or popular third-party utilities like TLP). These frameworks are designed to aggressively cut power to hardware components that aren’t actively being used. One common, yet highly disruptive, tactic is “Wi-Fi Power Management.” If you unplug your laptop from the wall and the operating system detects a brief lull in network traffic, it might automatically disable the Wi-Fi adapter entirely to save a few milliwatts, instantly dropping your SSH connections or interrupting a large background download.
Forcing Continuous Power
To ensure a stable internet connection and stop Ubuntu from automatically disabling your Wi-Fi adapter when running on battery power, you must disable the Wi-Fi power management directive in the NetworkManager configuration.
Open your terminal (Ctrl+Alt+T). You need to edit the default NetworkManager configuration file. Type sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf and press Enter (provide your password if prompted). You will see a very short file with a section labeled [connection]. Look for the line that reads wifi.powersave = 3. The value ‘3’ tells the system to enable aggressive power saving. Change the ‘3’ to a 2. The line must read wifi.powersave = 2 (which explicitly means “disable power saving”). Press Ctrl+O to save, Enter to confirm, and Ctrl+X to exit the nano editor. Finally, apply the changes by restarting the network service: sudo systemctl restart NetworkManager.