Last active
January 5, 2026 17:19
-
-
Save danilw/000f6aa34f7e950950fa526d25456db1 to your computer and use it in GitHub Desktop.
Nvidia make suspend work in Linux in Wayland (GNOME)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Nvidia make suspend work in Linux in Wayland (GNOME) | |
| Source: | |
| https://gist.github.com/jstarcher/abdac9c2c0b5de8b073d527870b73a19 | |
| https://bbs.archlinux.org/viewtopic.php?pid=2044189#p2044189 | |
| additional read section 10 | |
| https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks | |
| NOTE - NVreg_TemporaryFilePath=/var/tmp free space at location must be larger than your VRAM size | |
| NOTE2 - script that do killall -STOP firefox and killall -CONT firefox etc is REQUIRED | |
| if you want to "resume" other GPU app like game - you need to manually "pause" it and "resume" | |
| or add process name to script in similar way as others | |
| NOTE3 - LAPTOP | |
| for laptop case where integrated used and you do not want to have nvidia running all the time | |
| change to fbdev=0 and modeset=0 in two next sections | |
| ________ | |
| Edit/create file | |
| /etc/modprobe.d/nvidia.conf | |
| blacklist nouveau | |
| options nvidia_drm modeset=1 | |
| options nvidia_drm fbdev=1 | |
| options nvidia NVreg_PreserveVideoMemoryAllocations=1 | |
| options nvidia NVreg_TemporaryFilePath=/var/tmp | |
| ________ | |
| Boot grub kernel option: | |
| nvidia_drm.modeset=1 nvidia_drm.fbdev=1 | |
| ________ | |
| ________ | |
| Edit/create file | |
| /usr/local/bin/suspend-gnome-shell.sh | |
| #!/bin/bash | |
| case "$1" in | |
| suspend) | |
| killall -STOP chrome | |
| killall -STOP firefox | |
| killall -STOP gnome-shell | |
| ;; | |
| resume) | |
| killall -CONT gnome-shell | |
| killall -CONT chrome | |
| killall -CONT firefox | |
| ;; | |
| esac | |
| ________ | |
| Run below: | |
| sudo chmod +x /usr/local/bin/suspend-gnome-shell.sh | |
| ________ | |
| ________ | |
| Edit/create file | |
| /etc/systemd/system/gnome-shell-suspend.service | |
| [Unit] | |
| Description=Suspend gnome-shell | |
| Before=systemd-suspend.service | |
| Before=systemd-hibernate.service | |
| Before=nvidia-suspend.service | |
| Before=nvidia-hibernate.service | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/local/bin/suspend-gnome-shell.sh suspend | |
| [Install] | |
| WantedBy=systemd-suspend.service | |
| WantedBy=systemd-hibernate.service | |
| ________ | |
| Edit/create file | |
| /etc/systemd/system/gnome-shell-resume.service | |
| [Unit] | |
| Description=Resume gnome-shell | |
| After=systemd-suspend.service | |
| After=systemd-hibernate.service | |
| After=nvidia-resume.service | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/local/bin/suspend-gnome-shell.sh resume | |
| [Install] | |
| WantedBy=systemd-suspend.service | |
| WantedBy=systemd-hibernate.service | |
| ________ | |
| Run below: | |
| systemctl daemon-reload | |
| systemctl enable gnome-shell-suspend | |
| systemctl enable gnome-shell-resume | |
| ________ | |
| Reboot | |
| OPTIONAL - to block wakeup from keyboard | |
| or when keyboard broken and wakeup automatically (after every boot) | |
| echo PTXH | sudo tee /proc/acpi/wakeup | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment