How to disable Nouveau kernel driver on CentOS

6.9k Views Asked by At

I am installing CUDA on my GPU machines. While at it, I need to disable Nouveau Kernel Driver.

I did find a solution here: https://askubuntu.com/questions/841876/how-to-disable-nouveau-kernel-driver

But update-initramfs is not found on CentOS.

I am looking for an equivalent of sudo update-initramfs -u in CentOS

2

There are 2 best solutions below

0
On

If your goal is to install the latest nvidia driver to run with cuda. The best way to disable nouveau is indeed to rebuild the initramfs, as written by Gediz. Since, as spotted here (https://forums.centos.org/viewtopic.php?t=68800), it is only a 5 steps process I think it deserves to be right here :

grubby ––update-kernel=ALL ––args="rd.driver.blacklist=nouveau nouveau.modeset=0"
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak
echo "blacklist nouveau" > /etc/modprobe.d/nouveau-blacklist.conf 
dracut /boot/initramfs-$(uname -r).img $(uname -r)

reboot
0
On

I believe Nouveau driver can be easily unloaded using modprobe:

modprobe -r nouveau

Also there is an option -b which blacklists it.

-b, --use-blacklist         Apply blacklist to resolved alias.

In the web address you attached there is :

option nomodeset

I guess it is a kernel option not to load !ANY display drivers.You wont always need to update initramfs, only if module is included in initramfs you need to update it.

You can check it using one of initramfs-tools by :

lsinitramfs /boot/initrd.img-4.9.0-5-amd64 |less

However if you need to update or rebuild initramfs there is a way shown in CentOs Wiki :

https://wiki.centos.org/TipsAndTricks/CreateNewInitrd