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!

1 Like

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.

Hello,

I have a lenovo legion slim 5 16APH8 (8th generation) and I have the exact same problem on Ubuntu 24.04.1 LTS, kernel version: 6.11.0-21-generic.

My problem is when I close the lid of my laptop and it is configured to go in sleep mode when the lid is closed (default Ubuntu settings), then there is a certain chance that the laptop will crash/turns off. And there is a chance that when I open back the lid it wakes it normally.

When the laptop crashes the power button light starts to blink very quickly and fades away.

Did you find any fixes?

This is extremely frustrating.


Here is a situation that really allows to pinpoint the problem that we have here:

I disabled any reaction of the OS to the lid switch:

  • Editing sudo nano /etc/systemd/logind.conf
    Uncommenting:
    HandleLidSwitch=ignore
    HandleLidSwitchDocked=ignore
    HandleLidSwitchExternalPower=ignore

  • Disabling GNOME’s Lid Switch Handling
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
    gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'

So now the lid switch is ignored by the OS. If I close the lid and reopen it the laptop is back on immediately.

When I click suspend on the top right corner of my screen it goes correctly to sleep. But when I close the lid then it wakes up the laptop (the fans start spinning) and the laptop immediately crashes/turns off. The power button light starts to blink very quickly and fades away. So there is clearly an unwanted reaction to the lid switch.

In this case the crash happens 100% of the time.

It seems that it is a problem of compatibility between the laptop hardware and the linux kernel.