Ubuntu includes a built-in automatic suspend feature designed to conserve power on battery-powered systems. This feature often activates after a set period of inactivity or when the laptop lid is closed, allowing the system to enter a low-power sleep mode. Although beneficial in many contexts, it can disrupt tasks that require continuous operation.
The automatic suspend mechanism reduces energy consumption by shifting the system into a minimal power state. While it prolongs battery life, it may interrupt essential processes such as network operations, file transfers, or lengthy computations that need uninterrupted performance.
Modifying power management settings and adjusting logind.conf parameters can override default suspend behavior. These changes help ensure continuous operation, particularly for servers, computational tasks, or remote access scenarios where any unplanned suspend state could cause disruptions.
$ sudo vim /etc/systemd/logind.conf
HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore LidSwitchIgnoreInhibited=no
$ systemctl status systemd-logind
● systemd-logind.service - Login Service
Loaded: loaded (/lib/systemd/system/systemd-logind.service; static)
Active: active (running) since ...
This guide is tested on Ubuntu:
| Version | Code Name |
|---|---|
| 22.04 LTS | Jammy Jellyfish |
| 23.10 | Mantic Minotaur |
| 24.04 LTS | Noble Numbat |