Shutdown Ubuntu 14.04 LTS When The Lid Is Closed

April 19, 2014 — 11 Comments

shutdown ubuntu when lid is closed

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.

ubuntu lid closed setting

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=poweroff to shutdown computer when lid is closed
  • HandleLidSwitch=hibernate to hibernate computer when lid is closed
  • HandleLidSwitch=ignore to 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!

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to

11 responses to Shutdown Ubuntu 14.04 LTS When The Lid Is Closed

  1. KyeongKoo Kang June 1, 2014 at 8:41 am

    Thank you for simple and exact information!!

  2. 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.

  3. Yay it actually worked!

  4. 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 ?

  5. Disable all 4:

  6. This last coments did neither function in my laptop…… I don’t know what to do.

  7. 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??

  8. man, thanks for all your help, keep it up bro :)

  9. 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.

  10. 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*).

Leave a Reply


Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>