Clicking “Power Off” or executing sudo reboot in Ubuntu only to have your display freeze on a black console screen with a spinning timer declaring: “A stop job is running for Session x of user [username] (1min 28s / 2min)” is a widespread irritation. Instead of shutting down in seconds, your computer forces you to wait for a full two-minute timeout before powering down.
This shutdown delay is governed by systemd. When you instruct Ubuntu to halt, systemd sends a SIGTERM termination signal to all running user services. If a background process, cloud sync client, Docker container, or mounted network share fails to terminate cleanly, systemd waits for the default DefaultTimeoutStopSec threshold (typically 90 to 120 seconds) before sending a forceful SIGKILL. Follow these steps to optimize systemd shutdown timeouts permanently.
Identify Which Service is Causing the Shutdown Stall
Before adjusting global configuration timers, inspect your systemd journal to discover which specific daemon is failing to respond to termination signals.
- Open the Terminal application (Ctrl + Alt + T).
- Query the systemd journal logs from your previous boot session:
journalctl -b -1 -e - Scroll through the final shutdown entries. Look for red lines or repeated warnings showing:
- “Timed out stopping [service_name].service”
- “Killing process xxxx ([process]) with signal SIGKILL”
- Common culprits include remote network mounts (CIFS/NFS), unclosed Docker/containerd daemons, proprietary graphics helper tools, or user session sync apps (like Nextcloud or Dropbox).
Reduce systemd Default Stop Timeout to 10 Seconds
By default, Ubuntu allocates 90 seconds for non-responsive services during shutdown. Lowering this systemd threshold forces the operating system to send a kill signal after 10 seconds, accelerating shutdowns dramatically.
- Open the master systemd system configuration file in a terminal editor:
sudo nano /etc/systemd/system.conf - Scroll down to find the line:
#DefaultTimeoutStopSec=90s - Remove the hash symbol (
#) from the start of the line to uncomment it. - Change the value to
10s:DefaultTimeoutStopSec=10s - Save changes by pressing Ctrl + O, press Enter, and exit nano with Ctrl + X.
Reduce systemd User Session Stop Timeout
In addition to system services, individual user session services have an independent timeout configuration that must also be optimized.
- Open the systemd user configuration file:
sudo nano /etc/systemd/user.conf - Locate the line:
#DefaultTimeoutStopSec=90s - Uncomment the line and update it to 10 seconds:
DefaultTimeoutStopSec=10s - Save and exit nano (Ctrl + O, Enter, Ctrl + X).
- Reload the systemd daemon manager to apply the updated parameters:
sudo systemctl daemon-reload
Ensure Network File Shares Unmount Prior to Network Shutdown
If you mount Samba (CIFS) or NFS network drives in /etc/fstab, Ubuntu can terminate network connections before unmounting the shares, resulting in a stop job hang.
- Open your file systems table:
sudo nano /etc/fstab - Inspect your remote mount definitions.
- Ensure each network mount entry contains the mount options
_netdevandnofail://192.168.1.100/share /mnt/nas cifs credentials=/home/user/.smbcredentials,_netdev,nofail 0 0 - The
_netdevparameter explicitly tells systemd that the mount depends on an active network connection and must be unmounted before network interfaces power off.
Test Shutdown and Reboot Speed
After adjusting the systemd timeout limits and verifying network mount flags, test your configuration.
- Close all open applications and reboot your workstation:
sudo reboot - Observe the shutdown sequence. Even if a stubborn background process refuses to close, systemd will now forcefully terminate the job within ten seconds, ensuring rapid, smooth shutdowns every time.