7

My Ubuntu 22.04 updated this morning (after I use a standard script using the apt command and some other stuffs to clean my home directory) and the Nvidia driver does not work anymore.

I have noticed that the kernel was updated too: 6.0.0-1007-oem and my only explanation is that it comes with something incompatible with the Nvidia driver. I came back to kernel 5.15.0-56-generic and the Nvidia driver still does not work; something is broken in my distro.

The script I mention in the comments just use the apt command plus I clean some files in my home directory: nothing revolutionary.

EDIT: inxi -SG as requested:

gaucher@mars:~$ inxi -SG 
System:   Host: mars Kernel:5.15.0-56-generic x86_64 bits: 64 Desktop: GNOME 42.5
    Distro: Ubuntu 22.04.1 LTS (Jammy Jellyfish) Graphics:   Device-1: NVIDIA TU106 [GeForce RTX 2060 SUPER] driver: N/A   Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: nouveau,vesa
    unloaded: fbdev,modesetting gpu: N/A resolution: 1024x768~76Hz   OpenGL: renderer: llvmpipe (LLVM 13.0.1 256 bits) v: 4.5 Mesa 22.0.5

The script (the part using apt; it is not easy to post with the resolution of the screen):

sudo apt update; sudo apt upgrade ;sudo apt autoremove ;sudo apt clean
Artur Meinild
  • 26,018
Philippe Gaucher
  • 2,004
  • 2
  • 21
  • 33

10 Answers10

14

If you have problems reinstalling the correct graphics driver from the GUI, try installing it from the command line instead.

For Ubuntu 22.04, available Nvidia driver packages are listed here (be sure to have the "Restricted" repo enabled).

My default suggestion would be to start with the newest driver (at the time of posting it's nvidia-driver-525). To install this, run:

sudo apt install --reinstall nvidia-driver-525

In case of issues, reverting to the previous driver can sometimes help.

Artur Meinild
  • 26,018
  • I use this update script (which does not contain anything revolutionary) precisely because the standard way for updating from the GUI does not always update everything... – Philippe Gaucher Dec 03 '22 at 13:59
12

While the @artur-meinild's answer didn't work for me, I adapted the solution from this nvidia forum thread.

I run sudo apt install linux-headers-$(uname -r) to install missing kernel headers (Idk why they weren't installed).

Now nvidia-smi works just fine

Tooster
  • 467
  • that solved it for me with the 6.1.0-1015-oem kernel – wotter Jul 01 '23 at 21:25
  • 2
    After updating from 510 to 525 driver this was the issue. Reinstalling the 525 did not solve it. Apparently the header files were missing. Don't forget to reboot after installing the header files. Kernel: 5.19.0-1010-nvidia-lowlatency. – Vic Jul 04 '23 at 05:33
3

I ran into the same issue, what helped me was switching to onboard, then back to nvidia.

sudo prime-select intel
sudo prime-select nvidia
reboot
  • Thank you! After trying everything else suggested here (and more!), this did the trick for me. My SO got a bit broken after updating from 20.04 to 22.04 with live patch – Granjero Aug 30 '23 at 18:36
2

Even though I did not actively update any driver, in my case it was a borked driver install, just needed to run the following:

sudo apt --fix-broken install

after this you will need to either reboot or restart x.

sudo pkill x

You should be able to login normally and screen(s) should have corrected resolution if this fixed the issue.

Jay Court
  • 21
  • 2
1

In my case installing nvidia-dkms-(DriverVersion) solved the problem:

sudo apt install nvidia-dkms-525

Thanks to @Tooster for providing link:

https://forums.developer.nvidia.com/t/nvidia-driver-is-not-working-on-ubuntu-22-04/232243

1

The solution given by Hani Shams worked for me: There are no kernel modules installed. Please try installing the kernel headers

sudo apt install linux-headers-$(uname -r)

and then post the output of

dkms status

Reboot and good. Thanks to all who took the time to search and share.

1

For me, none of the answers posted here worked, I eventually found this archlinux post that suggested to remove and reinstall the dkms, so I did it with my version and it worked!

sudo dkms remove -m nvidia/535.113.01
sudo dkms install -m nvidia/535.113.01
  • Same for me! Non of the above worked until I tried your solution. Now I will attempt to install cuda. Wish me luck! – Zhubarb Nov 24 '23 at 16:19
1

There is some good answers in here but I will add another potential solution. This only applies when secure boot is enabled. My CMOS got corrupted and wiped out the enrollment of my MOK key. I needed to re-enroll it to allow the nvidia kernel module to load which fixed the nvidia drivers.

You can check if this is the issue by running:

sudo modprobe nvidia-drm

If it gives an error regarding the key and you have a MOK.der and MOK.priv in /var/lib/shim-signed/mok/ then try this:

sudo mokutil --test-key /var/lib/shim-signed/mok/MOK.der

It will ask for a password twice, note what you type here since you will need it later.

Reboot and a familiar screen will popup, complete the enrollment process with the password you supplied

0

Selecting nvidia as the graphics card as an important step in loading the driver and making it work. It is missed often and is the reason for the driver not getting loaded. So please try this as an initial step. The command to select nvidia is : sudo prime-select nvidia

-1

Yeah so if you're using the open version of the drivers I would recommend using the non open version. Docs detail the open version not having as much as the non open version.