安装NVIDIA驱动的一些新问题

 

 

又一次安装NVIDIA驱动程序,这一次,不向以前一二三四五.......次很顺的安装成功。这一次网上的所有方法都试了遍,都木有成功。

报错:

ERROR: Failed to run `/usr/sbin/dkms build -m nvidia -v 418.43 -k 4.15.0-50-generic`:
         Kernel preparation unnecessary for this kernel.  Skipping...

         Building module:
         cleaning build area....
         'make' -j4 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=4.15.0-50-generic IGNORE_CC_MISMATCH=''
         modules....(bad exit status: 2)
         ERROR (dkms apport): binary package for nvidia: 418.43 not found
         Error! Bad return status for module build on kernel: 4.15.0-50-generic (x86_64)
         Consult /var/lib/dkms/nvidia/418.43/build/make.log for more information.
ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try
         installing again without DKMS, or check the DKMS logs for more information.
ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.
         You may find suggestions on fixing installation problems in the README available on the Linux
         driver download page at www.nvidia.com.

按照提示打开  /var/lib/dkms/nvidia/418.43/build/make.log文档

文档中内容:

make[1]: Entering directory '/usr/src/linux-headers-4.15.0-50-generic'
arch/x86/Makefile:245: *** You are building kernel with non-retpoline compiler, please update your compiler..  Stop.
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-50-generic'
Makefile:79: recipe for target 'modules' failed
make: *** [modules] Error 2
输入:
uname -r #查看内核版本是4.15.0-50

然后卸载这个版本的内核

apt-get remove linux-image-4.15.0-50-generic

但是又出现了一个错误

E: Aborting removal of the running kernel
dpkg: error processing package linux-image-4.15.0-50-generic (--remove):
 subprocess installed pre-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-50-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

最后解决了半天,机子没法上网,没法进入图形化界面,最后暴力解决,重新装了系统。

思考了半天,发现一个问题,只要内核版本不是4.15.0-50-generic,就可以正常装驱动,也不会报各种奇怪的错误了。

所以,建议大家,少用sudo apt-get update和sudo apt-get upgrade两个命令。

参考:

http://www.mamicode.com/info-detail-2682975.html

https://www.cnblogs.com/luofeel/p/8654964.html

https://blog.csdn.net/qq_42030961/article/details/82740315

你可能感兴趣的:(环境安装)