Disable Suspend and Hibernation Modes in Ubuntu/Debian Linux

PowerADM.com / Linux / Debian / Disable Suspend and Hibernation Modes in Ubuntu/Debian Linux

On Debian and Ubuntu operating systems with a graphical user interface, the sleep (suspend) and hibernation modes are enabled by default.

Suspend mode allows you to save power and extend battery life when the device is not in use. To wake up the device from sleep mode, you will need to click with the mouse or press any key on the keyboard. However, on some devices, the only way to wake the operating system from sleep is to press the power button.

The history of Ubuntu/Debian entering sleep mode can be viewed in the system log:

$ journalctl | grep systemd-sleep

Ubuntu logs: going into Sleep and waking up

Run the following command to suspend your device manually:

$ sudo systemctl suspend

Check that hibernation and sleep are enabled on your computer:

$ sudo systemctl status sleep.target suspend.target hibernate.target hybrid-sleep.target

The command returns the following status for systemd daemons when suspend is enabled:

○ sleep.target - Sleep
     Loaded: loaded (/lib/systemd/system/sleep.target; static)
     Active: inactive (dead)
       Docs: man:systemd.special(7)

Debugging hibernation and suspend on Ubuntu/Debian

To turn off both sleep and hibernation:

$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Disable suspend and hibernation modes In Debian and Ubuntu

If you now check the status of the suspend mode, the command will return:

○ sleep.target
     Loaded: masked (Reason: Unit sleep.target is masked.)
     Active: inactive (dead)

To re-enable suspend and hibernation:

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

You can disable suspend when closing the lid on Ubuntu/Debian laptops.

Edit the file /etc/systemd/logind.conf:

$ sudo nano /etc/systemd/logind.conf

Add the lines to the file:


ubuntu disable sleep on lid close

Apply the new settings:

$ sudo systemctl restart systemd-logind.service

You can also disable sleep and hibernation modes by creating a file:

$ sudo nano /etc/systemd/sleep.conf.d/nosuspend.conf


Leave a Reply

Your email address will not be published. Required fields are marked *