Failed to create cuda context Illegal adress

I’m not sure if this is related, but I’ll put it here in case it helps anyone. I got a new 2060 a few months ago for my Linux Mint system and it worked great in Blender until after a suspend/wake cycle. Using it in any still-open instance of Blender would give a cuda context error, then a new instance would just not detect the gpu at all (preferences/system/cycles-render-device would be empty/cpu-only), until the system was restarted.

This is what I did to resolve this:

(Warning: this was a couple months ago, these steps are based on the notes I left for myself, I am not an expert, I can’t vouch for it still being applicable now/into the future, follow at your own risk, no warranty, make a system backup beforehand, I don’t yet know if/how this interacts with possible future driver or os updates, this may actually be solved/superceded by 460.56 update mentioned above but I don’t know, maybe wait and see first)

  1. You should have a file here:
    file:///usr/share/doc/nvidia-driver-###/html/powermanagement.html
    (replace ### with your current driver version, eg. 460).
    Follow the instructions under systemd Configuration.
    Note: nvidia_glx-1.0/samples doesn’t exist, the service files are actually in
    usr/share/doc/nvidia-driver-###
  2. In etc/modprobe.d add a file nvidia.conf with the text:
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    Note: root permission required to create/edit file.
  3. Rebuild initramfs with sudo update-initramfs -u.
  4. Reboot.
For convenience, here are all the substeps (assuming driver version 460):
  • Open terminal and run these commands:
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-suspend.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-hibernate.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-resume.service /etc/systemd/system
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia /lib/systemd/system-sleep
    • sudo install /usr/share/doc/nvidia-driver-460/samples/systemd/nvidia-sleep.sh /usr/bin
    • sudo systemctl enable nvidia-suspend.service
    • sudo systemctl enable nvidia-hibernate.service
    • sudo systemctl enable nvidia-resume.service
  • In file browser:
    • open etc/modprobe.d as root.
    • create a new file “nvidia.conf”
    • open it in text editor and write:
      options nvidia NVreg_PreserveVideoMemoryAllocations=1
      then save and close.
  • Back in the terminal, run: sudo update-initramfs -u
  • Reboot.

For reference, this was performed on this system setup:
  • OS: Linux Mint 20 Cinnamon (fairly fresh installation)
  • Linux Kernel: 5.8.0-xx series
  • CPU: i7-6700K
  • GPU: EVGA NVIDIA GeForce RTX 2060 SUPER 8GB SC ULTRA GAMING
1 Like