How to blacklist Nouveau driver on Linux
Nouveau is the open-source driver for Nvidia graphics cards on Linux. It is the default driver that comes with most Linux distributions and provides basic functionality for Nvidia GPUs.
However, most users may want to use a different driver, such as the proprietary one from Nvidia or the one required for CUDA development. In that case, the Nouveau driver needs to be disabled or blacklisted; otherwise, it may cause conflicts or errors during the installation of the other driver.
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.
There are two methods for blacklisting the open-source driver on Linux.
1. Editing the grub configuration file
The grub configuration file is located at /etc/default/grub
on most Linux systems. It contains various options for the bootloader, such as the kernel parameters.
To blacklist the Nouveau driver, we need to add modprobe.blacklist=nouveau
to the kernel line in this file. To do this, open a terminal and enter the following command:
sudo nano /etc/default/grub
This will open the grub configuration file in the nano editor. Look for the line that starts with GRUB_CMDLINE_LINUX_DEFAULT
, and append modprobe.blacklist=nouveau
To it.
For example, if the line looks like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change it to this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash modprobe.blacklist=nouveau"
Save and exit the file by pressing Ctrl+O and Ctrl+X. Then, update the grub configuration by running this command:
sudo update-grub
This will generate a new grub.cfg
file based on the edited Grub file.
2. Creating a modprobe configuration file
Modprobe is a tool that manages kernel modules on Linux. It can load or unload modules dynamically and read configuration files that specify which modules to load or blacklist. To blacklist the Nouveau driver, we need to create a modprobe configuration file that contains blacklist nouveau
and options nouveau modeset=0
.
To do this, open a terminal and enter the following commands:
sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
These commands will create a new file named blacklist-nvidia-nouveau.conf
in /etc/modprobe.d
/ directory, and write blacklist nouveau
and options nouveau modeset=0
to it. The first line tells modprobe not to load the Nouveau module, and the second line tells modprobe to disable the kernel mode setting for the Nouveau module.
To verify the content of the file, you can run this command:
cat /etc/modprobe.d/blacklist-nvidia-nouveau.conf
You should see something like this:
blacklist nouveau
options nouveau modeset=0
After editing the grub configuration file or creating the modprobe configuration file, you need to reboot your system for the changes to take effect. To do this, run this command:
sudo reboot
This will restart your system and boot with the Nouveau driver blacklisted.
If you have any questions or feedback, please leave a comment below.