Installing nvidia drivers on Fedora 30+

The process for installing the NVidia drivers on Fedora 30+ is slightly different. Now, you need to do this:

Enable the 3rd party repo:

sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo

Next, ensure the machine is fully up-to-date:

sudo dnf update --refresh

Note that you’ll need to reboot of there’s a kernel update now.

Then, you install the drivers:

sudo dnf install nvidia-settings kernel-devel dkms-nvidia nvidia-driver nvidia-driver-cuda nvidia-driver-cuda-libs nvidia-driver-libs nvidia-driver-libs.i686

If you don’t want CUDA, just remove those packages from the above command.

If you’re doing deep learning (e.g. with Tensorflow), then you also want to install cuda-cudnn:

sudo dnf install cuda-cudnn

Next, you’ll need to edit /etc/X11/xorg.conf and paste the following in (create it if it doesn’t exist):

Section "Device"
	Identifier	"Device0"
	Driver		"nvidia"
EndSection

Once done, you’ll need to remove the nouveau driver:

sudo dnf remove xorg-x11-drv-nouveau

Now, you need to rebuild the DKMS drivers so that they can be loaded when we reboot again:

sudo dkms autoinstall

Make sure this last command completes successfully. If it doesn’t, then you’re likely to get a black screen on reboot - and will have to login via SSH to fix it.

Finally, we need to blacklist the open-source driver, since we’re using the Nvidia driver:

echo "blacklist nouveau" | sudo tee --append /etc/modprobe.d/blacklist.conf

Now, we need to rebuild the grub config to get that change to take effect:

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Finally, we can now reboot and it should work.

Troubleshooting

If it doesn’t work, try rebooting again by logging in via SSH and entering sudo reboot.

You can also check the Xorg logs. These are located in /var/log, and start with Xorg.. The one you probably want is Xorg.0.log, but I’d recommend checking the last-modified date on them with ls -l and pickingt he one that was modified most recently.

If that still doesn’t work and you want to get it back to the way it was before, remove the edit to /etc/modprobe.d/blacklist.conf above with a sudo nano /etc/modprobe.d/blacklist.conf. Then, remove all nvidia packages:

sudo dnf remove *nvidia*
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Kernel or nvidia updates break the driver

Because of this problem, dkms (which is responsible for installing the nvidia driver), the system can break if the kernel and driver update at the same time (or some combination of the two). You can see if this is the case by running the following command:

sudo dkms status

If it throws an error, you have this problem. To solve it, first uninstall the nvidia drivers as above. Next, move the contents of /var/lib/dkms/nvidia/ to a backup location (just in case):

sudo mkdir /tmp/backup
sudo mv  /var/lib/dkms/nvidia/* /tmp/backup

Then install the nvidia driver again as above. To verify it’s installed correctly, run sudo dkms status again.

References

Unfortunately, I still can’t get the above instructions to work. When the PC starts we get the initial test whizz by when it’s booting the Linux kernel, but after that it goes black and stays black.

I’m testing on fs-desktop01, and according to /var/log/Xorg.0.log it’s still trying to load the nouveau drivers for some reason and crashing 'cause it can’t find a valid framebuffer device.

So frustrating!

I was trying to install the Nvidia propriety drivers so that we could do CUDA computation on the Freeside desktops, but evidently there appear to be some issues with that.

Note to self: @Epictek has kindly suggested we try the following:

Edit /etc/sysconfig/grub to add rd.driver.blacklist=nouveau

dnf remove xorg-x11-drv-nouveau # Remove the nouveau driver
dracut --force # Regen the initramfs

Try the RPMFusion packages instead

Fixed! Looks like it was a combination oft he following that did the trick:

Removing the nouveau driver:

sudo dnf remove xorg-x11-drv-nouveau

Ensuring that the nvidia driver itself is installed:

sudo dnf install nvidia-driver

Force Xorg to use the nvidia driver, by pasting the following into /etc/X11/xorg.conf (create it if it doesn’t exist):

Section "Device"
	Identifier	"Device0"
	Driver		"nvidia"
EndSection

Somehow, when I copied and pasted the command somewhere, I managed to drop the nvidia-driver package. The symptom here was that it claimed that it couldn’t start the xorg server, because when it tried to load the nvidia driver it said that it didn’t exist.

The original post has been updated.

Note that on fs-desktop04 with the nvidia drivers installed as above, we were getting a black screen just randomly. Removing the drivers and then reinstalling them fixed the issue.