Lenovo Legion shuts off when lid is closed after sytemctl suspend

Hi! I am running EndeavourOs with KDE and a swap file on a Lenovo Legion Slim 5 Gen 9. Hibernation works great, but suspend is having issues.

When I run systemctl suspend, it correctly goes to sleep and wakes up when the mouse is moved. If I run systemctl suspend and then close and reopen the lid, the power button light flickers blue for a couple seconds and then turns off. The laptop completely and unexpectedly shuts down.

In the KDE Power Management settings, I have it set to “Do Nothing” when the laptop lid is closed, so it is not related to KDE power management and has something to do with systemctl suspend. I have looked for a BIOS setting that might be messing things up and found nothing.

Thanks in advance for any help!

The power button blinks blue when sleeping as this link says if I do not close the lid, but it flickers rapidly and randomly for a second or two after closing and reopening the lid. https://download.lenovo.com/pccbbs/pubs/legion_7_16_6/html_en/EN/led_power_button.html

Tried installing nvidia-dkms in case I had nvidia-open-dkms installed (https://wiki.hyprland.org/Nvidia/ talks about this) but that made no difference. I think I did it correctly. I just ran yay -R nvidia followed by nvidia-inst. Anybody have any ideas or leads?

Try adding HandleLidSwitch=ignore to /etc/systemd/logind.conf

Thanks for trying to help! It didn’t work :confused:

That’s odd, I also have a Lenovo Legion and uncommenting and amending that line in the worked for me.

Just to check the obvious things - did that file already exist or did you have to create it? Possibly your logind config is located elsewhere?

And of course - you rebooted after making the change?

OK, it worked this time. That stopped the laptop from sleeping when the lid is closed, but I still want it to sleep, I just don’t want it to shut off when it goes to sleep.

I’m confused - in your first post you specifically stated you were suspending by running the command, and had already switched off the “suspend on lid closed” settings accordingly in KDE. Is the command also no longer working?

In this case I would suggest re-enabling the settings in KDE to let that handle the suspend, while KEEPING the change made to logind.conf so that it isn’t superseded.

I also just noticed you mentioned KDE in your first post but went on to link Hyprland’s Nvidia FAQ - which are you actually using?

Hyprland’s configuration is significantly different, requiring specific lines to be added to hyprland.conf to manage suspend.