Driver in unknown state after attempting to install cuda. Ubuntu 22.04

I have a fresh install of Ubuntu 22.04, the first thing I was trying to do was get CUDA working. I had swapped over to “NVIDIA driver metapackage from nvidia-driver-510” using the Additional Drivers tab of Software & Updates.
I was able to confirm the driver was working and saw the expected output after a “nvidia-smi” call

I was using this guide to install cuda, trying my best to follow the Ubuntu instructions.

The order of commands was:

sudo apt install gcc
sudo apt-get install linux-headers-$(uname -r)
sudo apt-key del 7fa2af80
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get install cuda

EDIT: I just saw the wget command has “ubuntu2004” when I’m using 2204. Maybe this is the source of the issue, but I have no idea how to recover the current situation still.

Everything was successful until the last cuda install command, which has the output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 nvidia-kernel-common-510 : Conflicts: nvidia-kernel-common
 nvidia-kernel-common-515 : Conflicts: nvidia-kernel-common
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Seeing this, I tried to roll back to an earlier driver. Using the “additional drivers” tab again I attempted to swap to “nvidia-driver-470”.

After a restart it told me that failed, unfortunately I don’t have that error anymore, but commands to “nvidia-smi” fail now, and my “additional drivers” tab looks like this:

I have tried to revert the drivers back to a known state with sudo ubuntu-drivers autoinstall but get identical output as when I tried the cuda install.

Any ideas on how to proceed?

Instead of
sudo apt-get install cuda
try
sudo apt-get install cuda-toolkit

Hey, I was in the same state on 22.04 fresh install. I had nvidia-kernel-common-510 installed:

$ sudo apt list --installed | grep nvidia-kernel

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

nvidia-kernel-common-510/jammy,now 510.60.02-0ubuntu1 amd64 [installed,upgradable to: 510.73.05-0ubuntu0.22.04.1]
nvidia-kernel-source-510/jammy-updates,jammy-security,now 510.73.05-0ubuntu0.22.04.1 amd64 [installed,auto-removable]

I upgraded both nvidia-kernel-common and nvidia-kernel-source to 515:

sudo apt-get install nvidia-kernel-common-515
sudo apt-get install nvidia-kernel-source-515

sudo apt-get -y install cuda worked for me afterwards. Hope this works for someone as well.

3 Likes

Thank you. That worked for me as well.