Ubuntu – NVIDIA Driver Suddenly Failed (20.04 LTS)

20.04displaygraphicsnvidiaxorg

I dual booted my laptop into Ubuntu 20.04 LTS a few months ago. The Ubuntu installation by default installed NVIDIA driver for me, so I could seamlessly use NVIDIA driver and trained model with GPU.

Everything was fine until a few days ago I suddenly got the following error when executing 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.

Since then, I couldn't properly open my NVIDIA X Server GUI, as attached:
enter image description here

It also came with other annoying display issues, e.g:

  • the screen back lighting was still on even though the screen went black
  • the screen failed to resume when it was awaken from suspend mode
  • the screen brightness couldn't be adjusted

All these display issues didnt happen in the past when I installed Ubuntu 20.04.

When checked out Software & Update, I found out the driver strangely fell back to Nouveau display driver (as attached):
nvid

I couldn't switch back to NVIDIA driver listed above. Whenever I attempted to switch, I got the following error:

enter image description here

I was really frustrated by what was happening. I didn't do any software update so as to minimize the risk of messing up NVIDIA driver, but it still happened at the end…

At last resort, I will reinstall Ubuntu, but before that I would like to look for other alternatives. Really appreciated if you have possible solutions!

Error when installing nvidia-driver-450-server

sudo apt-get install nvidia-driver-450-server

Reading package lists... Done
Building dependency tree       
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 to resolve the situation:

The following packages have unmet dependencies:
 nvidia-driver-450-server : Depends: libnvidia-gl-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-compute-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-extra-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: nvidia-compute-utils-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-decode-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-encode-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: nvidia-utils-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: xserver-xorg-video-nvidia-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-cfg1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-ifr1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Depends: libnvidia-fbc1-450-server (= 450.51.06-0ubuntu0.20.04.2) but it is not going to be installed
                            Recommends: libnvidia-compute-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
                            Recommends: libnvidia-decode-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
                            Recommends: libnvidia-encode-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
                            Recommends: libnvidia-ifr1-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
                            Recommends: libnvidia-fbc1-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
                            Recommends: libnvidia-gl-450-server:i386 (= 450.51.06-0ubuntu0.20.04.2)
E: Unable to correct problems, you have held broken packages.

Specification
Laptop: Lenovo Legion Y740
OS: Ubuntu 20.04
Kernel: 5.4.0-48-generic
GPU: RTX 2070 Max-Q

Best Answer

  • As a temporary solution, try to boot the previous kernel version if everything was okay previously. In my case, the working kernel was 5.4.0-47 (*-48 was broken). Hopefully, it is some temporary issue with package dependencies which will be resolved soon.

    Update: I have fixed the issue with the new kernel version (5.4.0-48) by aptitude install nvidia-driver-450. There was a lot of warnings about some conflicts and removing of nvidia-*-440 packages, but finally the new version installed and the new kernel boots with nvidia drivers and everything looks good so far.