Hyprland: Crash after suspending/closing laptop lid

Potentially related to #1726, but no screenlock is involved.

Issue

After suspending, either via closing the laptop lid or using systemctl suspend, the system correctly goes to sleep. After waking up, hyprland flashes the screen gray a couple times, then crashes.

Steps

  1. Run Hyprland from TTY
  2. Open terminal, run systemctl suspend
  3. Unsuspend, via just typing in random letters or opening the laptop lid
  4. Boom, back to TTY

Config

hyprland.conf

Crash logs

Attaching the most recent report. Can easily reproduce if needed. hyprlandCrashReport4282.txt

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Fixed it via Preserving video memory after suspend

It solved the problem for me too, looks like i had to include this option:

On some notebooks, to enable any NVIDIA settings tweaking you must include this option, otherwise it responds with “Setting applications clocks is not supported” etc.

/etc/modprobe.d/nvidia.conf

options nvidia NVreg_RegistryDwords=“OverrideMaxPerf=0x1”

Without this option no other option was working so it was crashing.

Experiencing the same thing… hyprlandCrashReport1513.txt

I had the exact same issue, but just now fixed it by installing the nvidia-tkg drivers (vulkan-dkms 525.47.26), egl-wayland-git and enabling nvidia-resume.service. After that suspending works just fine. (Also need to append nvidia_modeset and nvidia_drm in /etc/modules-load.d/nvidia-dev-dkms-tkg.conf)

Are you on nvidia and using nvidia-open-dkms?

Sorry for the necrobump but I’m still experiencing this. I’ve checked my hyprland logs and I’m seeing a similar error.

I used the resume scripts and added a file at /etc/modprobe.d/nvidia-power-management.conf with

options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp/tmp-nvidia

I’ve also tried with

options nvidia NVreg_RegistryDwords="OverrideMaxPerf=0x1"

neither of these worked.

Any help would be greatly appreciated.

I realised this is slightly different. I am experiencing the same thing when the display is going to sleep but the pc is still awake. I’ve attached the crashlog.

hyprlandCrashReport2270.txt

Fixed it via Preserving video memory after suspend

It solved the problem for me too, looks like i had to include this option:

On some notebooks, to enable any NVIDIA settings tweaking you must include this option, otherwise it responds with “Setting applications clocks is not supported” etc. /etc/modprobe.d/nvidia.conf options nvidia NVreg_RegistryDwords=“OverrideMaxPerf=0x1”

Without this option no other option was working so it was crashing.


I tried this approach on Fedora 38, but it didn’t work. After some research, I discovered that:

Hyprland is attempting to communicate with the NVIDIA driver after it has already entered suspend mode, so it cannot respond. Linux tries to freeze the task but fails because Hyprland is waiting for a response from the driver and cannot be frozen.

The solution is to manually suspend Hyprland using the STOP signal before the NVIDIA driver goes into suspend mode. Then use the CONT signal upon resuming.

Solution

Click here for a script that automates the steps

or

  1. create suspend-hyprland.sh
#!/bin/bash

case "$1" in
    suspend)
        killall -STOP Hyprland
        ;;
    resume)
        killall -CONT Hyprland
        ;;
esac
  1. create hyprland-suspend.service
[Unit]
Description=Suspend hyprland
Before=systemd-suspend.service
Before=systemd-hibernate.service
Before=nvidia-suspend.service
Before=nvidia-hibernate.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/suspend-hyprland.sh suspend

[Install]
WantedBy=systemd-suspend.service
WantedBy=systemd-hibernate.service

  1. create hyprland-resume.service
[Unit]
Description=Resume hyprland
After=systemd-suspend.service
After=systemd-hibernate.service
After=nvidia-resume.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/suspend-hyprland.sh resume

[Install]
WantedBy=systemd-suspend.service
WantedBy=systemd-hibernate.service
  1. sudo systemctl daemon-reload sudo systemctl enable hyprland-suspend sudo systemctl enable hyprland-resume

Can also confirm it still happening to me without any real changes since last time, my crash report still seems to indicate the same thing (different than hurutparittya’s). I’ve also since confirmed this doesn’t happen on sway, so this is def an issue on the hyprland level and not in wlroots/nvidia drivers

hyprlandCrashReport400301.txt