Page 1 of 1

Installing Nvidia drivers on CentOS 8

Posted: 2020/06/10 00:17:55
by Nostigex
Hi, when trying to install the proprietary NVIDIA drivers for my Gigabyte Geforce 1650 SUPER, I get the same error messages as described in this post about CentOS 7:

viewtopic.php?t=70510

Code: Select all

Failed to run `/usr/sbin/dkms build -m nvidia -v 440.02 -k 4.18.0-147.el8.x86_64`: Error! echo
Your kernel headers for kernel 4.18.0-147.el8.x86_64 cannot be found at 
/lib/modules/4.18.0-147.el8.x86_64/build or
/lib/modules/4.18.0-147.el8.x86_64/source
You can use the --kernelsourcedir option to tell DKMS where it's located.
I tried pointing dkms to the /lib/modules/4.18.0-147.el8.x86_64/ (which in fact exists, and with a "source" file) directory manually using --kernelsourcedir, but it still can't find the files.

I added ElRepo as advised by TrevorH, but the package manager can't seem to find nvidia-detect. What's my next step?

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/06/10 01:01:45
by TrevorH
Run yum update and then reboot into the new kernel.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/06/10 14:16:16
by Nostigex
Ok, I got the drivers installed successfully. Next issue is that now after selecting CentOS from Grub (I'm dual booting with Debian) it hangs on displaying a single underscore in the upper left corner of the screen and the display itself flickers on and off. Same thing when trying to boot into recovery mode, just with more text that's difficult to make out due to the screen flickering on and off.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/06/10 14:18:01
by TrevorH
Remove rhgb quiet from the kernel command line at the grub prompt and see if that helps.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/06/27 07:14:00
by organicchemistry_01
I am running now NVIDIA card, simply dont install dkms if that is the case, you will still get the driver regardless

But if you are desperate, check the headers match your kernel version. Sometimes, when the header is not install along with your kernel, then you do install it at latter time, the system will offer a header that is not match with kernel.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/08/13 23:45:37
by eurbah
Nostigex wrote:
2020/06/10 14:16:16
Ok, I got the drivers installed successfully. Next issue is that now after selecting CentOS from Grub (I'm dual booting with Debian) it hangs on displaying a single underscore in the upper left corner of the screen and the display itself flickers on and off. Same thing when trying to boot into recovery mode, just with more text that's difficult to make out due to the screen flickering on and off.
On CentOS 8, after installing the 'kmod-nvidia' package from http://elrepo.org, I had exactly the same problem : No login screen.
I have performed some research and some tests.
The information I provide here still has to be checked by experienced people, for example package maintainers.

- The '/etc/X11/xorg.conf' file provided by http://elrepo.org is BAD. You have to delete or rename it.

- Inside the '/etc/X11/xorg.conf.d' folder, you have to install the '/usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf' file.

- By default, the 'gdm' display manager uses Wayland, which is NOT correctly managed by the Nvidia drivers yet.
Therefore, you have to force 'gdm' to use 'xorg', with following lines inside the [daemon] section of the '/etc/gdm/custom.conf' file :
WaylandEnable=false # uncommented
DefaultSession=gnome-xorg.desktop

The attached 'centos-install-nvidia.txt' file is a shell script which :
- Installs Nvidia drivers on CentOS
- Renames the bad 'xorg.conf' provided by http://elrepo.org
- Installs '/usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf'
- Forces 'gdm' to use 'xorg'

Then reboot, and you should get the login screen with the Nvidia drivers.

If everything is correctly installed, the above mentionned script does nothing. So you can run it several times.

In the hope that this will be useful.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/08/14 08:25:43
by TrevorH
I do not think you need to do all this at all.

There are currently two outstanding bugs for the ELRepo kmod-nvidia packages, The first one is that there is a missing dependency on the nvidia-x11-drv package from kmod-nvidia so when you `yum install kmod-nvidia` it can install it but omit the matching nvidia-x11-drv package so it will not work as the necessry libraries are missing. This one is easy to bypass by running yum install kmod-nvidia nvidia-x11-drv to make sure that both are installed. This bug is scheduled to be fixed in the next update.

The second bug is an upstream selinux one and requires you to run setsebool -P domain_can_mmap_files 1 to allow it to load properly.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/08/14 20:18:23
by eurbah
Thanks to TrevorH for his quick and precise reply.

I confirm the need to install manually the 'nvidia-x11-drv' package.

From my tests after the activation of the selinux boolean 'domain_can_mmap_files' :

It is NOT necessary anymore to :
- Copy the '/usr/share/X11/xorg.conf.d/nvidia-drm-outputclass.conf' file into the '/etc/X11/xorg.conf.d' folder,
- Modify the [daemon] section of the '/etc/gdm/custom.conf' file to force 'gdm' to use 'xorg'.

But the '/etc/X11/xorg.conf' file provided by http://elrepo.org STILL has a BAD content forbidding to get the login screen.
Therefore, it is STILL necessary to delete or rename this file.

So, I attach a simpler 'centos-install-nvidia-selinux.txt' shell script which :
- Installs Nvidia drivers ('kmod-nvidia' and 'nvidia-x11-drv') on CentOS
- Activates the selinux boolean domain_can_mmap_files
- Renames the bad xorg.conf provided by http://elrepo.org

Then reboot, and you should get the login screen with the Nvidia drivers.

If everything is correctly installed, the above mentioned script does nothing. So you can run it several times.

Re: Installing Nvidia drivers on CentOS 8

Posted: 2020/08/14 21:33:12
by chemal
eurbah wrote:
2020/08/14 20:18:23
But the '/etc/X11/xorg.conf' file provided by http://elrepo.org STILL has a BAD content forbidding to get the login screen.
Is this a notebook with Optimus technology?