Skip to content

Instantly share code, notes, and snippets.

@grenade
Last active June 2, 2024 14:25
Show Gist options
  • Save grenade/8844d472bc1dcec48d37291b0b7b7220 to your computer and use it in GitHub Desktop.
Save grenade/8844d472bc1dcec48d37291b0b7b7220 to your computer and use it in GitHub Desktop.
reinstall nvidia driver from rpm-fusion after a fedora upgrade
#!/bin/bash
# usage:
# curl -sL https://gist.github.com/grenade/8844d472bc1dcec48d37291b0b7b7220/raw/nvidia-driver-reinstall.sh?$(uuidgen) | bash
# uninstall all nvidia packages
sudo dnf erase '*nvidia*'
# disable the nvidia driver that doesn't come from rpm-fusion
# https://rpmfusion.org/Howto/CUDA#Which_driver_Package
sudo dnf module disable nvidia-driver
# install driver from rpm-fusion
# https://rpmfusion.org/Howto/NVIDIA
sudo dnf -y install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda
sudo reboot
# should output the version of the driver such as `460.67`, not `modinfo: ERROR: Module nvidia not found.`
modinfo -F version nvidia
@GladioScape
Copy link

Also add commands:
~$ sudo akmods --force
~$ sudo dracut --force
To rebuild modules, because after restart some users get error: "NVIDIA kernel module missing. Falling back to nouveau"

@methanoid
Copy link

Doesnt work for me:

Checking kmods exist for 6.8.5-301.fc40.x86_64 [ OK ]
Files needed for building modules against kernel
6.8.5-301.fc40.x86_64 could not be found as the following
directories are missing:
/usr/src/kernels/6.8.5-301.fc40.x86_64/
/lib/modules/6.8.5-301.fc40.x86_64/build/Is the correct kernel-devel package installed? [FAILED]
Checking kmods exist for 6.8.10-300.fc40.x86_64 [ OK ]

@superuser-miguel
Copy link

@methanoid Why did you use this method??? Drop by the Fedora Forums if you still need help. . .

@methanoid
Copy link

@methanoid Why did you use this method??? Drop by the Fedora Forums if you still need help. . .

I got it installed. Basically NV+Wayland=MESS. No issues with KDE6 and X11. So I removed Nvidia and put AMD card in and all good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment