The Dropped Session
By default, standard Ubuntu desktop installations are configured for single-user security. If you walk away from your computer, the system will eventually lock the screen. However, on multi-user systems or servers running the GDM3 display manager, Ubuntu utilizes `systemd-logind` to manage user sessions. To conserve system resources (RAM and CPU cycles), the system may be configured to automatically suspend or completely terminate user sessions that have been idle for an extended period. If you are running a long graphical render in the background or compiling code on a secondary user account, having the session automatically suspended will kill your active processes.
Disabling Idle Session Suspension
To ensure background tasks complete successfully and stop Ubuntu from automatically suspending inactive user sessions, you must modify the global login daemon configuration.
You need root access to alter these system-level policies. Open a terminal (Ctrl+Alt+T). Type sudo nano /etc/systemd/logind.conf and press Enter (provide your administrator password). The Nano text editor will open the configuration file. Scroll through the file and look for lines starting with `#IdleAction=` and `#IdleActionSec=`. By default, these are commented out (the `#` symbol), meaning the system relies on default compiled behaviors. To force the system to never suspend idle users, you must remove the `#` from both lines and change their values. Set the action to ignore: IdleAction=ignore. Then, set the timeout to zero: IdleActionSec=0min. Save the file by pressing Ctrl+O and Enter, then exit by pressing Ctrl+X. To apply the new policy immediately, restart the login daemon by typing sudo systemctl restart systemd-logind (Note: this may instantly log you out of your current session).