HOWTO: Install NVIDIA driver on Fedora – replacing Nouveau

There are different reasons to replace nouveau drivers (open source drivers for NVIDIA cards) with proper NVIDIA drivers. Some want to use cool things like CUDA. Others want to play 3D games. NVIDIA’s drivers no doubt provide better performance and a better tool suite.

I had a horrible experience with gnome after installing Fedora 17. CPU was on all cores up at 85% doing nothing. Google said it is a common issue with gnome-shell and someone commented it would go away with having NVIDIA drivers installed. So I gave it a try.
What sounds simple took me a long night as many “HOWTOs” did not work for me. Below my summary. May it be useful for others.

This guide should work for both 32bit and 64bit systems. Instructions are tested on Fedora 17 and 18.

Step #1: install build tools and kernel-devel
NVIDIA’s installer will build a kernel module from the driver and link it to your kernel. Therefore it requires certain build tools being installed.

yum groupinstall "Development Tools"
yum install kernel-devel kernel-headers

Step #2: download NVIDIA driver from http://www.nvidia.com
In my case the file is NVIDIA-Linux-x86_64-304.60.run. Give it executable permission but don’t run it yet.

chmod +x NVIDIA-Linux-x86_64-304.60.run

Step #3: change default run-level to “3”
NVIDIA drivers only install if no X server is running. You can manually terminate the X server. However, some components, buffers and modules won’t unload. So, we need to boot directly into run-level “3” which is the text mode.
Fedora’s default run-level is defined through a symbolic link which we will modify now and change back later.

rm /etc/systemd/system/default.target
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

Step #4: blacklist nouveau in /etc/modprobe.d
We need to prevent nouveau drivers from loading a) at boot time and b) post-boot. This step is to prevent it from being loaded manually or through any dependent module.
We create a new config file disable-nouveau.conf as the existing file blacklist.conf might be updated/overwritten by any system update.

echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf
echo 'nouveau modeset=0' >> /etc/modprobe.d/disable-nouveau.conf

Step #5: blacklist nouveau at boot time
Fedora ships nouveau as part of the boot image. That’s why blacklisting a la Step #4 is not sufficient. We need to pass a parameter to the kernel at boot time that stops nouveau from loading.

In your file /boot/grub2/grub.cfg find the line that loads the kernel (yours might look slightly different but should start similarly):

linux	/vmlinuz-3.6.3-1.fc17.x86_64 root=/dev/mapper/vg_fedo-lv_root ro rd.lvm.lv=vg_fedo/lv_swap rd.md=0 rd.dm=0 SYSFONT=True rd.lvm.lv=vg_fedo/lv_root rd.luks=0  KEYTABLE=es LANG=en_US.UTF-8 rhgb quiet

And now add the parameter rdblacklist=nouveau to it:

linux	/vmlinuz-3.6.3-1.fc17.x86_64 root=/dev/mapper/vg_fedo-lv_root ro rd.lvm.lv=vg_fedo/lv_swap rd.md=0 rd.dm=0 SYSFONT=True rd.lvm.lv=vg_fedo/lv_root rd.luks=0  KEYTABLE=es LANG=en_US.UTF-8 rdblacklist=nouveau rhgb quiet

Step #6: Install NVIDIA driver
We need to reboot now to make the kernel parameter effective. The system will load run-level 3 and prompt for login in text mode. Login as root. Change dir to where you have the NVIDIA driver executable and run it.

./NVIDIA-Linux-x86_64-304.60.run

Once complete, reboot and login as root.

Step #7: Change default run-level back to 5
We now quickly change the symbolic link for default run-level back to 5 before we startup X.

rm /etc/systemd/system/default.target
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

Next time the boot process will directly bring you back to GDM (graphical login screen).

Now startup X:

telinit 5

Now you should find in your Settings menu an entry “NVIDIA X Server Settings”. Use that to configure dual screen and other custom X Server settings.

This Installation Guide from NVIDIA is very good for the interested readers http://us.download.nvidia.com/XFree86/Linux-x86_64/304.60/README/index.html

Advertisements

13 Responses to HOWTO: Install NVIDIA driver on Fedora – replacing Nouveau

  1. Pingback: HOWTO: Install NVIDIA driver on Fedora 17 – replacing Nouveau « kaischroed

  2. Fitz says:

    Hello, I get up to step 5 and have these problems, can you help me please?

    (1)
    After I init 3 and get out of X, I use “dir” and “ls”, and logged in as root, I can not navigate to edit the grub.cfg file. How do I go to /boot/grub2 ?

    root@linux55 ~]# ls
    anaconda-ks.cfg multi-user

    (2)
    What text editor is best to use? I tried vim but when I type “:help” it says no help available so I do not know how to navigate to the grub.cfg file to edit it. I need to learn how to open up the the grub.cfg file.

    Thanks,
    Frank

  3. Eric Hostetler says:

    Hello,
    I’ve performed everything up to & including Step 5. After reboot, though, I have no video to work with, i.e. just a black screen. Is there something I need to do to correct this?

    Thanks!

    Eric

  4. Nathan says:

    Thank you for making this guide! It’s the only “howto” that’s worked for me so far, but it worked like a charm. I know this guide was intended for use with Fedora 17, but it also works with RHEL 7 x86_64 Workstation. Thanks again.

  5. Pingback: Установка, настройка и тестирование Fedora 21 Workstation на личном или игровом компьютере | Zit@i0

  6. salkfjlas says:

    Hi, in case anyone is wondering, this still works on F21 – just tested it.

    You can replace the steps where you create a symlink for the default target with “systemctl set-default multi-user.target” and then “systemctl set-default graphical.target” to set it back.

    The “disable a driver at boot time” parameter is now “rd.driver.blacklist=nouveau” (it’s described in the dracut.cmdline man page). Also you should add this line to the /etc/default/grub file (on the line starting with “GRUB_CMDLINE_LINUX), and then run “grub2-mkconfig -o /boot/grub2/grub.cfg”. This way, the module will stay blacklisted even if you update your kernel – changes to grub.cfg are otherwise overwritten.

  7. jobin says:

    Thanks…

    Works perfectly…

  8. oxguy3 says:

    Can confirm this still works on Fedora 22.

    You sir, are a goddamned hero. I spent so many hours working on this before I found your walkthrough. Can’t thank you enough!

  9. is it really working for fedora 22 ? because i tried so many different sollutions that didnt work

  10. J.B. Brown says:

    Can confirm this works on Fedora 22.

    I was trying to disable nouveau _only_ by specifying the grub command line at boot time, and that didn’t work.
    For both my Fedora 21 and freshly-installed Fedora 22 systems, I had to add the blacklisting to /etc/modprobe.d for the grub command line changes to actually take effect.
    Without the /etc/modprobe/.conf file specifying the blacklisting of nouveau, it did not work.

    Hope this helps.

  11. Juana Keese says:

    hi this is a great website that you have, thank u 4 sharing it with us.

  12. Pingback: Fedora 23 workstation (Linux)+NVIDIA GeForce GTX 980 Ti: my experience, log of what I do (and find out) – Not your usual #science #blog

  13. rbjorklin says:

    In step #3 you can do: systemctl set-default multi-user.target
    and in step #7: systemctl set-default graphical.target
    instead of manually playing around with links.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: