Suspend on lid-close

Archived topics about LMDE 1 and LMDE 2
Locked
firefexx

Suspend on lid-close

Post by firefexx »

Hi,

I recently installed LMDE with Cinnamon and observed some strange behaviour concerning suspend.
When logged in as a user, suspend when closing laptop-lid works as expected.
But when nobody is logged in, i.e. the log in screen is visible, nothing happens when closing the laptop-lid.

Could someone assist in fixing this issue?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Monsta
Level 10
Level 10
Posts: 3071
Joined: Fri Aug 19, 2011 3:46 am

Re: Suspend on lid-close

Post by Monsta »

firefexx wrote:But when nobody is logged in, i.e. the log in screen is visible, nothing happens when closing the laptop-lid.
When nobody is logged in, it's MDM that's active, not Cinnamon. You may try another display manager (e.g. LightDM) for experiment.
firefexx

Re: Suspend on lid-close

Post by firefexx »

Thank you for your answer, but lightdm doesn't suspend on lid-close, too.
lightdm works for me under Fedora but not with LMDE.
chrisonmint

Re: Suspend on lid-close

Post by chrisonmint »

firefexx wrote:Hi,

I recently installed LMDE with Cinnamon and observed some strange behaviour concerning suspend.
When logged in as a user, suspend when closing laptop-lid works as expected.
But when nobody is logged in, i.e. the log in screen is visible, nothing happens when closing the laptop-lid.

Could someone assist in fixing this issue?
This problem was annoying me too, so I did a bit of looking around. Linux mint uses the "mint display manager" aka MDM and I found that there are some terminal commands and config files which will solve this for you.

'logind' is the command line tool which handles the login screen. It has a config file here /etc/systemd/logind.conf and you can read about all the different options in a terminal window by typing

Code: Select all

man logind.conf
The important line(s) for us are the following. In the default setup, all are set to 'ignore'. I changed the lid switch and power button to read 'suspend':

Code: Select all

HandlePowerKey=suspend
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=suspend
For each option, you can choose from:
ignore, poweroff, reboot, halt, kexec, suspend, hibernate, hybrid-sleep and lock

You will need to edit the conf file as root, so type the following:

Code: Select all

sudo pico /etc/systemd/logind.conf 
- if you are not familiar with pico (or its cousin, nano which is also installed) then I strongly recommend it. Much simpler than vi, although less powerful. Its a simple text editor and when you are finished, type ctrl-o to save the file and then ctrl-x to exit.
User avatar
Pjotr
Level 24
Level 24
Posts: 20086
Joined: Mon Mar 07, 2011 10:18 am
Location: The Netherlands (Holland) 🇳🇱
Contact:

Re: Suspend on lid-close

Post by Pjotr »

@chrisonmint: thanks for this cool solution! :)
Tip: 10 things to do after installing Linux Mint 21.3 Virginia
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Locked

Return to “LMDE Archive”