无法为 ubuntu 16.04 安装 Nvidia drivers390.48

无法为 ubuntu 16.04 安装 Nvidia drivers390.48

我正在 tty 上安装 nvidia 驱动程序版本=390.48。
我在安装前关闭了 lightdm 并将 nouveau 列入黑名单。
安装 DKMS 内核模块时出现错误

错误:无法运行/usr/sbin/dkms build -m nvidia -v 390.48 -k 4.13.16-041316-generic

安装失败,我无法以 GUI 模式登录我的 ubuntu。Ubuntu=16.04,Linux kernel=4.13.16 我的 /var/log/nvidia-installer.log 列在下面。

nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Thu May  3 11:17:06 2018
installer version: 390.48

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

nvidia-installer command line:
    ./nvidia-installer

Unable to load: nvidia-installer ncurses v6 user interface

Using: nvidia-installer ncurses user interface
-> Detected 8 CPUs online; setting concurrency level to 8.
-> Installing NVIDIA driver version 390.48.
-> There appears to already be a driver installed on your system (version: 390.48).  As part of installing this driver (version: 390.48), the existing driver will be uninstalled.  Are you sure you want to continue? (Answer: Continue installation)
-> Running distribution scripts
   executing: '/usr/lib/nvidia/pre-install'...
-> done.
-> The distribution-provided pre-install script failed!  Are you sure you want to continue? (Answer: Continue installation)
-> Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later. (Answer: Yes)
-> Installing both new and classic TLS OpenGL libraries.
-> Installing both new and classic TLS 32bit OpenGL libraries.
-> Install NVIDIA's 32-bit compatibility libraries? (Answer: Yes)
-> Will install GLVND GLX client libraries.
-> Will install GLVND EGL client libraries.
-> Skipping GLX non-GLVND file: "libGL.so.390.48"
-> Skipping GLX non-GLVND file: "libGL.so.1"
-> Skipping GLX non-GLVND file: "libGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.390.48"
-> Skipping EGL non-GLVND file: "libEGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.1"
-> Skipping GLX non-GLVND file: "./32/libGL.so.390.48"
-> Skipping GLX non-GLVND file: "libGL.so.1"
-> Skipping GLX non-GLVND file: "libGL.so"
-> Skipping EGL non-GLVND file: "./32/libEGL.so.390.48"
-> Skipping EGL non-GLVND file: "libEGL.so"
-> Skipping EGL non-GLVND file: "libEGL.so.1"
-> Parsing log file:
-> done.
-> Validating previous installation:
-> done.
-> Uninstalling NVIDIA Accelerated Graphics Driver for Linux-x86_64 (1.0-39048 (390.48)):
-> DKMS module detected; removing...
-> done.
-> Uninstallation of existing driver: NVIDIA Accelerated Graphics Driver for Linux-x86_64 (390.48) is complete.
Looking for install checker script at ./libglvnd_install_checker/check-libglvnd-install.sh
   executing: '/bin/sh ./libglvnd_install_checker/check-libglvnd-install.sh'...
   Checking for libglvnd installation.
   Checking libGLdispatch...
   Can't load library libGLdispatch.so.0: libGLdispatch.so.0: cannot open shared object file: No such file or directory
Will install libglvnd libraries.
Will install libEGL vendor library config file to /usr/share/glvnd/egl_vendor.d
-> Searching for conflicting files:
-> done.
-> Installing 'NVIDIA Accelerated Graphics Driver for Linux-x86_64' (390.48):
   executing: '/sbin/ldconfig'...
-> done.
-> Driver file installation is complete.
-> Installing DKMS kernel module:
ERROR: Failed to run `/usr/sbin/dkms build -m nvidia -v 390.48 -k 4.13.16-041316-generic`: 
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
'make' -j8 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=4.13.16-041316-generic modules....(bad exit status: 2)
ERROR (dkms apport): binary package for nvidia: 390.48 not found
Error! Bad return status for module build on kernel: 4.13.16-041316-generic (x86_64)
Consult /var/lib/dkms/nvidia/390.48/build/make.log for more information.
-> error.
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.

答案1

我强烈建议您尝试安装最新的 NVIDIA 驱动程序版本。

为此,您可以在终端中使用以下命令添加图形驱动程序 PPA:

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt-get update

此后,您现在应该通过在终端中输入以下内容来删除所有当前的 NVIDIA 驱动程序:

sudo apt-get purge nvidia*

现在您已经完成此操作,可以安全地安装最新版本:

sudo apt-get install nvidia-driver-396

请注意,在 Ubuntu 18.04 上它是 nvidia-driver-396,在 Ubuntu 16.04 上它是 nvidia-396,但您没有使用 16.04。

相关内容