It looks like the formatting on xircon’s post got jumbled, it should actually be a one liner
- /etc/modprobe.d/nvidia-power-management.conf
options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp
For i3-wm, I also had to do the following for hibernate, and as a bonus suspend also works.
LightDM
Summary
- Create a file on ‘/usr/local/bin/optimus.sh’ with:
#!/bin/sh
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
- Make it executable with:
sudo chmod a+rx /usr/local/bin/optimus.sh
- Edit /etc/lightdm/lightdm.conf and set this at the [Seat:*] section:
display-setup-script=/usr/local/bin/optimus.sh
- Just uncomment, and add the location of the script
Xorg
Summary
- Create file
/etc/X11/xorg.conf.d/20-nvidia.conf
with:
Section "Module"
Load "modesetting"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
Option "AllowEmptyInitialConfiguration"
EndSection
- The BusID should be PCI:1:0:0, but you can find yours using
lspci | grep -E 'VGA|3D'
- There is also an alternate 20-nvidia.conf on the Nvidia troubleshooting WIKI.
NOTE: Only use one, not both
Systemd
Summary
- sudo systemctl enable nvidia-suspend.service
- sudo systemctl enable nvidia-hibernate.service (not needed if only using suspend)
- sudo systemctl enable nvidia-persistenced.service (if external monitor is used)
As you are only trying to get suspend to work, you may or may not need the xorg instructions.