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.shIt 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.runNext update your system to latest update avalable---it's includes latest kerenel update.
# sudo dnf updateAfter finishing the update you should reboot your system and choose the latest kernel available on the bootlsit.
# rebootAfter 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 pkgconfigBlacklist nouveau driver.
# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.confBlacklist again nouveau driver on GRUB command arguments.
If you're using BTRFS.
# grubby --args=rd.driver.blacklist=nouveau --update-kernel=ALLIf you're using LVM.
# grubby --args="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rd.driver.blacklist=nouveau" --update-kernel=ALLRemove nouveau driver.
# dnf remove xorg-x11-drv-nouveauBackup 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
# rebootYou'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.runFollow the instruction until it finish.
Change the target back to graphical default and reboot.
# systemctl set-default graphical.target
# rebootAll done.