Skip to content

Instantly share code, notes, and snippets.

@oprizal
Created November 11, 2021 14:51
Show Gist options
  • Save oprizal/b11338e49ad8058a52e8d4f9b5131f61 to your computer and use it in GitHub Desktop.
Save oprizal/b11338e49ad8058a52e8d4f9b5131f61 to your computer and use it in GitHub Desktop.
how-to-install-nvidia-driver-340xx-on-fedora-35

How to Install NVIDIA Driver 340xx on Fedora 35

After couple times failed to install Nvidia legacy driver 340xx on my Fedora 35, I found an instruction from the internet 1. Here are the step-by-step I did base on the article.

First, open terminal and be a root user.

Don't forget to add <space>+- after typing su.

$ su -

Make inttf-nvidia-patcher.sh executable and run it.

# chmod +x inttf-nvidia-patcher.sh
# ./inttf-nvidia-patcher.sh

It will download the driver and patchs.

When download finished, you'll find a file name NVIDIA-Linux-x86_64-340.108-patched-kernel-5.14.run alongside with other file.

# ls
inttf-nvidia-patcher.sh
NVIDIA-340xx
NVIDIA-Linux-x86_64-340.108
NVIDIA-Linux-x86_64-340.108-patched-kernel-5.14.run
NVIDIA-Linux-x86_64-340.108.run

Next update your system to latest update avalable---it's includes latest kerenel update.

# sudo dnf update

After finishing the update you should reboot your system and choose the latest kernel available on the bootlsit.

# reboot

After reboot, open terminal and be a root again. Don't forget to add <space>+- after typing su.

# su -

Install all dependencies needed to build Nvidia driver kernel modules.

# dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

Blacklist nouveau driver.

# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

Blacklist again nouveau driver on GRUB command arguments.

If you're using BTRFS.

# grubby --args=rd.driver.blacklist=nouveau --update-kernel=ALL

If you're using LVM.

# grubby --args="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rd.driver.blacklist=nouveau" --update-kernel=ALL

Remove nouveau driver.

# dnf remove xorg-x11-drv-nouveau

Backup initramfs and create new one.

# mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img

# dracut /boot/initramfs-$(uname -r).img $(uname -r)

Reboot to run level 3 and reboot.

# systemctl set-default multi-user.target

# reboot

You'll find your system now on terminal mode only (run level 3). Login to your user account.

After you login, be a root again. Don't forget to add <space>+- after typing su.

$ su -

Install the Nvidia driver patch.

# ./NVIDIA-Linux-x86_64-340.108-patched-kernel-5.14.run

Follow the instruction until it finish.

Change the target back to graphical default and reboot.

# systemctl set-default graphical.target

# reboot

All done.

1. Source: https://www.if-not-true-then-false.com

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