Many users of Ubuntu 16.04 users are reporting problems with laptop not going to suspend/sleep mode when the lid is closed. This is a confirmed bug in Ubuntu 16.04, and developers are working on a permanent fix to this problem.
It seems like the problem may be due to hardware-kernel compatibility in most cases, and for some, it is due to missing proprietary drivers. For now, the reasons are still vague, and the root cause is not yet determined as per the Ubuntu bug thread.
But don’t worry, there is a workaround to get through this problem by modifying the logind.conf file. Let’s get started. Note that it is important first to check if you have enabled the suspend settings for the laptop lid close setting in the ‘Power’ options.
Fix Laptop doesn’t Suspend after the lid is closed
Go to ‘Power’ settings and select ‘Suspend’ for the item “When the lid is closed”. You can do it for only the Battery power mode or also for ‘when plugged’ in option.
Once you have confirmed the setting is right, and still, Ubuntu doesn’t go to suspend when the laptop lid is closed, try this below workaround:
Workaround to make Ubuntu suspend when the laptop lid is closed
This fix is confirmed to be working on Ubuntu 16.04, 16.04, 17.04, and 17.10. As per the below comments, few users are reporting it not to be working on Ubuntu 18.04.
Step 1: Launch ‘Terminal’ and run the following command:
sudo vi /etc/systemd/logind.conf
Step 2: You should see the following content in the file.
#NAutoVTs=6 #ReserveVT=6 #KillUserProcesses=no #KillOnlyUsers= #KillExcludeUsers=root #InhibitDelayMaxSec=5 #HandlePowerKey=poweroff #HandleSuspendKey=suspend #HandleHibernateKey=hibernate #HandleLidSwitch=suspend #HandleLidSwitchDocked=ignore #PowerKeyIgnoreInhibited=no #SuspendKeyIgnoreInhibited=no #HibernateKeyIgnoreInhibited=no #LidSwitchIgnoreInhibited=yes #HoldoffTimeoutSec=30s #IdleAction=ignore #IdleActionSec=30min #RuntimeDirectorySize=10% #RemoveIPC=yes #UserTasksMax=12288
Step 3: Carefully navigate and make sure the following lines are changed to look like shown below. If you have already changed the setting in the Power Settings as described above, some of the options should show “Suspend”. That’s fine. I’m just mentioning it to make sure you have the right setting.
HandleSuspendKey=suspend HandleLidSwitch=suspend HandleLidSwitchDocked=suspend
Step 4. Save the file.
Step 5. Reboot your computer.
That’s it. Try closing the lid and see if your Ubuntu PC suspends successfully.
Final Thoughts
Since this is a workaround and hardware dependent, this temporary fix might not work on all the Ubuntu PCs. Unfortunately, there is nothing more we can do apart from what is presented in this tutorial. We should wait and see when an official fix becomes available, but going by the status, the Ubuntu team seems like not making much progress on this issue. This is mainly because of the hardware configuration.
20 comments
Hello Kiran, That fixed my problem..!! Thank you!
Glad that it solved your problem Akshay. Thanks for leaving feedback.
fixed for stream 14 hp. Thank you
fixed for stream 14 hp. thenk you
And fixed for Asus K55D – thanks.
Didnt Work on Acer 573-G
Did not work for me on a HP spectre 360 laptop
Perfect, thank you very much
perfect,it help me fix the problem. Thanks a lot!
im not able to do this. how to save the file after changing from ignore to suspend
it works only once. After second try to suspend the problem stayed the same
worked, laptop thinkpad T430, ubuntu 16.04
Thank you.
Worked on Acer Aspire E 15
Thanks!
Acer Aspire V5-473P-5602 Ubuntu 18.04LTS.
Kiran, I’d no idea what I was trying, and it went all wrong. I had no idea; 1. that I was going to be editing a file using ‘special’ systemd edit commands. 2. That file, logind.conf, is now, after my attempts, entirely empty.
So, if you can help please?
1. Upon entering the terminal command “sudo vi /etc/systemd/logind.conf”, I now get this:
“E325: ATTENTION
Found a swap file by the name “/etc/systemd/.logind.conf.swp”
owned by: root dated: Thu Nov 29 16:17:09 2018
file name: /etc/systemd/logind.conf
modified: YES
user name: root host name: Acer-Aspire-V5-473P-5602
process ID: 12868
While opening file “/etc/systemd/logind.conf”
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r /etc/systemd/logind.conf”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “/etc/systemd/.logind.conf.swp
”
to avoid this message.
“/etc/systemd/logind.conf” [New File]
2. I would like to have (or be able to somehow recover) the original contents of that file from my system (and I don’t even know it they were the default as originated with the OS, or had already been modified in other ways before I made my ‘effort’. I did actually search for such original contents, but didn’t find anything like that.
3. Certainly, before I try again, I would like to know exactly where I can learn how to ‘properly’ edit and save the changes I make to the file, assuming I can actually first restore it.
In other words, I’m entirely lost. Please help (and somehow, I’ll bear the laughter)?
Thanks kindly…E
Well, 7 days later and no reply whatsoever. Nothing at all?
I don’t understand, the previous post from mine was 3 months ago, so I thought Kiran was still involved here on this issue. Sorry for the confusion.
Thanks ! It fix my problem in Linux Mint 19.1.
Hello, Kiran, I’m a beginner using linux mint, and I tried to uninstall ruby/zoom. The Synaptic-Package-Manager does not give the option free, only the option to install. What to do?
Greetings from Germany
Karoline
It doesn’t work on ubuntu 18.04.4
HP Laptop 15-da0399ur