View previous topic :: View next topic |
Author |
Message |
gddman n00b
Joined: 11 Aug 2018 Posts: 11
|
Posted: Wed May 13, 2020 2:30 pm Post subject: [SOLVED] Stop elogind suspending upon closing laptop lid |
|
|
Hello, something that's been bugging me ever since switching from consolekit to elogind, is that elogind has configured it so that when I shut my laptop's lid, the system suspends.
I wouldn't mind this, but since it fails to resume property (I get a black screen upon resuming), it means if I accidentally shut down my lid, I then have to do a hard reset. I have no idea why elogind's suspend doesn't resume property, since both and Code: | echo mem > /sys/power/state | resume just fine. I can confirm that it's elogind cuasing this, because if I run it similarly fails to resume from suspend.
I have tried adding /etc/systemd/logind.conf with "HandleLidSwitch=ignore", but this failed to fix the problem, the system still goes to suspend mode when I close the laptop lid. Any ideas?
EDIT: Just fixed it. Instead of creating /etc/systemd/logind.conf, the correct file is /etc/elogind/logind.conf. Just put Code: | HandleLidSwitch=ignore | there instead.
Last edited by gddman on Wed May 13, 2020 2:48 pm; edited 1 time in total |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 31446 Location: here
|
Posted: Wed May 13, 2020 2:48 pm Post subject: Re: Stop elogind from suspending when I shut the laptop lid |
|
|
gddman wrote: | I have tried adding /etc/systemd/logind.conf with "HandleLidSwitch=ignore", but this failed to fix the problem, the system still goes to suspend mode when I close the laptop lid. Any ideas? |
If you use elogind correct place for add it is /etc/elogind/logind.conf or is a typo? _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
gddman n00b
Joined: 11 Aug 2018 Posts: 11
|
Posted: Wed May 13, 2020 2:50 pm Post subject: Re: Stop elogind from suspending when I shut the laptop lid |
|
|
fedeliallalinea wrote: | gddman wrote: | I have tried adding /etc/systemd/logind.conf with "HandleLidSwitch=ignore", but this failed to fix the problem, the system still goes to suspend mode when I close the laptop lid. Any ideas? |
If you use elogind correct place for add it is /etc/elogind/logind.conf or is a typo? |
Yup, you're right. Putting it in /etc/elogind/logind.conf fixed it. I just assumed was in systemd without checking first, so that's my bad. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2056 Location: United Kingdom
|
Posted: Wed May 13, 2020 6:15 pm Post subject: |
|
|
gddman,
Does your laptop have an NVIDIA GPU, by any chance? I had the same problem as you did and, as I don't mind the laptop suspending when I close the lid, I resolved the problem with a script 04-nvidia-drivers in the directory /lib64/elogind/system-sleep/ as listed below.
Code: | #!/bin/sh
#
# Unload nvidia modules on hibernate or suspend
# Load nvidia modules on thaw or resume
function unload_if_loaded() {
MODULE=$1
if lsmod | grep "$MODULE" &>/dev/null; then
rmmod $MODULE
fi
}
case $1/$2 in
pre/*)
unload_if_loaded nvidia_drm
unload_if_loaded nvidia_modeset
unload_if_loaded nvidia
# echo "Suspending/Hibernating" >> /dev/null
;;
post/*)
modprobe nvidia_drm
# echo "Resuming/Thawing" >> /dev/null
;;
*)
exit $NA
;;
esac |
If you use KDE and also have trouble with screen corruption upon resuming this way, I had success by creating a script 02-toggle-compositing in the same directory:
Code: | #!/bin/sh
#
# Turn off compositing on hibernate or suspend
# Turn on compositing on thaw or resume
username=fitzcarraldo
userhome=/home/$username
export XAUTHORITY="$userhome/.Xauthority"
export DISPLAY=":0"
case $1/$2 in
pre/*)
su $username -c "qdbus org.kde.KWin /Compositor suspend" &
;;
post/*)
su $username -c "/usr/bin/kwin_x11 --replace" &
su $username -c "qdbus org.kde.KWin /Compositor resume" &
;;
*)
exit $NA
;;
esac |
Ref. (for a Gentoo installation using ConsoleKit rather than elogind, but the principle is still relevant): Gentoo Linux: A work-around to be able to Resume from Suspend to RAM when using the NVIDIA closed-source driver _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|