Qual é a maneira recomendada de instalar drivers NVidia com um kernel atualizado no Ubuntu 20.04? A instalação via apt não funciona. Recebo o seguinte erro no final da instalação
# sudo apt install nvidia-driver-495 -y
...
...
Building for 5.15.1-051501-generic
Building for architecture x86_64
Building initial module for 5.15.1-051501-generic
ERROR (dkms apport): kernel package linux-headers-5.15.1-051501-generic is not supported
Error! Bad return status for module build on kernel: 5.15.1-051501-generic (x86_64)
Consult /var/lib/dkms/nvidia/495.44/build/make.log for more information.
dpkg: error processing package nvidia-dkms-495 (--configure):
installed nvidia-dkms-495 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-495:
nvidia-driver-495 depends on nvidia-dkms-495 (<= 495.44-1); however:
Package nvidia-dkms-495 is not configured yet.
nvidia-driver-495 depends on nvidia-dkms-495 (>= 495.44); however:
Package nvidia-dkms-495 is not configured yet.
dpkg: error processing package nvidia-driver-495 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
...
Aqui estão algumas informações sobre meu hardware (o laptop é um Lenovo P15S Gen1 AFAIK)
# uname -r
5.15.1-051501-generic
# lspci | grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics (rev 02)
2d:00.0 3D controller: NVIDIA Corporation GP108GLM [Quadro P520] (rev a1)
# lscpu | grep -i model
Model name: Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Model: 142
Atualmente estou rodando com a GPU Intel, o que é bom, mas eu realmente adoraria não carregar constantemente uma GPU NVidia dedicada sem usá-la.
Olhando para /var/lib/dkms/nvidia/495.44/build/make.log
eu tenho isso no final do arquivo
/var/lib/dkms/nvidia/495.44/build/nvidia/nv-dma.c:976: warning: "IMPORT_SGT_STUBS_NEEDED" redefined
976 | #define IMPORT_SGT_STUBS_NEEDED 0
|
/var/lib/dkms/nvidia/495.44/build/nvidia/nv-dma.c:970: note: this is the location of the previous definition
970 | #define IMPORT_SGT_STUBS_NEEDED 1
|
/var/lib/dkms/nvidia/495.44/build/nvidia/nv-mmap.c: In function ‘nv_encode_caching’:
/var/lib/dkms/nvidia/495.44/build/nvidia/nv-mmap.c:334:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
334 | if (NV_ALLOW_CACHING(memory_type))
| ^
/var/lib/dkms/nvidia/495.44/build/nvidia/nv-mmap.c:337:9: note: here
337 | default:
| ^~~~~~~
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-cray.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-cray.o'
make[2]: *** Waiting for unfinished jobs....
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-i2c.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-i2c.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-p2p.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-p2p.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-mmap.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-mmap.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-pci.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-pci.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-dma.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-dma.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv-acpi.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv-acpi.o'
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by scripts/basic/fixdep)
scripts/basic/fixdep: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by scripts/basic/fixdep)
make[2]: *** [scripts/Makefile.build:277: /var/lib/dkms/nvidia/495.44/build/nvidia/nv.o] Error 1
make[2]: *** Deleting file '/var/lib/dkms/nvidia/495.44/build/nvidia/nv.o'
make[1]: *** [Makefile:1874: /var/lib/dkms/nvidia/495.44/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.1-051501-generic'
make: *** [Makefile:80: modules] Error 2
Eu tive o mesmo problema com drivers mais antigos. Parece que o kernel da linha principal exige que o glibc seja pelo menos v2.33, que só está disponível no Ubuntu 21.04 a partir de agora.
Responder1
Aqui está a solução. Como podemos ver na minha postagem, o arquivo make.log diz que glibc >= 2.33 é necessário, mas o Ubuntu 20.04 usa glibc 2.31 ( ldconfig --version
).
Por causa deNmathcomentar e depois de dormir uma noite pensando nisso, verifiquei minha estação de trabalho, que também está rodando Ubuntu 20.04 com GPU 1080 Ti, cujo kernel está funcionando com o driver Nvidia. No meu caso, a partir de agora, é a versão do kernel 5.11.0-40-generic
. Depois de inicializar este kernel, removi todos os kernels mais recentes que instalei através do aplicativo principal. Após a próxima reinicialização, instalei o driver NVidia mais recente por meio de sudo apt install nvidia-driver-495
comando. A instalação do driver funcionou desta vez sem problemas porque o kernel original foi compilado usando glibc 2.31.
Depois disso, tive uma tela preta após a inicialização. Mudei para um terminal via Ctrl+ Alt+ F2. Uma vez no terminal, fiz backup do meu arquivo xorg.conf sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
e verifiquei se os drivers da nvidia não estavam na lista negra em /etc/modprobe.d/
e /lib/modprobe.d/
. E finalmente mudei sudo prime-select intel
para o driver Intel e sudo prime-select nvidia
voltei para o driver Nvidia. Depois de outra reinicialização, funcionou.
Responder2
Embora a instalação através do repositório apt falhe, é possível instalar através da página oficial do driver