4

So here are the things related with my problem:

  • I uncommented these lines
$ grep -v '^#' /etc/systemd/logind.conf

[Login] HandleLidSwitch=suspend HandleLidSwitchExternalPower=suspend HandleLidSwitchDocked=ignore

  • It detects the lid actions, but It just doesn't suspend my pc.
$ sudo journalctl -b -u systemd-logind

I can see these in the last 2 lines of the output of above line

systemd-logind[917]: Lid closed.
systemd-logind[917]: Lid opened.
  • After checking this post I also checked this command
$ systemd-inhibit --list --mode=block
WHO  UID  USER  PID  COMM           WHAT                                    >
alk  1000 alk   1592 gsd-power      handle-lid-switch                       >
alk  1000 alk   1590 gsd-media-keys handle-power-key:handle-suspend-key:hand>

So on the output WHO and USER columns are not gdm (it is in the post that I linked). That's why I didn't want to create a kill script without being sure.

What should I do?

The_O
  • 139

3 Answers3

1

Since I had the same problem, I thought I might post my solution to it:

Change the content of logind.conf with:

sudo nano /etc/systemd/logind.conf

Specifically, uncomment the following lines and change their values, if needed, to be as follows:

HandleSuspendKey=suspend
HandleHibernateKey=hibernate
HandleLidSwitch=suspend
HandleLidSwitchDocked=suspend

Then restart the service with:

systemctl restart systemd-logind.service

and it should work.

In my case it takes up to 15 seconds until my laptop goes into sleep and doesn`t work with any other configuration.

0

I had the same problem, I even tried to kill gsd-power. Then the inhibit-block was removed and the laptop did go to sleep on lid close, but on the downside some of the special keys (e.g. for setting the brightness) stopped working. So my fix was to set IgnoreLid=true at the bottom of /etc/UPower/UPower.conf.

I hope this helps :)

  • 1
    Hi Michael. Thank you very much. I can't try your solution as I already reinstalled ubuntu on my laptop. I'm not sure what are the necessary configurations for people who already have this problem, but while installing ubuntu, choosing the Ubuntu (safe graphics) solved all of my problems. Some of those problems were: Lid problem, neither night light level nor screen brightness wasn't changing at all, pc wasn't detecting the 2nd monitor and probably a few more that I hadn't discovered yet .d I'm adding my solution to the question as well. I forgot that I asked this question. – The_O Feb 09 '21 at 17:37
-1

So after having lots of problems on my laptop (lid problem, pc wouldn't detect 2nd monitor, neither night light nor brightness settings were not working, computer freeze without nomodeset etc.) while installing ubuntu I chose the option Ubuntu (safe graphics) and now all of my problems are solved. Hope it helps to you too!

The_O
  • 139