(Solved) Need help for NVIDIA driver on Ubuntu 20.04 because of linux-headers auto-update

---- Update —

It is solved after @ubfan1’s suggestion in the comment area at askubuntu.com. ( Sorry, I do not know if it is suitable to simultaneously post this here and askubuntu. ) Thanks to @ubfan1 and everyone!

The detailed steps are:

1, Enter BIOS, and set the integrated display as the primary.

2, Enter grab, and choose the old kernel to boot. Then all is OK.

Optional steps:

3, Following this post to set a default kernel, I can set the old kernel as default to avoid choosing it at every system booting.

4, Follow this post to disable Ubuntu automated update. But I have not verified its effect.

---- End of Update —

---- TLDR ----

My Nvidia GPU driver does not work after a Ubuntu auto-update of linux-headers.

If I follow the steps in this post with similar issue, can I solve my problem? Or do you have a better suggestion?

I set the GPU as my primary display in BOIS before and now I cannot see the BIOS nor the grub menu to select former kernel in grub. (Update: I am wrong. I tried again that I do can enter the BIOS.)

I have an experience that I have to reinstall the OS if I did something wrong with the nvidia-driver as I am not a deep user of Linux and Ubuntu, so I have to be careful.

---- End of TLDR ----

Hi, there. I am not a deep user of Linux or Ubuntu, and maybe I can only use things such as “apt install”. I got an RTX 2060 12G and installed it into my Asus P8Z77-V LX2 with Ubuntu 20.04.4 LTS last month (March 2022). After the physical installation, I installed nvidia-driver-510 via “Software & Updates > Additional Drivers”; and cuda-tools-11-0 via adding cuda-repo from Nvidia’s official website and “apt-get install”, and all of them work fine. I use this video card for learning machine learning. It is normal for this month and I even used it for CUDA computation the other days, but I find it does not work yesterday (Apr 19th, 2022), even after several reboots. As below:

(base) asuspei@asus-pc:~$ 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.

I googled some, this post with similar issue may be a similar condition to mine. As my rough understanding of this post, the issue is that the updated kernel or the updated linux-headers causes the Nvidia driver not to work, and the user has to reinstall the driver. I do not know how to check if my kernel is auto-updated recently exactly, but I searched the dpkg.log files as the list at the tail of this post based on the keyword “linux-headers” and it seems that it was auto-updated on Apr 16th, 2022, just a few days earlier (maybe you need manually scroll at that list because the list is long). And indeed that the video card is normal before it and does not work after it.

If I follow the steps in this post with similar issue, can I solve my problem? Or do you have a better suggestion? I have an experience that I have to reinstall the OS if I did something wrong with the nvidia-driver as I am not a deep user of Linux and Ubuntu, so I have to be careful.

And some other opinions are to choose the old kernel under the grub menu. But I set the GPU as my primary display in BOIS before and now I cannot see the BIOS nor the grub menu. (Update: I am wrong. I tried again that I do can enter the BIOS.)

Could you help me? Thank you very much!

---- System Info Related ----

(base) asuspei@asus-pc:~$ uname -a
Linux asus-pc 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
(base) asuspei@asus-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'linux-headers'
linux-headers-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-headers-5.13.0-39-generic/focal-updates,focal-security,now 5.13.0-39.44~20.04.1 amd64 [installed,automatic]
linux-headers-generic-hwe-20.04/focal-updates,focal-security,now 5.13.0.39.44~20.04.24 amd64 [installed,automatic]
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'nvidia'
libnvidia-cfg1-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-common-510/focal-updates,focal-updates,focal-security,focal-security,now 510.54-0ubuntu0.20.04.1 all [installed,automatic]
libnvidia-compute-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-compute-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-decode-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-decode-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-encode-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-encode-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-extra-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-fbc1-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-fbc1-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-gl-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
libnvidia-gl-510/now 510.47.03-0ubuntu0.20.04.1 i386 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
linux-modules-nvidia-510-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-modules-nvidia-510-generic-hwe-20.04/now 5.13.0-35.40~20.04.1 amd64 [installed,upgradable to: 5.13.0-39.44~20.04.1]
linux-objects-nvidia-510-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
linux-signatures-nvidia-5.13.0-35-generic/focal-updates,focal-security,now 5.13.0-35.40~20.04.1 amd64 [installed,automatic]
nvidia-compute-utils-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-driver-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-kernel-common-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-kernel-source-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
nvidia-prime/now 0.8.16~0.20.04.1 all [installed,upgradable to: 0.8.16~0.20.04.2]
nvidia-settings/focal-updates,now 470.57.01-0ubuntu0.20.04.3 amd64 [installed,automatic]
nvidia-utils-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
xserver-xorg-video-nvidia-510/now 510.47.03-0ubuntu0.20.04.1 amd64 [installed,upgradable to: 510.54-0ubuntu0.20.04.1]
(base) asuspei@asus-pc:~$ apt list --installed | grep -i -e 'cuda'
cuda-command-line-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-compiler-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-cudart-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cudart-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cuobjdump-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cupti-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-cupti-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-documentation-11-0/unknown,now 11.0.228-1 amd64 [installed,automatic]
cuda-driver-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-gdb-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-libraries-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-libraries-dev-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-memcheck-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nsight-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nsight-compute-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-nsight-systems-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-nvcc-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvdisasm-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvml-dev-11-0/unknown,now 11.0.167-1 amd64 [installed,automatic]
cuda-nvprof-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvprune-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvrtc-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvrtc-dev-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-nvtx-11-0/unknown,now 11.0.167-1 amd64 [installed,automatic]
cuda-nvvp-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-repo-ubuntu2004-11-0-local/now 11.0.3-450.51.06-1 amd64 [installed,local]
cuda-samples-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-sanitizer-11-0/unknown,now 11.0.221-1 amd64 [installed,automatic]
cuda-toolkit-11-0/unknown,now 11.0.3-1 amd64 [installed]
cuda-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
cuda-visual-tools-11-0/unknown,now 11.0.3-1 amd64 [installed,automatic]
(base) asuspei@asus-pc:~$ grep -i -e 'linux-headers' /var/log/dpkg.log*
/var/log/dpkg.log.1:2022-02-23 08:49:56 install linux-headers-5.13.0-30-generic:amd64 <none> 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:56 status half-installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:57 status unpacked linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:49:57 install linux-headers-generic-hwe-20.04:amd64 <none> 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:49:57 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:49:57 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:21 configure linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1 <none>
/var/log/dpkg.log.1:2022-02-23 08:50:21 status unpacked linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:21 status half-configured linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:21 status installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log.1:2022-02-23 08:50:23 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17 <none>
/var/log/dpkg.log.1:2022-02-23 08:50:23 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:23 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-02-23 08:50:23 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:39 install linux-headers-5.13.0-35-generic:amd64 <none> 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:39 status half-installed linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:41 status unpacked linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:41 upgrade linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:41 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:41 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:41 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.30.33~20.04.17
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 configure linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1 <none>
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 status half-configured linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 status installed linux-headers-5.13.0-35-generic:amd64 5.13.0-35.40~20.04.1
/var/log/dpkg.log.1:2022-03-11 10:30:42 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20 <none>
/var/log/dpkg.log.1:2022-03-11 10:30:42 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log.1:2022-03-11 10:30:42 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:30 install linux-headers-5.13.0-39-generic:amd64 <none> 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:30 status half-installed linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:32 status unpacked linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:32 upgrade linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:32 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:32 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:32 status half-installed linux-headers-generic-hwe-20.04:amd64 5.13.0.35.40~20.04.20
/var/log/dpkg.log:2022-04-15 09:34:34 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:35 configure linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1 <none>
/var/log/dpkg.log:2022-04-15 09:34:35 status unpacked linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:35 status half-configured linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:53 status installed linux-headers-5.13.0-39-generic:amd64 5.13.0-39.44~20.04.1
/var/log/dpkg.log:2022-04-15 09:34:53 configure linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24 <none>
/var/log/dpkg.log:2022-04-15 09:34:53 status unpacked linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:54 status half-configured linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-15 09:34:54 status installed linux-headers-generic-hwe-20.04:amd64 5.13.0.39.44~20.04.24
/var/log/dpkg.log:2022-04-16 19:18:45 status installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:45 remove linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1 <none>
/var/log/dpkg.log:2022-04-16 19:18:45 status half-configured linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:45 status half-installed linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:46 status config-files linux-headers-5.13.0-30-generic:amd64 5.13.0-30.33~20.04.1
/var/log/dpkg.log:2022-04-16 19:18:46 status not-installed linux-headers-5.13.0-30-generic:amd64 <none>