NVIDIA driver 470 does not load correctly on Ubuntu 20.04

Hi !

I have an XPS15 9500 on Ubuntu with the 5.12.XX version of the Linux kernel. I have Installed the nvidia-driver-470 with the Software&Update GUI but after rebooting I have this error :

$ 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.

and this error too :

❯ nvidia-settings                                                                                                                                                                                                                         

ERROR: NVIDIA driver is not loaded


ERROR: Unable to load info from any available system

This is my report log file.

nvidia-bug-report.log.gz (126.4 KB)

Thanks for your help !

There is no sign of the driver loading, nor the driver being installed.
Please check if it’s even installed correctly (i.e. apt search nvidia-driver).
Maybe try to re-install.
sudo prime-select nvidia - if it says already selected, switch to intel and then back to nvidia again. Reboot and check if the driver loads (look at lsmod, dmesg). Otherwise send a new bug-report please.

Thanks for your response @Mart !

I have already tried to reinstall several times.

I have check that the driver is installed :

❯ apt list --installed | grep nvidia                                                                                                                                                                                                       ─╯

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

libnvidia-cfg1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-common-470/focal,focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev all [installed,automatic]
libnvidia-compute-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-compute-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-decode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-decode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-encode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-encode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-extra-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-fbc1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-fbc1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-gl-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-gl-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-ifr1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-ifr1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
nvidia-compute-utils-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-dkms-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-driver-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed]
nvidia-kernel-common-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-kernel-source-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-prime/focal-updates,focal-updates,now 0.8.16~0.20.04.1 all [installed]
nvidia-settings/focal-updates,focal-security,focal,now 470.57.01-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-utils-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
xserver-xorg-video-nvidia-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]

I have made the switch with prime-select.

After rebooting I still have the same error on nvidia-smi and nvidia-settings

Here are the outputs of the command you asked :

❯ lsmod | grep nvidia                                                                                                                                                                                                                     

❯ sudo dmesg | grep nvidia                                                                                                                                                                                                                 ─╯
[    4.662362] audit: type=1400 audit(1632085082.662:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=1205 comm="apparmor_parser"
[    4.662366] audit: type=1400 audit(1632085082.662:9): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=1205 comm="apparmor_parser"

nvidia-bug-report.log.gz (126.5 KB)

Is this PopOS?

Please check for udev rules:
grep -r -i 10de /lib/udev/rules.d/
Maybe something is removing the device.
Also check the Xorg loading paths (man Xorg - Files section) for anything that could blacklist the nvidia driver (nvidiafb should be blacklisted).

Also you could try to use the graphics PPA:

Uninstall from Software & Updates and then add the PPA, and install from there.

Is this PopOS?

No I am using Ubuntu without customization.

grep -r -i 10de /lib/udev/rules.d/

❯ grep -r -i 10de /lib/udev/rules.d/                                         ─╯
/lib/udev/rules.d/71-nvidia.rules:SUBSYSTEM=="pci", ATTRS{vendor}=="0x10de", DRIVERS=="nvidia", TAG+="seat", TAG+="master-of-seat"
/lib/udev/rules.d/71-nvidia.rules:#ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", TEST=="power/control", ATTR{power/control}="auto"
/lib/udev/rules.d/71-nvidia.rules:ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", TEST=="power/control", ATTR{power/control}="auto"
/lib/udev/rules.d/71-nvidia.rules:ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", TEST=="power/control", ATTR{power/control}="auto"
/lib/udev/rules.d/71-nvidia.rules:ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", TEST=="power/control", ATTR{power/control}="auto"

I have checked the existence of every Xorg file but I have non of them.

After adding the graphics PPA, it is the same package that has been installed:

❯ apt list --installed | grep nvidia                                                                                                                                                                                                       

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

libnvidia-cfg1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-common-470/focal,focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev all [installed,automatic]
libnvidia-compute-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-compute-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-decode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-decode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-encode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-encode-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-extra-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-fbc1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-fbc1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-gl-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-gl-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
libnvidia-ifr1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
libnvidia-ifr1-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev i386 [installed,automatic]
nvidia-compute-utils-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-dkms-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-driver-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed]
nvidia-kernel-common-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-kernel-source-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
nvidia-prime/focal-updates,focal-updates,now 0.8.16~0.20.04.1 all [installed]
nvidia-settings/focal-updates,focal-security,now 470.57.01-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-utils-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]
xserver-xorg-video-nvidia-470/focal,now 470.63.01-1pop0~1631198057~20.04~5c55171~dev amd64 [installed,automatic]

I’m wondering about that pop0 in the package names. Did you purge the drivers before adding the PPA? Please check if there is any PPA which is not ubuntu.

Your are right I had a ppa with package from popOS.

after disabling it I installed the right package :

❯ apt list --installed | grep nvidia

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

libnvidia-cfg1-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-common-470/focal-updates,focal-updates,focal-security,focal-security,now 470.63.01-0ubuntu0.20.04.2 all [installed,automatic]
libnvidia-compute-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-compute-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-decode-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-decode-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-encode-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-encode-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-extra-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-fbc1-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-gl-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
libnvidia-gl-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 i386 [installed,automatic]
libnvidia-ifr1-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-compute-utils-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-dkms-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-driver-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed]
nvidia-kernel-common-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-kernel-source-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
nvidia-prime/focal-updates,focal-updates,now 0.8.16~0.20.04.1 all [installed]
nvidia-settings/focal-updates,focal-security,focal,now 470.57.01-0ubuntu0.20.04.1 amd64 [installed,automatic]
nvidia-utils-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]
xserver-xorg-video-nvidia-470/focal-updates,focal-security,now 470.63.01-0ubuntu0.20.04.2 amd64 [installed,automatic]

but I still have :

❯ 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.

Here is my report logfile :
nvidia-bug-report.log.gz (146.2 KB)

There still is no sign of the installer in the log.
Please check for the dkms make log in:
/var/lib/dkms/nvidia/DRIVER_VERSION/KERNEL_VERSION/x86_64/log/
Look if it’s there and peak into it, if the kernel module was compiled successfully.

Also /usr/bin/lspci -nn only shows:

01:00.0 3D controller [0302]: NVIDIA Corporation Device [10de:1f95] (rev a1)

which should print VGA controller.
Do you have a BIOS setting to switch to / enable the discrete GPU? Please check.

If unsure with the make log. Purge the nvidia drivers (again) sudo apt purge nvidia* libnvidia* and re-install them from the terminal sudo apt install nvidia-driver-470. That way you can see in the terminal if the module building runs into an error.

1 Like

There is no trace of /var/lib/dkms/nvidia/DRIVER_VERSION/KERNEL_VERSION/x86_64/log/

❯ pwd
/var/lib/dkms/nvidia/470.63.01

❯ ls
build  source

When I am trying to reinstall the driver, I have found that the kernel does not rebuild :

Module build for kernel 5.12.12-051212-generic was skipped since the
kernel headers for this kernel does not seem to be installed.
❯ sudo apt install nvidia-driver-470                                         ─╯
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnvidia-cfg1-470 libnvidia-common-470 libnvidia-compute-470
  libnvidia-decode-470 libnvidia-encode-470 libnvidia-extra-470
  libnvidia-fbc1-470 libnvidia-gl-470 libnvidia-gl-470:i386 libnvidia-ifr1-470
  nvidia-compute-utils-470 nvidia-dkms-470 nvidia-kernel-common-470
  nvidia-kernel-source-470 nvidia-prime nvidia-settings nvidia-utils-470
  xserver-xorg-video-nvidia-470
Recommended packages:
  libnvidia-ifr1-470:i386 libnvidia-fbc1-470:i386
The following NEW packages will be installed:
  libnvidia-cfg1-470 libnvidia-common-470 libnvidia-compute-470
  libnvidia-decode-470 libnvidia-encode-470 libnvidia-extra-470
  libnvidia-fbc1-470 libnvidia-gl-470 libnvidia-gl-470:i386 libnvidia-ifr1-470
  nvidia-compute-utils-470 nvidia-dkms-470 nvidia-driver-470
  nvidia-kernel-common-470 nvidia-kernel-source-470 nvidia-prime
  nvidia-settings nvidia-utils-470 xserver-xorg-video-nvidia-470
0 upgraded, 19 newly installed, 0 to remove and 6 not upgraded.
Need to get 9 392 B/243 MB of archives.
After this operation, 672 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://fr.archive.ubuntu.com/ubuntu focal-updates/main amd64 nvidia-prime all 0.8.16~0.20.04.1 [9 392 B]
Fetched 9 392 B in 0s (166 kB/s)            
Selecting previously unselected package libnvidia-cfg1-470:amd64.
(Reading database ... 804199 files and directories currently installed.)
Preparing to unpack .../00-libnvidia-cfg1-470_470.63.01-0ubuntu0.20.04.2_amd64.d
eb ...
Unpacking libnvidia-cfg1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-common-470.
Preparing to unpack .../01-libnvidia-common-470_470.63.01-0ubuntu0.20.04.2_all.d
eb ...
Unpacking libnvidia-common-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-compute-470:amd64.
Preparing to unpack .../02-libnvidia-compute-470_470.63.01-0ubuntu0.20.04.2_amd6
4.deb ...
Unpacking libnvidia-compute-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-decode-470:amd64.
Preparing to unpack .../03-libnvidia-decode-470_470.63.01-0ubuntu0.20.04.2_amd64
.deb ...
Unpacking libnvidia-decode-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-encode-470:amd64.
Preparing to unpack .../04-libnvidia-encode-470_470.63.01-0ubuntu0.20.04.2_amd64
.deb ...
Unpacking libnvidia-encode-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-extra-470:amd64.
Preparing to unpack .../05-libnvidia-extra-470_470.63.01-0ubuntu0.20.04.2_amd64.
deb ...
Unpacking libnvidia-extra-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-fbc1-470:amd64.
Preparing to unpack .../06-libnvidia-fbc1-470_470.63.01-0ubuntu0.20.04.2_amd64.d
eb ...
Unpacking libnvidia-fbc1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-gl-470:i386.
Preparing to unpack .../07-libnvidia-gl-470_470.63.01-0ubuntu0.20.04.2_i386.deb 
...
Unpacking libnvidia-gl-470:i386 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-gl-470:amd64.
Preparing to unpack .../08-libnvidia-gl-470_470.63.01-0ubuntu0.20.04.2_amd64.deb
 ...
Unpacking libnvidia-gl-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package libnvidia-ifr1-470:amd64.
Preparing to unpack .../09-libnvidia-ifr1-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking libnvidia-ifr1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-compute-utils-470.
Preparing to unpack .../10-nvidia-compute-utils-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-compute-utils-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-kernel-source-470.
Preparing to unpack .../11-nvidia-kernel-source-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-kernel-source-470 (470.63.01-0ubuntu0.20.04.2) ..................................................] 
Selecting previously unselected package nvidia-kernel-common-470.
Preparing to unpack .../12-nvidia-kernel-common-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-kernel-common-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-dkms-470.
Preparing to unpack .../13-nvidia-dkms-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-dkms-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-utils-470.
Preparing to unpack .../14-nvidia-utils-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-utils-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package xserver-xorg-video-nvidia-470.
Preparing to unpack .../15-xserver-xorg-video-nvidia-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking xserver-xorg-video-nvidia-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-driver-470.
Preparing to unpack .../16-nvidia-driver-470_470.63.01-0ubuntu0.20.04.2_amd64.deb ...
Unpacking nvidia-driver-470 (470.63.01-0ubuntu0.20.04.2) ...
Selecting previously unselected package nvidia-prime.
Preparing to unpack .../17-nvidia-prime_0.8.16~0.20.04.1_all.deb ...
Unpacking nvidia-prime (0.8.16~0.20.04.1) ...
Selecting previously unselected package nvidia-settings.
Preparing to unpack .../18-nvidia-settings_470.57.01-0ubuntu0.20.04.1_amd64.deb ...
Unpacking nvidia-settings (470.57.01-0ubuntu0.20.04.1) ...
Setting up nvidia-kernel-source-470 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-prime (0.8.16~0.20.04.1) ...
Setting up libnvidia-compute-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up libnvidia-extra-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-utils-470 (470.63.01-0ubuntu0.20.04.2) ...
Setting up libnvidia-fbc1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-compute-utils-470 (470.63.01-0ubuntu0.20.04.2) ...
Warning: The home dir /nonexistent you specified can't be accessed: No such file or directory
Adding system user `nvidia-persistenced' (UID 130) ...
Adding new group `nvidia-persistenced' (GID 137) ...
Adding new user `nvidia-persistenced' (UID 130) with group `nvidia-persistenced' ...
Not creating home directory `/nonexistent'.
Setting up libnvidia-cfg1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up libnvidia-common-470 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-kernel-common-470 (470.63.01-0ubuntu0.20.04.2) ...
update-initramfs: deferring update (trigger activated)
Created symlink /etc/systemd/system/systemd-hibernate.service.requires/nvidia-hibernate.service → /lib/systemd/system/
nvidia-hibernate.service.
Created symlink /etc/systemd/system/systemd-suspend.service.requires/nvidia-resume.service → /lib/systemd/system/nvidi
a-resume.service.
Created symlink /etc/systemd/system/systemd-hibernate.service.requires/nvidia-resume.service → /lib/systemd/system/nvi
dia-resume.service.
Created symlink /etc/systemd/system/systemd-suspend.service.requires/nvidia-suspend.service → /lib/systemd/system/nvid
ia-suspend.service.
Setting up libnvidia-gl-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up libnvidia-gl-470:i386 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-settings (470.57.01-0ubuntu0.20.04.1) ...
Setting up libnvidia-decode-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up xserver-xorg-video-nvidia-470 (470.63.01-0ubuntu0.20.04.2) ...
Setting up libnvidia-ifr1-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-dkms-470 (470.63.01-0ubuntu0.20.04.2) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Loading new nvidia-470.63.01 DKMS files...
Building for 5.12.12-051212-generic
Building for architecture x86_64
Module build for kernel 5.12.12-051212-generic was skipped since the
kernel headers for this kernel does not seem to be installed.
Setting up libnvidia-encode-470:amd64 (470.63.01-0ubuntu0.20.04.2) ...
Setting up nvidia-driver-470 (470.63.01-0ubuntu0.20.04.2) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.12.12-051212-generic

@Mart Thanks for your help !

I succeeded to install the driver.

My problem was that the build of the driver into the kernel was skipped because I didn’t have the kernel headers due to a known issue on ubuntu 20.04. I have followed the instruction in this post to install a version of linux kernel. After that I reinstalled the driver and it worked !

This solution worked for me. I was purging only nvidia but was skipping the libnvidia and that was causing the problem to install driver-470.