又一次安裝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