Install NVIDIA official drivers on Fedora 28 (x86_64)

Author:

Fedora 28 comes with open source driver for NVIDIA cards, so you’ll get a decent and stable driver for your video, but without hardware acceleration and a machine not good for gaming like Steam, not good for scientific usage or crypt mining! In fact in recent open source versions (called nouveau) of the NVIDIA driver some cards got partial hardware acceleration, but most of the latest cards out there still need the proprietary driver!
Our test system is equipped with ASUS ROG Poseidon GeForce® GTX 1080 TI 11GB Platinum Edition by default here is the linux kernel output:

[myuser@localhost ~]$ lspci |grep -i nvidia
0a:00.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)
0a:00.1 Audio device: NVIDIA Corporation GP102 HDMI Audio Controller (rev a1)
[myuser@localhost ~]$ dmesg|grep -i nvidia
[    4.606404] nouveau 0000:0a:00.0: NVIDIA GP102 (132000a1)
[    7.776389] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input14
[    7.776487] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input15
[    7.776548] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input16
[    7.776608] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input17
[myuser@localhost ~]$ cat /proc/modules |grep nouveau
nouveau 2019328 21 - Live 0x0000000000000000
video 45056 2 asus_wmi,nouveau, Live 0x0000000000000000
drm_kms_helper 200704 1 nouveau, Live 0x0000000000000000
mxm_wmi 16384 1 nouveau, Live 0x0000000000000000
ttm 126976 1 nouveau, Live 0x0000000000000000
drm 454656 24 nouveau,drm_kms_helper,ttm, Live 0x0000000000000000
i2c_algo_bit 16384 2 nouveau,igb, Live 0x0000000000000000
wmi 28672 4 asus_wmi,wmi_bmof,nouveau,mxm_wmi, Live 0x0000000000000000

Here are the steps to install NVIDIA proprietary driver on Fedora 28:

STEP 1) Disable UEFI Secure Boot

Check in your BIOS if this feature is enabled. You should disabled it or after a successful installation of the kernel module you must sign it, which is not the goal of this howto. It is probably disabled if you use Linux, but it could be enabled if you use signed kernel, so it is good to check this settings because your driver won’t run if this feature is enabled.

STEP 2) Update your system and reboot. Then install the dependencies for the NVIDIA driver

DKMS is used for building the NVIDIA kernel module when a new kernel is installed. So you do not have to worry if you update your kernel. At first best way is to become root with sudo.

[myuser@localhost ~]$ sudo su
[root@localhost ~]$ dnf -y update
[root@localhost ~]$ reboot
[root@localhost ~]$ dnf -y install kernel-devel kernel-headers gcc dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

STEP 3) Download the official NVIDIA installer application

Here is the NVIDIA search driver page – https://www.nvidia.com/Download/Find.aspx, just find the card you own and download the driver. Here are the steps we’d past:
So at the end you get a file NVIDIA-Linux-x86_64-390.67.run

[myuser@localhost ~]$ ls -al NVIDIA-Linux-x86_64-390.67.run 
-rw-r--r--. 1 myuser myuser 82272406  2 Jul  2,37 NVIDIA-Linux-x86_64-390.67.run

Select your video card and click on “Search”, we selected GeForce GTX 1080 Ti.

main menu
Select your video card

Click on the top driver, which is not “beta”.
main menu
Click on the driver to download

Infromation for the NVIDIA display driver. The most recent is version 390.67. Click on “Download”.
main menu
Click on download

Click on download again to begin downloading the installation file. You can download NVIDIA End User License Agreement, too.
main menu
Click on download again to begin downloading the installation file.

STEP 4) Disable the open source nouveau.

The driver must be blacklisted on two places, when the initramfs loads and during the fedora 28 systemd booting. So first put the following in

/etc/modprobe.d/blacklist.conf

[root@localhost ~]$ echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

and in file

/etc/sysconfig/grub

add at the end of the line starting with GRUB_CMDLINE_LINUX the following:

rd.driver.blacklist=nouveau

so in our case we have:

GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet rd.driver.blacklist=nouveau"

This is just an example, do not copy the whole line, just add at the end before the ending quotes rd.driver.blacklist=nouveau

STEP 5) Update grub configuration and remove the open source driver from x11 and initram

[root@localhost ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.17.3-200.fc28.x86_64
Found initrd image: /boot/initramfs-4.17.3-200.fc28.x86_64.img
Found linux image: /boot/vmlinuz-4.16.3-301.fc28.x86_64
Found initrd image: /boot/initramfs-4.16.3-301.fc28.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-d11e97619bd242a39cd53700ce473c6c
Found initrd image: /boot/initramfs-0-rescue-d11e97619bd242a39cd53700ce473c6c.img
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 16.04.4 LTS (16.04) on /dev/sda2
done
[root@localhost ~]# #commeted, use only if your BIOS is not in UEFI mode!!!
[root@localhost ~]# #grub2-mkconfig -o /boot/grub2/grub.cfg
[root@localhost ~]# dnf remove xorg-x11-drv-nouveau
Dependencies resolved.
=======================================================================================================================================================================
 Package                                        Arch                             Version                                     Repository                           Size
=======================================================================================================================================================================
Removing:
 xorg-x11-drv-nouveau                           x86_64                           1:1.0.15-4.fc28                             @anaconda                           229 k

Transaction Summary
=======================================================================================================================================================================
Remove  1 Package

Freed space: 229 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                               1/1 
  Erasing          : xorg-x11-drv-nouveau-1:1.0.15-4.fc28.x86_64                                                                                                   1/1 
  Running scriptlet: xorg-x11-drv-nouveau-1:1.0.15-4.fc28.x86_64                                                                                                   1/1 
  Verifying        : xorg-x11-drv-nouveau-1:1.0.15-4.fc28.x86_64                                                                                                   1/1 

Removed:
  xorg-x11-drv-nouveau.x86_64 1:1.0.15-4.fc28                                                                                                                          

Complete!
[root@localhost ~]# mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
[root@localhost ~]# dracut /boot/initramfs-$(uname -r).img $(uname -r)
[root@localhost ~]# systemctl set-default multi-user.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
[root@localhost ~]# reboot

As you can see the grub configuration tool found two more operating systems Microsoft Windows 10 and Ubuntu 16 and they are saved in the new configuration, so it is safe to make the new configuration it will preserve the other grub configuration and you’ll be able to boot them if you choose it from the grub menu.
We removed the unnecessary package xorg-x11-drv-nouveau.x86_64, regenerated the initramfs for our kernel and instructed the system to set the default console login – you do not need GUI and you won’t have it (you’ve just removed the GPU driver!) the next time you boot your machine.

STEP 6) Run the NVIDIA installation file from root user

After the restart your system won’t boot in GUI, there will be the login console prompt:

main menu
Console login

Login with your user and then become root, the installation need to be executed by the root user. Then execute NVIDIA-Linux-x86_64-390.67.run, but before you must change the permissions to executable.

[myuser@localhost myuser]# chmod 755 ./NVIDIA-Linux-x86_64-390.67.run
[myuser@localhost myuser]# sudo su
[root@localhost myuser]# ./NVIDIA-Linux-x86_64-390.67.run 
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 390.67.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Select “Yes” using tab key and hit enter.

                        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (390.67)
 
  Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build 
  a new module, if you install a different kernel later.

                                    Yes                                 No   

  NVIDIA Software Installer for Unix/Linux                                                     www.nvidia.com
main menu
This will allow DKMS to automatically build a new module, if you install a different kernel later.

Select “Yes” using tab key and hit enter.

                        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (390.67)

  Install NVIDIA's 32-bit compatibility libraries?
                                                                                                              
                                    Yes                                 No   
 
  NVIDIA Software Installer for Unix/Linux                                                     www.nvidia.com 
main menu
Install NVIDIA’s 32-bit compatibility libraries

Select “Yes” using tab key and hit enter.

                       NVIDIA Accelerated Graphics Driver for Linux-x86_64 (390.67)

  Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that
  the NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed  
  up.     
                                                                                                              
                                    Yes                                 No   


  NVIDIA Software Installer for Unix/Linux                                                     www.nvidia.com
main menu
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file.

Hit enter to continue. Your NVIDIA driver is isntalled successfully.

                        NVIDIA Accelerated Graphics Driver for Linux-x86_64 (390.67)
 
  Your X configuration file has been successfully updated.  Installation of the NVIDIA Accelerated Graphics   
  Driver for Linux-x86_64 (version: 390.67) is now complete.

                                                      OK  

  NVIDIA Software Installer for Unix/Linux                                                     www.nvidia.com 
main menu
Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version: 390.67) is now complete.

STEP 7) Return the default login to be GUI and reboot your machine.

Do not forget you must be root user or execute the commands with sudo.

[root@localhost myuser]# systemctl set-default graphical.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
[root@localhost myuser]# reboot

You should be back in GNOME login after the reboot.
Here is the NVIDIA driver loaded successfully:

[myuser@localhost ~]$ dmesg|grep -i nvidia
[    8.806266] nvidia: loading out-of-tree module taints kernel.
[    8.806277] nvidia: module license 'NVIDIA' taints kernel.
[    8.812252] nvidia: module verification failed: signature and/or required key missing - tainting kernel
[    8.821344] nvidia-nvlink: Nvlink Core is being initialized, major device number 234
[    8.821805] nvidia 0000:0a:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
[    8.821994] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  390.67  Fri Jun  1 04:04:27 PDT 2018 (using threaded interrupts)
[    8.833388] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  390.67  Fri Jun  1 03:15:43 PDT 2018
[    8.856187] [drm] [nvidia-drm] [GPU ID 0x00000a00] Loading driver
[    8.856190] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:0a:00.0 on minor 0
[    8.860227] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input14
[    8.860404] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input15
[    8.860665] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input16
[    8.861126] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0/input17
[   14.388205] caller _nv001169rm+0xe3/0x1d0 [nvidia] mapping multiple BARs
[   14.821065] nvidia-modeset: Allocated GPU:0 (GPU-3bad60bf-8ff7-4cba-8b51-a931299a56d8) @ PCI:0000:0a:00.0
[myuser@localhost ~]$ cat /proc/modules |grep -i nvidia
nvidia_drm 45056 2 - Live 0x0000000000000000 (POE)
nvidia_modeset 1110016 11 nvidia_drm, Live 0x0000000000000000 (POE)
nvidia 14389248 480 nvidia_modeset, Live 0x0000000000000000 (POE)
drm_kms_helper 196608 1 nvidia_drm, Live 0x0000000000000000
drm 458752 5 nvidia_drm,drm_kms_helper, Live 0x0000000000000000
ipmi_msghandler 57344 2 nvidia,ipmi_devintf, Live 0x0000000000000000

STEP 8) Enable video acceleration support

[myuser@localhost ~]$ sudo dnf -y install vdpauinfo libva-vdpau-driver libva-utils

nvidia settings and nvidia-smi

NVIDIA X server settings – X Server Information.

main menu
NVIDIA X server settings

NVIDIA X server settings – GPU 0 – (GeForce GTX 1080 Ti) infromation tab. You can see the BIOS version, CUDA cores of 3584, Total Memory 11264 MB, current GPU utilization and more.
main menu

[myuser@localhost ~]$ nvidia-smi 
Mon Jul  2 03:43:33 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.67                 Driver Version: 390.67                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:0A:00.0  On |                  N/A |
|  0%   51C    P8    14W / 275W |    244MiB / 11175MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1843      G   /usr/libexec/Xorg                             12MiB |
|    0      2110      G   /usr/bin/gnome-shell                          49MiB |
|    0      2400      G   /usr/libexec/Xorg                             61MiB |
|    0      2489      G   /usr/bin/gnome-shell                         118MiB |
+-----------------------------------------------------------------------------+

vainfo – VA-API driver, the video acceleration API driver

Here is the nouveau – as you can see no acceleration supported:

[myuser@localhost ~]$ vainfo 
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nouveau_drv_video.so
libva info: Found init function __vaDriverInit_1_1
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc

And here is after installing the NVIDIA proprietary driver, you get video acceleration for your video player!

[myuser@localhost ~]$ vainfo 
libva info: VA-API version 1.1.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.1 (libva 2.1.0)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
      <unknown profile>               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD

2 thoughts on “Install NVIDIA official drivers on Fedora 28 (x86_64)”

  1. Hello! I have a question for you.

    I installed the Nvidia driver as outlined above. and all went well. However, there was and update to the kernel released be Fedora this morning. When I try to reboot, it never reaches the Graphical login interface. However, I can reboot with the old kernel and everything works as expected. How can I fix this?

    TIA for Any Help,
    Doug N

    Kernel that works : 4.17.3-200.fc28.x86_64
    Kernel that doesn’t work : 4.17.4-200.fc28.x86_64

    I run KDE. The driver I installed is :

    NVIDIA-Linux-x86_64-340.107.run

  2. Hi Doug N,
    I just updated my Fedora 28 and everything is OK, I am in the gnome (I use the workstation with gnome). Strange thing happened to you it is supposed to work out-of-the-box even with kernel upgrade – there is the DKMS, which rebuilds and installs the (nvidia) driver after installation of a new kernel. Probably something has gone wrong with your upgrading. Can you check if you have the driver installed here (execute the first line):
    find /lib/modules/|grep nvidia
    /lib/modules/4.17.4-200.fc28.x86_64/kernel/drivers/net/ethernet/nvidia
    /lib/modules/4.17.4-200.fc28.x86_64/kernel/drivers/net/ethernet/nvidia/forcedeth.ko.xz
    /lib/modules/4.17.3-200.fc28.x86_64/kernel/drivers/net/ethernet/nvidia
    /lib/modules/4.17.3-200.fc28.x86_64/kernel/drivers/net/ethernet/nvidia/forcedeth.ko.xz
    /lib/modules/4.16.3-301.fc28.x86_64/kernel/drivers/net/ethernet/nvidia
    /lib/modules/4.16.3-301.fc28.x86_64/kernel/drivers/net/ethernet/nvidia/forcedeth.ko.xz
    As you can see the module is there for all of my kernels installed including the one you have problems – 4.17.4-200.fc28.x86_64. In fact I write you this comment using this kernel and nvidia proprietary driver loaded successfully.
    Probably you can try reinstalling the problematic kernel with:
    dnf reinstall kernel-*-4.17.4-*

    Just to note do not execute the above with just “kernel*”, because it will try to reinstall all your currently installed kernels and you could lose the working kernels…

Leave a Reply

Your email address will not be published. Required fields are marked *