Apparently, many users of Ubuntu are reporting problem with laptop 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. Seems like the problem may be due to hardware-kernel compatibility in some cases and for some it is due to missing proprietary drivers. For now, the reasons are still vague and root cause is not yet determined as per the Ubuntu bug thread.
But don’t worry, there is still a workaround to get through this problem by modifying the logind.conf file. Let’s get started. Note that it is important to first check if you have enable the suspend settings for the laptop lid close setting in the ‘Power’ options.
Enable Laptop Lid Close Suspend/Sleep Action
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 good, but still Ubuntu doesn’t go to suspend when laptop lid is closed, try this below workaround:
Workaround for the Bug: edit logind.conf file
STEP 1: Launch ‘Terminal’ and run the following command:
sudo vi /etc/systemd/logind.conf
STEP 2: Uncomment the line:
Uncomment means remove the # in front of it.
STEP 3: Change ‘ignore’ to ‘suspend’.
That’s it. Reboot your computer and see if the problem is fixed. Do let us know in comments below.