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