DEV Community

Brent Vanwildemeersch
Brent Vanwildemeersch

Posted on • Updated on

Enable hibernate on Ubuntu 20.04

Source : How to Change Lid Close Behavior in Ubuntu 20.04

1. Open a new shell session

2. Run command to open file

sudo gedit /etc/systemd/logind.conf

3. Edit the file to enable hibernate on closing lid

When the file is opened, search for the following line

#HandleLidSwitch=suspend
Enter fullscreen mode Exit fullscreen mode

remove the # to enable the setting and save the changed document

You can also choose one of the following options if suspend is not what you are looking for

HandleLidSwitch=lock – lock when lid closed.
HandleLidSwitch=ignore – do nothing.
HandleLidSwitch=poweroff – shutdown.
HandleLidSwitch=hibernate – hibernate Ubuntu.
Enter fullscreen mode Exit fullscreen mode

4. Apply the changes

Apply the changes by restarting the service

systemctl restart systemd-logind.service
Enter fullscreen mode Exit fullscreen mode

Your system should suspend/hibernate now when you close the lid of your laptop


If you want to verify if the option you chose is available on your device you can run

sudo systemctl hibernate/suspend/lock
Enter fullscreen mode Exit fullscreen mode

Top comments (0)