Fedora Server 40 - Issue Preventing Suspend on Lid Close

Hi all,

I’ve just set up a new F40 Server, and followed the previous instructions on ignoring suspend on lid close (its on a laptop).

They didn’t seem to work at all. First I realised the location of the file to edit had changed, so I found the new location and made the usual edits.

Here is the contents of the file - the server still suspends when the laptop is closed. Please let me know if more information is needed.

Note - I have had earlier versions of Fedora working on this laptop with the lid closed just fine.

Goal: Prevent suspending when laptop lid closed on Fedora 40 Server
File: /usr/lib/systemd/logind.conf

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192
#StopIdleSessionSec=infinity

Do not modify anything in /usr unless that’s /usr/local.

sudo tee /etc/systemd/logind.conf << EOF > /dev/null
[Login]
HandleLidSwitch=ignore
EOF
sudo restorecon -F -R /etc/systemd
sudo systemctl restart systemd-logind.service
1 Like

Thank you - that worked! I appreciate it

1 Like