Roadblock getting CUDA in Ubuntu 21.10. "Package 'nvidia-prime' has no installation candidate"

Data are:
$ lspci | grep -i nvidia
18:00.0 VGA compatible controller: NVIDIA Corporation TU104GL [Quadro RTX 4000] (rev a1)
18:00.1 Audio device: NVIDIA Corporation TU104 HD Audio Controller (rev a1)
18:00.2 USB controller: NVIDIA Corporation TU104 USB 3.1 Host Controller (rev a1)
18:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU104 USB Type-C UCSI Controller (rev a1)

$ uname -a
Linux billb-ThinkStation-P920 5.10.0-1049-oem #51-Ubuntu SMP Mon Sep 27 11:01:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ lsmod | grep nvidia
nvidiafb 53248 0
vgastate 20480 1 nvidiafb
fb_ddc 16384 1 nvidiafb
i2c_algo_bit 16384 2 nvidiafb,igb
i2c_nvidia_gpu 16384 0

$ sudo lshw -c video
*-display UNCLAIMED
description: VGA compatible controller
product: TU104GL [Quadro RTX 4000]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:18:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller cap_list
configuration: latency=0
resources: memory:b3000000-b3ffffff memory:a0000000-afffffff memory:b0000000-b1ffffff ioport:5000(size=128) memory:b4000000-b407ffff

$ more /usr/share/X11/xorg.conf.d/10-amdgpu.conf
Section “OutputClass”
Identifier “AMDgpu”
MatchDriver “amdgpu”
Driver “amdgpu”

$ ls /lib/modprobe.d/blacklist-nvidia.conf
ls: cannot access ‘/lib/modprobe.d/blacklist-nvidia.conf’: No such file or directory

Steps to where I am are
$ sudo apt purge nvidia*
$ ubuntu-drivers devices

driver : nvidia-driver-495 - third-party non-free recommended

$ sudo apt install nvidia-driver-495
No errors. Reboot.
$ dkms status
nvidia, 495.29.05, 5.13.0-21-generic, x86_64: installed
$ nvidia-smi
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
$ dpkg -l | grep nvidia
ii libnvidia-cfg1-495:amd64 495.29.05-0ubuntu1 amd64 NVIDIA binary OpenGL/GLX configuration library
ii libnvidia-common-495 495.29.05-0ubuntu1 all Shared files used by the NVIDIA libraries
rc libnvidia-compute-390:i386 390.144-0ubuntu2 i386 NVIDIA libcompute package
ii libnvidia-compute-495:amd64 495.29.05-0ubuntu1 amd64 NVIDIA libcompute package
ii libnvidia-decode-495:amd64 495.29.05-0ubuntu1 amd64 NVIDIA Video Decoding runtime libraries
ii libnvidia-encode-495:amd64 495.29.05-0ubuntu1 amd64 NVENC Video Encoding runtime library
ii libnvidia-extra-495:amd64 495.29.05-0ubuntu1 amd64 Extra libraries for the NVIDIA driver
ii libnvidia-fbc1-495:amd64 495.29.05-0ubuntu1 amd64 NVIDIA OpenGL-based Framebuffer Capture runtime library
ii libnvidia-gl-495:amd64 495.29.05-0ubuntu1 amd64 NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii nvidia-compute-utils-495 495.29.05-0ubuntu1 amd64 NVIDIA compute utilities
ii nvidia-dkms-495 495.29.05-0ubuntu1 amd64 NVIDIA DKMS package
ii nvidia-driver-495 495.29.05-0ubuntu1 amd64 NVIDIA driver metapackage
ii nvidia-kernel-common-495 495.29.05-0ubuntu1 amd64 Shared files used with the kernel module
ii nvidia-kernel-source-495 495.29.05-0ubuntu1 amd64 NVIDIA kernel source package
ii nvidia-utils-495 495.29.05-0ubuntu1 amd64 NVIDIA driver support binaries
ii xserver-xorg-video-nvidia-495 495.29.05-0ubuntu1 amd64 NVIDIA binary Xorg driver

$ sudo ./ --uninstall
reports no nvidia driver installed

$ grep nvidia /etc/modprobe.d/* /lib/modprobe.d/*
/etc/modprobe.d/nvidia-installer-disable-nouveau.conf:# generated by nvidia-installer
/lib/modprobe.d/nvidia-installer-disable-nouveau.conf:# generated by nvidia-installer
/lib/modprobe.d/nvidia-kms.conf:options nvidia-drm modeset=1

$ sudo apt install nvidia-prime
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package nvidia-prime is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘nvidia-prime’ has no installation candidate

I think I need nvidia-prime to proceed but am interested in guidance on how to install it.

Thank you,


Please run as root and attach the resulting file here.

Mart–thank you, Bill

nvidia-bug-report.log.gz (146.3 KB)

For what it’s worth, other data (that is apt to be in the attached bug report):
$ nvidia-detector
$ dkms status
nvidia, 495.44, 5.13.0-21-generic, x86_64: installed
$ modprobe nvidia
modprobe: FATAL: Module nvidia not found in directory /lib/modules/5.10.0-1049-oem
$ find /lib/modules -name “nvidia” -print

As all the boot logs in the bug report… You built the nvidia kernel modules for kernel 5.13, but you always boot with 5.10.
Either boot the 5.13 kernel or install the nvidia modules for the 5.10 kernel using dkms…

Mart–yes, thank you. Changing the linux boot kernel was the solution. CUDA, pytorch gpu, all else works great now. Bill

nvidia packagers: feature request for the nvidia installer to coordinate with the installed kernel

Other readers with a similar problem: I have a Lenovo Thinkstation 920. Web searches say that you can change the boot kernel via the grub menu at startup. At the “right time” in the boot sequence after UEFI you press you press a key to get the grub menu wherein you can select the kernel among the installed options. Some postings say while booting you press F12, some say F1, some say Esc. Some postings say you edit /etc/default/grub and change GRUB_HIDDEN_TIMEOUT=0 to =10. Some postings say you edit GRUB_TIMEOUT_STYLE=hidden to =menu.

No permutation of the above worked for me. The grub menu never appeared at startup. $ uname -r always returned the same kernel after reboot.

The solution that finally worked was to install Grub Customizer from the Ubuntu software catalog and use the second tab panel to select the default boot kernel. On reboot, the kernel per uname -r is now the intended one, nvidia-smi finally finds the nvidia driver and card, and pytorch finally reports torch.cuda.is_available(),

Did you run sudo update-grub after changing /etc/default/grub?

Read about the possible parameters here:
info -f grub -n 'Simple configuration'