Skip to content

Instantly share code, notes, and snippets.

@jacky9813
Created October 31, 2024 01:47
Show Gist options
  • Save jacky9813/694a837d93eb0812137665f083e42018 to your computer and use it in GitHub Desktop.
Save jacky9813/694a837d93eb0812137665f083e42018 to your computer and use it in GitHub Desktop.
Install NVIDIA proprietary driver on Fedora 41

There are some steps that is not documented in the RPMFusion's installation guide. Here's how I install NVIDIA driver on Fedora 41.

  1. Update all packages and reboot
  2. Install akmod-nvidia from RPMFusion, optionally with packages for CUDA or NVENC.
  3. For some reason, after akmod installation, I didn't see modeset=1 on kernel option, so:
#!/bin/bash
sudo grubby --update-kernel=ALL --args='nvidia-drm.modeset=1'
  1. Create file /etc/dracut.conf.d/nvidia.conf with the following content:
add_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
install_items+=" /etc/modprobe.d/nvidia.conf "
  1. Create file /etc/modprobe.d/nvidia.conf with the following content:
options nvidia_drm modeset=1
  1. Wait until akmod done building the drivers.
  2. Rebuild initramfs sudo dracut --regenerate-all --force
  3. The system is ready to reboot.

TL;DR

The script has not been tested.

#!/bin/bash 
sudo dnf install akmod-nvidia \
    xorg-x11-drv-nvidia-cuda xorg-x11-drv-nvidia-cuda-libs \
    xorg-x11-drv-nvidia-power \
    nvidia-vaapi-driver libva-utils vdpauinfo

sudo grubby --update-kernel=ALL --args='nvidia-drm.modeset=1'


cat << EOF | sudo tee /etc/dracut.conf.d/nvidia.conf
add_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
install_items+=" /etc/modprobe.d/nvidia.conf "
EOF

cat << EOF | sudo tee /etc/modprobe.d/nvidia.conf
options nvidia_drm modeset=1
EOF

while pgrep akmod; do
    sleep 5
done

sudo dracut --regenerate-all --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment