Hyprland: Suspend issue with Nvidia

Hi, I’m hoping you might be able to assist with an issue I’m having with resuming from sleep/suspend when using Hyprland (though this issue also seems to persist with other DEs such as KDE and Gnome), and across other distros.

The issue

When laptop goes into sleep (deep sleep/hibernate), upon waking only the external monitor connected via HDMI works, the internal laptop screen remains black. If the laptop sleeps again, it seems like all Hyprland functionality stops working (windows are visible on external monitor, but cannot click or use keybinds) until reboot.

System info

If relevant, I am using BTRFS. I launch Hyprland from SDDM.

I followed the steps outlined in: https://wiki.hyprland.org/Nvidia/ and https://wiki.archlinux.org/title/NVIDIA

  • Using dkms drivers with linux-headers installed

Kernel parameters:

Set options nvidia_drm modeset=1 fbdev=1 in /etc/modprobe.d/nvidia.conf

Though from https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting it seems from nvidia-utils 560.35.03-5 DRM is enabled by default.

Added nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 to GRUB_CMDLINE_LINUX_DEFAULT and rebuilt grub config. Probably redundant for the first two params considering modprobe config above. Encountered black screen on login without fbdev=1 .

Enabled services nvidia-suspend.service, nvidia-hibernate.service, nvidia-resume.service.

Early loading:

Added force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm " to /etc/dracut.conf.d/myflags.conf and ran dracut-rebuild.

Env vars:

Set env vars in .config/hypr/hyprland.conf, including those for hardware acceleration.

Optimus:

As Hyprland docs suggested, set BIOS setting to discrete graphics only. optimus-manager is not installed.

With hybrid graphics enabled, resume seems to work, but the external monitor tends to freeze.

Other info:

nvidia-smi output:

inxi -Gxx:

(Not really sure why X/Xwayland is being used here or if it is relevant).

systemctl -b -1 | grep "suspend":

Summary
oct 19 02:21:04 eos kernel: nvme 0000:06:00.0: platform quirk: setting simple suspendntel snd_intel_dspcfg kvm snd_usb_audio snd_intel_sdw_acpi mac80211 btu
oct 19 03:01:12 eos systemd-logind[996]: The system will suspend now!
oct 19 03:01:12 eos systemd[1]: Starting NVIDIA system suspend actions...
oct 19 03:01:12 eos suspend[8162]: nvidia-suspend.service
oct 19 03:01:12 eos logger[8162]: <13>Oct 19 03:01:12 suspend: nvidia-suspend.service
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:13 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos kernel:  nv_procfs_write_suspend+0xef/0x170 [nvidia 1400000003000000474e5500b6595e553982bbae]
oct 19 03:01:14 eos systemd[1]: nvidia-suspend.service: Deactivated successfully.
oct 19 03:01:14 eos systemd[1]: Finished NVIDIA system suspend actions.
oct 19 03:01:14 eos systemd[1]: nvidia-suspend.service: Consumed 1.010s CPU time, 764.2M memory peak.
oct 19 03:01:14 eos systemd-sleep[8192]: in suspend-then-hibernate operations or setups with encrypted home directories.
oct 19 03:01:14 eos systemd-sleep[8192]: Performing sleep operation 'suspend'...
oct 19 03:01:14 eos kernel: PM: suspend entry (deep)
oct 19 11:55:55 eos kernel: printk: Suspending console(s) (use no_console_suspend to debug)
oct 19 11:55:56 eos systemd-sleep[8192]: System returned from sleep operation 'suspend'.
oct 19 11:55:56 eos kernel: PM: suspend exit
oct 19 11:56:14 eos systemd[1]: systemd-suspend.service: Deactivated successfully.
oct 19 11:56:14 eos systemd[1]: systemd-suspend.service: Consumed 2.144s CPU time, 11.9M memory peak.
oct 19 11:56:14 eos systemd-logind[996]: Operation 'suspend' finished.
oct 19 11:56:14 eos suspend[9020]: nvidia-resume.service
oct 19 11:56:14 eos logger[9020]: <13>Oct 19 11:56:14 suspend: nvidia-resume.service

systemctl -b -1 | grep "resume":

Summary
oct 19 02:21:00 eos kernel: Command line: BOOT_IMAGE=/@/boot/vmlinuz-linux root=UUID=d20ded4d-1aba-4933-94ea-331d9b3ae7c8 rw rootflags=subvol=@ nowatchdog nvme_load=YES rd.luks.uuid=59094a85-1668-490c-915e-476ebcf70875 rd.luks.uuid=c47ca443-288f-4e30-a060-81cf1b0097cc resume=/dev/mapper/luks-c47ca443-288f-4e30-a060-81cf1b0097cc nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 loglevel=3
oct 19 02:21:00 eos kernel: Kernel command line: BOOT_IMAGE=/@/boot/vmlinuz-linux root=UUID=d20ded4d-1aba-4933-94ea-331d9b3ae7c8 rw rootflags=subvol=@ nowatchdog nvme_load=YES rd.luks.uuid=59094a85-1668-490c-915e-476ebcf70875 rd.luks.uuid=c47ca443-288f-4e30-a060-81cf1b0097cc resume=/dev/mapper/luks-c47ca443-288f-4e30-a060-81cf1b0097cc nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 loglevel=3
oct 19 02:21:00 eos dracut-cmdline[251]: Using kernel command line parameters:  rd.driver.pre=btrfs rd.driver.pre=nvidia rd.driver.pre=nvidia_modeset rd.driver.pre=nvidia_uvm rd.driver.pre=nvidia_drm   BOOT_IMAGE=/@/boot/vmlinuz-linux root=UUID=d20ded4d-1aba-4933-94ea-331d9b3ae7c8 rw rootflags=subvol=@ nowatchdog nvme_load=YES rd.luks.uuid=59094a85-1668-490c-915e-476ebcf70875 rd.luks.uuid=c47ca443-288f-4e30-a060-81cf1b0097cc resume=/dev/mapper/luks-c47ca443-288f-4e30-a060-81cf1b0097cc nvidia_drm.modeset=1 nvidia_drm.fbdev=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 loglevel=3
oct 19 02:21:09 eos systemd[1]: systemd-hibernate-resume.service: Deactivated successfully.
oct 19 11:55:55 eos kernel: ACPI: PM: Low-level resume complete
oct 19 11:55:55 eos kernel: spd5118 6-0050: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
oct 19 11:55:55 eos kernel: spd5118 6-0050: PM: failed to resume async: error -6
oct 19 11:55:55 eos kernel: spd5118 6-0052: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
oct 19 11:55:55 eos kernel: spd5118 6-0052: PM: failed to resume async: error -6
oct 19 11:56:14 eos systemd[1]: Starting NVIDIA system resume actions...
oct 19 11:56:14 eos suspend[9020]: nvidia-resume.service
oct 19 11:56:14 eos logger[9020]: <13>Oct 19 11:56:14 suspend: nvidia-resume.service
oct 19 11:56:14 eos systemd[1]: nvidia-resume.service: Deactivated successfully.
oct 19 11:56:14 eos systemd[1]: Finished NVIDIA system resume actions.

Please let me know if you need any further info, eg. info from when system is in broken state after sleep. I am quite stumped, so I really appreciate help - thanks!