[RESPONDED] Ubuntu 22.04 No Lid Close Suspend

Good afternoon,

I’m unable to figure out how to get Ubuntu to suspend when I close the lid of my laptop.

This presents quite a problem for me as I can’t safely put the laptop in my bag. You would think oh just sleep the laptop before you close the lid but closing the lid when the laptop is asleep seems to cause it to wake up, which is equally strange. I almost cooked it when I first got it because I just closed the lid and stuck it in my bag, meanwhile it was running the entire time.

Normally there is an option to control this under the power settings, but I don’t see anything related.

I tried editing the settings in logind.conf but that also didn’t fix it.

It’s a 12th gen Intel if that matters. I’m also running the OS off one of the expansion bay storage drives framework sells if that might have something to do with it?

This is a shot in the dark, but do you have “gnome tweaks” installed? It has a setting that is hidden in the normal settings that disables suspend on lid close that overrides the logind settings.

If it doesn’t come pre-installed on Ubuntu 22.04 then no. I don’t see it in a dpkg -l output either.

The setting can also be changed through dconf editor, though if this is a fresh ubuntu install, it’s unlikely that something like that got changed accidentally.

You could check that the lid signal is actually being registered using the command line utility “xev” which is part of the “x11-utils” package. If not, it is likely a hardware problem. Note that xev only works under xorg, so you should choose the xorg/x11 session at the login screen.

I dual boot on another drive with Windows and the lid works correctly in Win 11, so unlikely it’s hardware. I can still check though.
I’m not really sure what I’m looking at but it seems to register the lid closing?

PropertyNotify event, serial 37, synthetic NO, window 0x1a00001,
    atom 0x13b (_GTK_EDGE_CONSTRAINTS), time 10739374, state PropertyNewValue

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,0), width 178, height 10, count 3

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,10), width 10, height 58, count 2

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (68,10), width 110, height 58, count 1

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,68), width 178, height 110, count 0

PropertyNotify event, serial 37, synthetic NO, window 0x1a00001,
    atom 0x13b (_GTK_EDGE_CONSTRAINTS), time 10739387, state PropertyNewValue

PropertyNotify event, serial 37, synthetic NO, window 0x1a00001,
    atom 0x13b (_GTK_EDGE_CONSTRAINTS), time 10754285, state PropertyNewValue

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,0), width 178, height 10, count 3

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,10), width 10, height 58, count 2

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (68,10), width 110, height 58, count 1

Expose event, serial 37, synthetic NO, window 0x1a00001,
    (0,68), width 178, height 110, count 0

PropertyNotify event, serial 37, synthetic NO, window 0x1a00001,
    atom 0x13b (_GTK_EDGE_CONSTRAINTS), time 10754301, state PropertyNewValue

It’s interesting because when I close the lid it does lock the user session but I can tell it isn’t sleeping as the screen is on and the CPU fun is still running.

Ah, if it works in windows, it’s definitely not a hardware issue as you say… I’d say that it is worth installing gnome tweaks and checking the toggle even if it is a remote possibility.

You can install it from the “Software” app if you have the universe repository enabled, or you can run this command:

sudo apt install gnome-tweaks

Also, just checking in case you haven’t done this yet: after changing the “HandleLidSwitch” setting in logind.conf, did you restart the service? Or alternatively restart the machine?

I installed Gnome Tweaks and yes the toggle is on:

I did restart the laptop after adjusting the HandleLidSwitch setting.

First Try ruling out misconfigured settings on current install, by trying a fresh live usb of ubuntu see if suspend issue still persist?

It doesn’t work properly on the live USB either.

It’s something with the main Ubuntu distro. Switched to Mint and the laptop sleeps fine now.