Sunday, 22 January 2017

How To Hibernate Or Shutdown Ubuntu Laptop When Lid Is Closed

On Ubuntu 16.04 and Ubuntu 16.10, hibernate or shutdown laptop when lid is closed. Customize Ubuntu’s Power setting so that Ubuntu Laptop auto-shutdowns or hibernate when the lid is closed.

Ubuntu: Auto Shutdown/Hibernate When Lid Closed

Step 1

ubuntu-suspend
Dconf editor is used to enable auto shutdown or hibernate when lid is closed. If Dconf editor isn’t installed on Ubuntu Systems, install dconf Editor from Ubuntu Software Center or by running the following command:

sudo apt install dconf-editor

Once installed, launch Dconf editor. Once Dconf editor opens, navigate to org > gnome > settings daemon > plugins > power. Now follow these steps:
  • Double click on “lid-close-ac-action” line
  • Turn off use default value.
  • Change Custom value to anything other to the default
  • Do the same process to change the value of “lid-close-battery-action”.

Step 2

ubuntu-suspend-2
Once the Dconf part is done, open terminal and run the command gives below to open and edit the login configuration file:

sudo gedit /etc/systemd/logind.conf

When the login configuration file opens, search and uncomment the line #HandleLidSwitch=suspend and change its value to the following ones:
HandleLidSwitch=poweroff – automatic shutdown when lid closed.
HandleLidSwitch=hibernate – automatic hibernate.
HandleLidSwitch=ignore – do nothing.
Make changes into the file and save it. Close the file and restart systemd service by restarting the system. If you don’t want to restart the system, you can simply run the following command:

systemctl restart systemd-logind.service

Please note that on Ubuntu Systems, the hibernate function is disabled by default. Which means, you will need to enable hibernate function manually.

Harry

Author & Editor

A technology enthusiast and addictive blogger who likes to hacking tricks and wish to be the best White Hacket Hacker of the World.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.