解决系统Nouveau kernel driver与nvidia-driver冲突
- 报错信息
Cmd:
sudo sh cuda_10.1.243_418.87.00_linux.run
Log:
/var/log/cuda-installer.log
1 [INFO]: Driver not installed.
2 [INFO]: Checking compiler version…
3 [INFO]: gcc location: /bin/gcc
5 [INFO]: gcc version: gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
7 [INFO]: Initializing menu
8 [INFO]: Setup complete
9 [INFO]: Components to install:
10 [INFO]: Driver
11 [INFO]: 418.87.00
12 [INFO]: Executing NVIDIA-Linux-x86_64-418.87.00.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd 2>&1
13 [INFO]: Finished with code: 256
14 [ERROR]: Install of driver component failed.
15 [ERROR]: Install of 418.87.00 failed, quitting
~ > lspci | grep nvidia -i
01:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1080] (rev a1)
01:00.1 Audio device: NVIDIA Corporation GP104 High Definition Audio Controller (rev a1)
~ > uname -msr
Linux 3.10.0-957.el7.x86_64 x86_64
-
报错原因:ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.
-
问题现象:驱动安装失败,安装log文件提示说源码树未发现或者版本不匹配
-
解决办法:很大程度上我们安装的kernel-devel与kernel-headers与实际内核版本不匹配,这里指的是自动安装的情况;
-
查看核版本,
uname -a
# Linux localhost.localdomain 3.10.0-1160.31.1.el7.x86_64 #1 SMP Thu Jun 10 13:32:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux- rpm -qa | grep -E “kernel-devel|kernel-headers”
- sudo apt-get install linux-headers-
uname -r
/ sudo yum install linux-headers-uname -r
-
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-nouveau
7.3. Disabling Nouveau
To install the Display Driver, the Nouveau drivers must first be disabled. Each distribution of Linux has a different method for disabling Nouveau.
The Nouveau drivers are loaded if the following command prints anything:
$ lsmod | grep nouveau
- Fedora
Create a file at/usr/lib/modprobe.d/blacklist-nouveau.conf
with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
$ sudo dracut --force
Run the below command:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot the system.
7.3.2. RHEL/CentOS
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
$ sudo dracut --force
7.3.3. OpenSUSE
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initrd:
$ sudo /sbin/mkinitrd
7.3.4. SLES
No actions to disable Nouveau are required as Nouveau is not installed on SLES.
7.3.5. WSL
No actions to disable Nouveau are required as Nouveau is not installed on WSL.
7.3.6. Ubuntu
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
$ sudo update-initramfs -u
7.3.7. Debian
Create a file at /etc/modprobe.d/blacklist-nouveau.conf with the following contents:
blacklist nouveau
options nouveau modeset=0
Regenerate the kernel initramfs:
$ sudo update-initramfs -u