I run Ubuntu 20.04 and after the last reboot I had trouble with my graphics driver - the system is in low res, only one monitor is working.
Debug Output
$ sudo lshw -C display
*-display UNCLAIMED
description: VGA compatible controller
product: TU104 [GeForce RTX 2070 SUPER]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:31:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller cap_list
configuration: latency=0
resources: memory:f5000000-f5ffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:f000(size=128) memory:f6000000-f607ffff
$ sudo dkms status
nvidia, 510.47.03: added
That status seems a bit exotic, at least I did not find many similar cases while googling.
$ 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.
$ modinfo nvidia
modinfo: ERROR: Module nvidia not found.
In the system info I see "llvmpipe (LLVM 12.0.0, 256 bits)" as my graphics.
What I Tried
I have tried multiple ways of installing Nvidia drivers, I used apt sudo apt autoremove --purge nvidia* && sudo apt install nvidia-driver-510
, "Additional Drivers" UI and ubuntu-drivers
, I tried the currently latest version 510 and the older one that worked before - 470. I also tried selecting nvidia sudo prime-select nvidia
as well as selecting intel and swithcing back to nvidia - same result.
Background
I used Nvidia driver 470 and Kernel 5.13.0.26, then after reboot I got Kernel .27 and no wifi, I had that problem recently due to Nvidia driver (needed to install linux-modules-extra for the new Kernel) so I decided to upgrade drivers hoping everything will be resolved. That lead to the current situation: installing linux-modules-extra-5.13.0-27-generic
and then after switch to 510 - same for .28 fixed wifi issue, but the video driver is broken. While using 5.13.0.27 I was able to boot 5.13.0.26 and there I had working video, now it's not the case cause .27 is the oldest of recent Kernels in the Grub menu.
I feel like I am missing some step that would fix that, would appreciate any help.
UPD
sudo dkms install -m nvidia -v 510.47.03 -k 5.13.0-28-generic --force
Error! Your kernel headers for kernel 5.13.0-28-generic cannot be found.
Please install the linux-headers-5.13.0-28-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
$ sudo dkms build -m nvidia -v 510.47.03
Error! Your kernel headers for kernel 5.13.0-28-generic cannot be found.
Please install the linux-headers-5.13.0-28-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
So it seems dkms is somehow unaware of my kernel. I used above error message's recommendation and installed the headers sudo apt install linux-headers-5.13.0-28-generic
, after that the output looks better:
sudo dkms build -m nvidia -v 510.47.03
Module nvidia/510.47.03 already built for kernel 5.13.0-28-generic/4
sudo dkms status
nvidia, 510.47.03, 5.13.0-28-generic, x86_64: installed
I'll try rebooting now and then install the driver as per recommendation in comments.
UPD2
That's it, everything seems to work now. There is no need to do anything about the drivers, it seems the problem was with missing headers.