Installing Nvidia drivers on CentOS 8

Issues related to hardware problems
Post Reply
Nostigex
Posts: 2
Joined: 2020/06/10 00:06:01

Installing Nvidia drivers on CentOS 8

Post by Nostigex » 2020/06/10 00:17:55

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?

User avatar
TrevorH
Forum Moderator
Posts: 29443
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Installing Nvidia drivers on CentOS 8

Post by TrevorH » 2020/06/10 01:01:45

Run yum update and then reboot into the new kernel.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Nostigex
Posts: 2
Joined: 2020/06/10 00:06:01

Re: Installing Nvidia drivers on CentOS 8

Post by Nostigex » 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.

User avatar
TrevorH
Forum Moderator
Posts: 29443
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Installing Nvidia drivers on CentOS 8

Post by TrevorH » 2020/06/10 14:18:01

Remove rhgb quiet from the kernel command line at the grub prompt and see if that helps.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

organicchemistry_01
Posts: 45
Joined: 2017/08/27 09:48:47

Re: Installing Nvidia drivers on CentOS 8

Post by organicchemistry_01 » 2020/06/27 07:14:00

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.

eurbah
Posts: 2
Joined: 2020/08/13 22:46:54

Re: Installing Nvidia drivers on CentOS 8

Post by eurbah » 2020/08/13 23:45:37

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.
Attachments
centos-install-nvidia.txt
This shell script :
- 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'
If everything is correctly installed, this script does nothing. So you can run it several times.
(7.5 KiB) Downloaded 81 times

User avatar
TrevorH
Forum Moderator
Posts: 29443
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Installing Nvidia drivers on CentOS 8

Post by TrevorH » 2020/08/14 08:25:43

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.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

eurbah
Posts: 2
Joined: 2020/08/13 22:46:54

Re: Installing Nvidia drivers on CentOS 8

Post by eurbah » 2020/08/14 20:18:23

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.
Attachments
centos-install-nvidia-selinux.txt
This shell script :
- 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
If everything is correctly installed, this script does nothing. So you can run it several times.
(3.73 KiB) Downloaded 115 times

chemal
Posts: 692
Joined: 2013/12/08 19:44:49

Re: Installing Nvidia drivers on CentOS 8

Post by chemal » 2020/08/14 21:33:12

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?

Post Reply

Return to “CentOS 8 - Hardware Support”