MeshWorld India Logo MeshWorld.
Ubuntu 26.04 auto-suspend power management systemd linux 5 min read

Control Auto-Suspend on Ubuntu 26.04

Jena
By Jena
| Updated: Apr 26, 2026
Control Auto-Suspend on Ubuntu 26.04

Auto-suspend puts your Ubuntu system to sleep after periods of inactivity, preserving battery life on laptops. While useful for mobile devices, it can interrupt long-running tasks, remote sessions, or media playback. Ubuntu 26.04 offers multiple methods to configure this behavior.

[!TIP] Real-World Scenario: You’re running a 4-hour database migration on your Ubuntu server at 2 AM, and suddenly the machine goes to sleep. Understanding auto-suspend controls prevents these midnight disasters and keeps your workflows uninterrupted.

  • Settings → Power → Automatic Suspend — GUI method for desktop users
  • gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 — disable AC suspend via terminal
  • systemctl mask sleep.target — systemd method for complete disable
  • Ubuntu 26.04 uses GNOME 46 with refined power management profiles

[!WARNING] Version Notice: These instructions are validated for Ubuntu 22.04–24.04. While Ubuntu 26.04 (GNOME 46) is expected to maintain compatibility with these commands, the specific settings paths and schema locations may differ. If you encounter issues, verify the current schema with gsettings list-schemas | grep power and check /etc/systemd/logind.conf for updated options.

How do I disable auto-suspend using Settings?

The graphical method is the fastest for desktop users:

  1. Open Settings: Click the system menu in the top-right corner and select “Settings”
  2. Navigate to Power: Select “Power” from the left sidebar
  3. Configure Automatic Suspend: Toggle “Automatic Suspend” to Off for both:
    • On Battery Power — when running on battery
    • When Plugged In — when connected to AC power

Ubuntu 26.04 introduces power profiles (Power Saver, Balanced, Performance) alongside auto-suspend settings. These profiles affect CPU scheduling and screen brightness but operate independently from suspend behavior.

How do I control auto-suspend from the terminal?

For headless servers or those who prefer command-line efficiency, gsettings provides direct control over GNOME’s power management:

Disable auto-suspend completely

# Turn off suspend when plugged in (AC power)
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0

# Turn off suspend on battery power
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0

Set custom timeout values

Time is specified in seconds. Common values:

# Suspend after 30 minutes (1800 seconds) on battery
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1800

# Suspend after 2 hours (7200 seconds) when plugged in
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 7200

Verify current settings

gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout
gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout

Note: A value of 0 means auto-suspend is disabled. Any positive number represents seconds until suspension.

How do I use systemd to manage suspend behavior?

For server environments or complete suspend disablement, systemd provides the underlying mechanism:

Check current systemd sleep configuration

systemctl status sleep.target

Disable sleep completely (requires sudo)

# Mask the sleep target to prevent suspension
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Re-enable sleep when needed

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

[!WARNING] Masking sleep targets affects all suspend operations — including manual suspend from the GUI. Use this only on servers or workstations that must remain active 24/7.

How do I configure auto-suspend for specific scenarios?

Prevent suspend during presentations

Create a temporary inhibit without changing system settings:

# Install inhibit utility
sudo apt install systemd-inhibit

# Prevent suspend for 2 hours (7200 seconds)
systemd-inhibit --what=idle:sleep --why="Important presentation" --mode=block sleep 7200

Disable suspend for specific users

For multi-user systems, create a user-specific override:

# Create user systemd directory
mkdir -p ~/.config/systemd/user/

# Mask sleep target for current user only
systemctl --user mask sleep.target

Server configuration (no GUI)

On Ubuntu 26.04 Server without GNOME, configure logind directly:

# Edit logind configuration
sudo nano /etc/systemd/logind.conf

Add or modify these lines:

[Login]
# Disable automatic suspend
IdleAction=ignore
IdleActionSec=0

# Handle lid switch (for laptops)
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore

Then reload logind:

sudo systemctl restart systemd-logind

Summary

  • Settings GUI — fastest for desktop users, toggle Automatic Suspend
  • gsettings — command-line control with sleep-inactive-ac-timeout and sleep-inactive-battery-timeout
  • systemd — complete disable with systemctl mask sleep.target for servers
  • logind.conf — server-specific configuration on systems without GNOME
  • Timeout values — specified in seconds; 0 disables auto-suspend

FAQ

Does disabling auto-suspend affect battery life? Yes. Without auto-suspend, your system continues consuming power during idle periods. On laptops, this significantly reduces battery runtime. Consider using longer timeouts (e.g., 30-60 minutes) rather than complete disablement.

Why do my settings reset after reboot? If settings don’t persist, check for conflicting power management tools like TLP or powertop. These can override GNOME settings. Disable them or configure their suspend behavior to match your preferences.

Can I set different timeouts for battery vs AC power? Yes. Ubuntu 26.04 maintains separate configurations:

  • sleep-inactive-battery-timeout — when running on battery
  • sleep-inactive-ac-timeout — when plugged into power

How do I prevent suspend when closing the laptop lid?

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0

For server environments, also configure HandleLidSwitch=ignore in /etc/systemd/logind.conf.

Does Ubuntu 26.04 Server behave differently? Yes. Server editions typically don’t install GNOME or gsettings by default. Use systemd/logind configuration (/etc/systemd/logind.conf) for persistent settings on server installations.

Conclusion 🎉

Now you know how to turn off and on auto-suspend in Ubuntu 26.04! Whether you’re working, watching videos, or just having fun, you can control when your computer sleeps.