Fix Laptop Doesn’t Suspend After Lid is Closed on Ubuntu Linux

You close the lid of your laptop but it keeps on running instead of going into suspend mode? Here are a few ways how you can make Ubuntu suspend when the lid is closed.
Warp Terminal

One of the ways to save battery on Ubuntu without losing work is to use the suspend mode. I prefer to link with the lid action of my laptop. If I close the lid of the laptop, it goes to suspend/sleep mode and when I open the lid, it wakes up.

However, there are several users who are facing issues with suspend behavior when the lid of the laptop is closed. Ubuntu simply keeps on running without bothering about going in suspend mode.

There is a confirmed bug on this issue, starting Ubuntu 16.04. Unfortunately, this bug has not been fixed even after so many years.

While I cannot fix the bug, I can surely suggest you a couple of ways so that Ubuntu goes to suspend mode after the lid is closed. Let’s see how to do that.

Fixing Ubuntu won’t suspend when laptop lid is closed

I do hope that these fixes work for everyone but it’s not a guarantee because the bug is hardware-dependent and though the workaround works for most laptop models, there are surely a few exceptions.

Let’s start working on it.

Make sure to enable suspend for lid close action

This is a no-brainer. You must make sure that you have the correct settings in place.

Go to System Settings and then click on Power. In the power setting, make sure that the option for ‘When the lid is closed’ is set to Suspend.

Ubuntu power settings

If you had a different setting here, you should check if you are able to suspend Ubuntu by closing the lid. If not, then follow the workaround in the next section.

Workaround to make Ubuntu suspend when laptop lid is closed

First, ensure that you have pm-utils installed on your system. pm-utils is a collection of scripts that handle suspend and resume. Ubuntu should already have it but no harm in verifying it.

sudo apt install pm-utils

After that, we need to edit the logind.conf file of systemd. This file usually contains the entries that are used by default by systemd. However, all the entries are commented out here. If you change the settings in this file, it will take precedence over the systemd default settings.

It’s always a good idea to make a backup of configuration files before changing them. Use this command:

sudo cp /etc/systemd/logind.conf  /etc/systemd/logind.conf.back

And after that, install gksu so that you can open a graphical application (gedit in this case) from the terminal. You can also use a terminal based text editor like Vim if you are comfortable with that.

sudo apt install gksu && gksudo gedit /etc/systemd/logind.conf

You’ll see lines like these in this 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

What you have to do is to remove the # from some of the lines and change it’s value to:

HandleSuspendKey=suspend
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend

Fix suspend not working on Ubuntu linux

Save your changes and restart your system. Now check if your system goes to suspend mode when the lid is closed.

If not, you can also try changing the below line (though I am uncertain if that makes a difference):

HandleHibernateKey=suspend

Conclusion

I hope this helps you to fix the annoying issue of Ubuntu not suspending when the laptop lid is closed. This should work with Ubuntu and perhaps other distributions.

If you are using it with a multi-monitor system, you may not want Ubuntu to go in suspend when you close the lid.

Make Ubuntu Not Go in Suspend When Laptop Lid is Closed
If you use Ubuntu on a laptop, you might have noticed that the system is suspended when you close the lid. That’s the expected behavior. It saves the battery as well as your work. You lift the lid, the system wakes up, and you can log in and continue

On a related topic, you may want to change the power settings so that Ubuntu doesn't lock itself if unattended for five minutes.

How to Prevent Ubuntu from Going into Sleep Mode
Leave the system for five minutes and it goes into sleep mode? Here’s what you can do to get rid of this annoyance.

Do share your feedback whether it worked for you or not.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.