Skip to main content
Topic: Elogind system-sleep Nvidia hook script not executing (Read 1162 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Elogind system-sleep Nvidia hook script not executing

I am trying to have my laptop (Dell Precision 5530) hibernate when I close the lid, however hibernate hangs and crashes xorg. I figured out I can suspend manually (successfully) by running:
   
Code: [Select]
sudo /bin/nvidia-sleep.sh hibernate && sudo loginctl hibernate

Running just
Code: [Select]
sudo loginctl hibernate
by itself hangs on a black screen and crashes xorg when I finally reboot.

To enable hibernate I edited /etc/default/grub to:
Code: [Select]
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet resume=/dev/nvme0n1p2 nvidia"
and update-grub
Code: [Select]
sudo grub-mkconfig -o /boot/grub/grub.cfg

I also added resume to mkinitcpio hooks:
Code: [Select]
HOOKS=(base udev autodetect modconf block filesystems keyboard resume fsck)
Code: [Select]
sudo mkinitcpio -P 

I modified the hook script in /lib/elogind/system-sleep/nvidia to and made sure it was marked executable.

Code: [Select]
#!/bin/sh

case "$1" in
    pre)
        /usr/bin/nvidia-sleep.sh "hibernate"
 ;;
    post)
        /usr/bin/nvidia-sleep.sh "resume"
        ;;
esac
Code: [Select]
ls -laF /lib/elogind/system-sleep/
drwxr-xr-x 2 root root 4096 Feb  2 10:59 ./
drwxr-xr-x 6 root root 4096 Feb  1 21:48 ../
-rwxr-xr-x 1 root root  140 Jan 19 11:15 49-tlp-sleep*
-rw-r--r-- 1 root root    0 Jun 18  2021 .keep_dir
-rwxr-xr-x 1 root root  212 Feb  2 10:24 nvidia*

I also modified /etc/elogind/logind.conf changing the HandleLidSwitch to change the lid behvior to hibernate:
Code: [Select]
HandleLidSwitch=hibernate
HandleLidSwitchExternalPower=hibernate
HandleLidSwitchDocked=hibernate

After modifying the hook script I expected similar behavior running
Code: [Select]
sudo loginctl hibernate
as running
Code: [Select]
sudo /bin/nvidia-sleep.sh hibernate && sudo loginctl hibernate
however the behavior remains the same as if I ran
Code: [Select]
sudo loginctl hibernate
before the modifications (hangs & crashes xorg).

I am running linux-lts and using nvidia-dkms drivers with runit as the init system.
Code: [Select]
uname -r
5.15.16-1-lts

Thanks in advance for any help.