在centos上安装cuda时,从官网上下载.run文件,然后运行,但是安装失败,如下图所示。
打开日志文件后,内容如下
[INFO]: Driver not installed.
[INFO]: Checking compiler version...
[INFO]: gcc location: /usr/bin/gcc
[INFO]: gcc version: gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
[INFO]: Initializing menu
[INFO]: nvidia-fs.setKOVersion(2.12.8)
[INFO]: Setup complete
[INFO]: Components to install:
[INFO]: Driver
[INFO]: 515.65.01
[INFO]: Executing NVIDIA-Linux-x86_64-515.65.01.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd 2>&1
[INFO]: Finished with code: 256
[ERROR]: Install of driver component failed. Consult the driver log at /var/log/nvidia-installer.log for more details.
[ERROR]: Install of 515.65.01 failed, quitting
从上面的信息可以看出,是安装显卡驱动时失败,打开日志,如下图所示。
nvidia-installer log file '/var/log/nvidia-installer.log'
creation time: Mon Sep 9 20:48:07 2024
installer version: 515.65.01
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
nvidia-installer command line:
./nvidia-installer
--ui=none
--no-questions
--accept-license
--disable-nouveau
--no-cc-version-check
--install-libglvnd
Using built-in stream user interface
-> Detected 40 CPUs online; setting concurrency level to 32.
-> Tagging shared libraries with chcon -t textrel_shlib_t.
-> The file '/tmp/.X0-lock' exists and appears to contain the process ID '1833' of a running X server.
ERROR: You appear to be running an X server; please exit X before installing. For further details, please see the section INSTALLING THE NVIDIA DRIVER in the README available on the Linux driver download page at www.nvidia.com.
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.
报错的原因是启动了图形界面 Xserver.
解决方法:
输入init 3关闭图像界面
按照提示安装cuda
输入init 5开启图像界面