Installation of nvidia-304xx drivers on Rocky8.5

Acknowledgements

I appreciate the encouragement of RPMFusion senior staff, Nicolas Chauvet
and Leigh Scott, to proceed with this installation.

They have made it absolutely clear that nvidia-304xx drivers reached
end-of-life (EOL) years ago, and they in no way are responsible or liable
for any unreliabilities or failures in installations using them in conjunction
with their software.

With that caveat in mind, I extend my profuse “thank you’s” to Leigh for
his mentoring in assembling the required archival RPMFusion software
components, and especially for prescribing the fundamental rpmbuild
–rebuild command without which the installation would have been
impossible.

I also appreciate the information enigma9o7 has provided in his post,
nvidia-304 won't install, which I’ve used
many times in similar installations, and has some applicability in this one.


Rocky 8.6 kernel is unusable

For machines with SATA disk controllers, the required disk drivers are
missing in the Rocky 8.6 kernel.
(Reference: Rocky 8.6 won’t boot on PC with Nvidia Graphics card)

Also, the kernel-devel package is missing a file.
(Reference: Module build fails on RHEL8.6 as kmap_types.h is removed from kernel-devel. - Red Hat Customer Portal)

Fortunately, the Fedora29 kernel has the necessary characteristics to
fill the gap.


REQUIRED EXTRAS


RPMFusion current components

From Index of /free/el/updates/8/x86_64/b

buildsys-build-rpmfusion-30-9.el8.x86_64.rpm and
buildsys-build-rpmfusion-kerneldevpkgs-current-30-9.el8.x86_64.rpm


RPMFusion archival components

From RepoView: "RPM Fusion Fedora nonfree 27 - x86_64", the 3 driver files,

xorg-x11-drv-nvidia-304xx - NVIDIA’s 304xx serie proprietary display driver for NVIDIA graphic cards
xorg-x11-drv-nvidia-304xx-devel - Development files for xorg-x11-drv-nvidia-304xx
xorg-x11-drv-nvidia-304xx-libs - Libraries for xorg-x11-drv-nvidia-304xx

From Index of /pub/Mirrors/archive.rpmfusion.org/nonfree-archive/fedora/updates/27/SRPMS/n,
nvidia-304xx-kmod-304.137-4.fc27.src.rpm

From Index of /pub/Mirrors/archive.rpmfusion.org/nonfree-archive/fedora/updates/27/x86_64/a,

akmod-nvidia-304xx-304.137-4.fc27.x86_64.rpm


Signing Key Collection

To avoid any problems with kernel taint, all packages from other than the
standard repos should be checked for valid signatures. Therefore, all public
keys from valid software sources should be imported into the rpm database.
(This importation is most easily handled in the installation procedure
immediately after the graphics user interface is in place).

From the RPMFusion web site, the keys to be downloaded are:

RPM-GPG-KEY-rpmfusion-free-el-8 RPM-GPG-KEY-rpmfusion-nonfree-el-8
RPM-GPG-KEY-rpmfusion-free-fedora-27 RPM-GPG-KEY-rpmfusion-nonfree-fedora-27
RPM-GPG-KEY-rpmfusion-free-fedora-29 RPM-GPG-KEY-rpmfusion-nonfree-fedora-29
(I’m vague on whether only free or only nonfree keys are required; it’s
minimal overhead simply to install both).

From https://archives.fedoraproject.org, Fedora 29 updates,
the package fedora-gpg-keys-29-6.noarch.rpm, when installed, loads a
large number of fedora-version keys into /etc/pki/rpm-gpg. From there,
the Fedora 29 and Fedora 27 related ones can be imported into the
rpm database: specifically,
sudo rpm --import RPM-GPG-KEY-fedora-29-x86_64,
sudo rpm --import RPM-GPG-KEY-fedora-27-x86_64

When the EPEL repo is activated, sudo yum install epel-release,
the EPEL public key, RPM-GPG-KEY-EPEL-8, is placed in /etc/pki/rpm-gpg.

The RPM-GPG-KEY-rockyofficial public key is in /etc/pki/rpm-gpg as
part of the Rocky8.5 installation.


Fedora27 Graphics

It is well known that nvidia-304xx drivers don’t work if the
xorg-x11-server-Xorg version is > 1.19.n

Fortunately, the necessary downgrade is readily accomplished by
installing the following packages:

glx-utils-8.4.0-5.20181118git1830dcb.el8.x86_64.rpm
initial-setup-gui-0.3.81.7-1.el8.x86_64.rpm
mesa-dri-drivers-21.3.4-1.el8.x86_64.rpm
plymouth-system-theme-0.9.4-11.20200615git1e36e30.el8.x86_64.rpm
spice-vdagent-0.20.0-4.el8.x86_64.rpm
xorg-x11-drv-ati-7.9.0-3.fc27.x86_64.rpm
xorg-x11-drv-evdev-2.10.5-4.fc27.x86_64.rpm
xorg-x11-drv-fbdev-0.4.3-28.fc27.x86_64.rpm
xorg-x11-drv-intel-2.99.917-30.20160929.fc27.x86_64.rpm
xorg-x11-drv-libinput-0.26.0-1.fc27.x86_64.rpm
xorg-x11-drv-nouveau-1.0.15-3.fc27.x86_64.rpm
xorg-x11-drv-qxl-0.1.5-5.fc27.x86_64.rpm
xorg-x11-drv-vesa-2.3.2-28.fc27.x86_64.rpm
xorg-x11-drv-vmware-13.2.1-4.fc27.x86_64.rpm
xorg-x11-drv-wacom-0.35.0-3.fc27.x86_64.rpm
xorg-x11-server-common-1.19.6-7.fc27.x86_64.rpm
xorg-x11-server-Xorg-1.19.6-7.fc27.x86_64.rpm
xorg-x11-utils-7.5-28.el8.x86_64.rpm
xorg-x11-xauth-1.0.9-12.el8.x86_64.rpm
xorg-x11-xinit-1.3.4-18.el8.x86_64.rpm

The el8 packages should be installed first from the standard repos.
The fc27 packages need to be downloaded from
https://archives.fedoraproject.org, Fedora 27 Release packages,
and installed locally.


Fedora29Kernel

The following packages to install the Fedora 29 kernel need to be downloaded
from https://archives.fedoraproject.org, Fedora 29 Release packages:

kernel-4.18.16-300.fc29.x86_64.rpm
kernel-core-4.18.16-300.fc29.x86_64.rpm
kernel-cross-headers-4.18.16-300.fc29.x86_64.rpm
kernel-devel-4.18.16-300.fc29.x86_64.rpm
kernel-headers-4.18.16-300.fc29.x86_64.rpm
kernel-modules-4.18.16-300.fc29.x86_64.rpm
kernel-modules-extra-4.18.16-300.fc29.x86_64.rpm
kernel-tools-4.18.10-300.fc29.x86_64.rpm
kernel-tools-libs-4.18.10-300.fc29.x86_64.rpm
kernel-tools-libs-devel-4.18.10-300.fc29.x86_64.rpm


The file, disable-nouveau.conf, loaded into /etc/modprobe.d, to disable the
nouveau graphics driver after reboot:

blacklist nouveau
blacklist vga16fb
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist amd64_edac_mod
blacklist amd76_edac
options nouveau modeset=0


All these files and packages should be assembled and organized on a USB
stick for ready upload during the installation process.


INSTALLATION PROCEDURE


Initial Hard Drive Installation

Using the Rocky 8.5 minimal .iso, for reasons as per the Rocky forum post
mentioned above, the following 2 statements needed to be added to install
boot up command:

inst.dd=hd:LABEL=OEMDRV://kmod-sat_nv-5.4.5.el8.x86_64.rpm
inst.dd=hd:LABEL=OEMDRV://kmod-forcedeth=0.0-6.el8_4.elrepo.x86_64.rpm

(The first file can be downloaded from a Japanese CentOS8.5 archive, the 2nd
from the ELRepo website).

The standard software selected on install is the Server option, and the Basic
Development Tools.


Initial Installs without a GUI, preparing for a GUI

Mount a USB stick containing the Fedora29Kernel packages,
sudo mount /dev/sdb1 /mnt
(I uploaded them into a directory, /usr/share/Fedora29Kernel).
sudo yum localinstall k*.rpm, install 54 packages, upgrades 3.

Generate a grub configuration file:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

sudo reboot, and after reboot, the Fedora29Kernel is the default,
as indicated by uname -r from the command line.

sudo yum group install Fonts, installs 41 packages.
sudo yum group install ‘RPM Development Tools’, install 27 packages,
upgrades 15

yum list rpmdevtools —> just to confirm that it is installed
rpmdev-setuptree —> then check that the rpmbuild directory has been
created for /home/user
sudo yum install epel-release —> create yum access to EPEL repository

cd /etc/pki/rpm-gpg —> proceed to install two important keys ASAP
sudo rpm --import RPM-GPG-KEY-rockyofficial
sudo rpm --import RPM-GPG-KEY-EPEL-8

Because gdm has a dependency on xorg-x11-server-Xorg-1.20, and a
downgrade to xorg-x11-server-Xorg-1.19.6 is required, gdm is excluded
from the XFCE interface:

sudo yum --exclude=gdm group install “XFCE”, installs 151 packages

The yum install-only limit, for the number of kernels retained, applies to
other kernel component packages also, and can be a problem when
multiple versions of them are normally retained, specifically kernel-devel.
Therefore, as a precaution, cd /etc, sudo nano yum.conf,
change the install_only limit from the default 3 to 6.

sudo yum update, installs 55 packages, upgrades 225.
(After this update, a cache problem occured when trying another install:
the message said to run sudo yum clean packages: after a reboot, normal
processing returned).

sudo yum install sddm → sddm is the replacement display manager
sudo yum install gvfs → gives thunar normal USB mount and unmount
capability
sudo systemctl set-default graphical.target → activates GUI on reboot
sudo reboot


Remaining Installs, from GUI

From Settings —> Window Manager Tweaks ----> disable compositor
From Settings —> Screensaver —> disable screensaver and disable
lock screen

From a USB stick, upload and locally install
fedora-gpg-keys-29-6.noarch.rpm
From /etc/pki/rpm-gpg, sudo rpm --import RPM-GPG-KEY-fedora-29-x86_64,
and sudo rpm --import RPM-GPG-KEY-fedora-27-x86_64

From a USB stick, upload the rpmfusion keys into /etc/pki/rpm-gpg,
and sudo rpm --import RPM-GPG-KEY-rpmfusion*

From a USB stick, upload the Fedora27Graphics packages.
(I uploaded them into a directory, /usr/share/Fedora27Graphics).
Install the required el8 modules:
sudo yum install glx-utils initial-setup-gui initial-setup mesa-dri-drivers
plymouth-system-theme spice-vdagent xorg-x11-utils xorg-x11-xauth
xorg-x11-xinit, installs 127 packages.
Check the Fedora 27 packages, rpm --checksig x*.rpm, should show that
all signatures are o.k.
sudo yum --skip-broken localinstall x*.fc27.x86_64.rpm,
installs 10 packages, downgrades 5

For convenience, from /home/user, mkdir Downloads;
from a USB stick, upload nvidia-304xx-kmod*.src.rpm into it

From a USB stick, upload and locally install buildsys-build-rpmfusion
and buildsys-build-rpmfusion-kerneldevpkgs-current, which install
kmodtool as a dependency
sudo yum install akmods dkms kmod, installs 8 packages


The Home Stretch

From /home/user/Downloads,
rpmbuild --rebuild --define="kernels $(uname -r)” nvidia-304xx*.rpm,
which creates kmod-nvidia-304xx*.x86_64.rpm in
/home/user/rpmbuild/RPMS/x86_64

Into that same directory, upload the 4 RPMFusion archival packages,
akmod-nvidia*.rpm and the 3 xorg-x11-drv*.rpm’s.

Into /etc/modprobe.d, upload the disable-nouveau.conf file, reboot

After reboot, the vesa graphics driver will be in effect, with a larger
text size.

sudo service sddm stop, cntrl-alt-F2, login in text mode
From /home/user/rpmbuild/RPMS/x86_64,
sudo yum localinstall *.rpm, which install the 5 packages there.

sudo reboot; NB: the Fedora 29 kernel is no longer the default on login.
from Advanced options, it is the last entry; select it.
sudo lshw -C video should show that the nvidia driver is in effect


Post Installation

Versionlock xorg-x11-server-Xorg-1.19.6-7.fc27.x86_64

Xorg version 1.19.6 is essential to the functioning of the nvidia-304xx drivers
so it should not be upgraded.

sudo yum install python3-dnf-plugin-versionlock, to install the versionlock
package.
sudo dnf versionlock add xorg-x11-server-Xorg-1.19.6-7.fc27.x86_64, to lock
the Xorg package.

Sddm bug and work-around
To enable root login with the sddm display manager, in
/etc/sddm.conf, the MinimumUID value needs to be changed
from 1000 to 0.
Unfortunately, this step enables a considerable number of
extraneous login UID’s in addition to root, egs. GAMES,
MAIL, OPERATOR. There is provision for entering a comma-
delimited list of exclusions into the file, but that doesn’t seem
to work. Fortunately, the last ID used on a login is retained for
the next login, so there’s no significant problem in usage.
There is horizontal scrolling to select the UID on login, so one
just has to remember that “root is on the right”, and it’s not too
problematic to switch between ordinary user and root login.

Len E.