Already upgraded to Ubuntu 14.04? Well, you may want to change your laptop behaviour when the lid is closed.
You can easily set the vaule to “Suspend” or “do nothing” in System Setting -> Power window. Here’s how to shutdown (or hibernate) Ubuntu when you close the lid of your laptop.
To get started:
1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the command below to open the configuration file via gedit editor:
sudo gedit /etc/systemd/logind.conf
Replace gedit with vi or other text editor if you’re on Server edition.
2. Find out the line #HandleLidSwitch=suspend, remove the # and change it to:
HandleLidSwitch=poweroffto shutdown computer when lid is closed
HandleLidSwitch=hibernateto hibernate computer when lid is closed
HandleLidSwitch=ignoreto do nothing
3. Save the file and restart the service or just restart your laptop to apply changes.
sudo restart systemd-logind
Update: for Ubuntu 16.04, the command to restart the systemd service should be:
systemctl restart systemd-logind.service
That’s it. Enjoy!
Thank you for simple and exact information!!
Thanks for your wonderful tutorial. I’m new to ubuntu and I can’t find the dropdown field “When the lid the is closed” in the Power Setting. I’m using Asus K55VD Latop and Ubuntu 14.04 LTS.
Yay it actually worked!
Well.. no no no.. it worked with 12.04 but with 14.04.1 it just does…. nothing.
Any /var/log/ file where I can verify the correct behaviour ?
agree. Doesn’t do jack for me either. 14.04 here.
Disable all 4:
This last coments did neither function in my laptop…… I don’t know what to do.
Nice It almost worked for me but I don’t want to ignore at all I want that when the lid it’s closed it shutdown the screen but do not suspend or hibernate.
Any way to do this??
man, thanks for all your help, keep it up bro :)
HandleLidSwitch=ignore used to work but with 14.04 does nothing. The GUI settings offer nothing, as they only apply to the logged in user.
With this advice I was able to disable my laptop’s annoying habit of going to sleep during shutdown while lid is closed. I use external screen whenever possible, thus it’s more likely for the lid to be closed when I shut the laptop, thus I constantly had to wake it for either the shutdown to continue, or to redo the shutdown, sometimes having to login first. Even if not using an external screen, doing a hasty shutdown in a hurry often resulted to even more delay due to abovementioned reasons, as I often closed the lid too soon, putting the laptop to sleep.
Ubuntu MATE 14.04.
Also, I would recommend suggesting nano rather than vi, as nano is more beginner-friendly by constantly having “help-section” visible, showing main-commands. For a terminal-newbie, vi is a nightmare (I still remember *shudders*).
Comments are closed.