Ubuntu – 13.10 Laptop goes to sleep instead of shutting down when lid is closed

power-management

Sometimes (but not always), I use my laptop exactly like a desktop computer: I power it on with the lid closed and an external monitor and USB keyboard and mouse connected. When I later want to shut it down, the lid is still closed. It used to power down just fine with previous versions of Ubuntu (12.04 and 12.10 for sure, 13.04 probably as well).

Ever since I installed Ubuntu 13.10, instead of powering down, my laptop now goes to sleep immediately after logging me off. The actual shutdown sequence only happens if I open the lid again, otherwise my laptop stays suspended.

So I have been caught a few times with my laptop still on when I expected it to be off. Not a good idea to shove a running computer inside a closed bag that I carry around!

Searching around, I find a lot of people with the opposite problem (computer shutting down when they really want to suspend). I also read many people advising to make changes to some "systemd" setting to ignore the suspend altogether, which I am wary about: why would I want to disable suspend completely for a single type of situation while I still want my laptop to suspend when I use it on battery power? And even more since it used to work just fine with previous versions of Ubuntu.

Do you guys have any idea what the problem might be, or how I could troubleshoot this deeper?

— EDIT:
I am left with an additional question: is this problem specific to my computer, have I done something wrong to cause it? As soon as I have time, I will try to work on this. Like, does this happen from the live CD? Does it happen on a different laptop computer? Does it happen with a completely clean install on my current computer? I will let you know what I find out.

Best Answer

You need to configure logind.conf - this would not disable the suspend, it would just to tell it to ignore the lid switch, or just lock screen.

This would also override any of your user's power settings, but it will work in the login screeen or when it is shutting down, when it is outside the user session and unaffected by the user's power settings.

You can configure it via:

sudo nano /etc/systemd/logind.conf

and change the HandleLidSwitch= line to:

HandleLidSwitch=ignore

Here is a qoute from a manual page - note it can take other values like lock, poweroff etc.

HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=

Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep" and "lock". If "ignore", logind will never handle these keys. If "lock", all running sessions will be screen-locked; otherwise, the specified action will be taken in the respective event. Only input devices with the "power-switch" udev tag will be watched for key/lid switch events. HandlePowerKey= defaults to "poweroff". HandleSuspendKey= and HandleLidSwitch= defaults to "suspend". HandleHibernateKey= defaults to "hibernate".

The manual page is here