Boot persistence on RHEL 9 (5.14 ABI)
Stock nvidia.ko is loaded by udev from the initrd through the PCI modalias
before systemd-modules-load can insert nvidia_rs, and once it owns the
GPU the Rust module only does its PCI/DMA preparation ("engine initialization
and CUDA unavailable") and never creates its nodes. Copy these files and rebuild
the initrd so /etc/modprobe.d/nvdriver.conf is inside it; the modalias then
resolves to nvidia_rs and the stock module never loads.
| file | target |
|---|---|
nvdriver.conf |
/etc/modprobe.d/nvdriver.conf |
90-nvdriver.conf |
/etc/dracut.conf.d/90-nvdriver.conf |
nodes.sh |
/etc/nvdriver/nodes.sh (mode 755) |
nvidia-modprobe.mask |
/etc/nvdriver/nvidia-modprobe.mask (mode 0644) |
nvdriver-nodes.service |
/etc/systemd/system/nvdriver-nodes.service |
99-nvdriver-nodes.rules |
/etc/udev/rules.d/99-nvdriver-nodes.rules |
nvidia-modprobe.mask is empty on purpose: nodes.sh bind-mounts it over
/usr/bin/nvidia-modprobe to mask the tool, so only the file's inode serves as
the mount source and its content is never read.
Also set modules-load.d/nvdriver.conf to nvidia_rs, load-kmods = false in
/etc/nvidia-container-runtime/config.toml, then dracut -f and reboot.
If your host runs a newer 580.x userspace (e.g. 580.196.07 instead of the
default 580.178.04), add driver_version=580.196.07 to the options nvidia_rs
line in nvdriver.conf so NVML/libcuda version checks match without recompiling.
nodes.sh symlinks the Rust misc devices under the names unmodified libcuda and
NVML expect, exposes a readable /sys/module/{nvidia,nvidia_uvm}/initstate
through a staged sysfs cover, and starts with a takeover guard: if something
else (the stock module) owns the GPU it unloads it, reloads nvidia_rs and
binds the card. The cover affects all kmod users, including lsmod, modprobe,
mkinitcpio and dracut, not just NVIDIA commands. It preserves the entries
present when nodes.sh runs, but modules loaded later are absent until the
cover is refreshed. The file/directory staging fix does not remove that
snapshot limitation (see #62).
Remove the compatibility mounts before module maintenance
Before reverting to the stock driver or rebuilding its initramfs, stop CUDA
workloads and ensure nodes.sh is not running or being restarted by its udev
rule/service. Remove the cover and the underlying staging mounts; removing
only /sys/module leaves the per-entry binds and the nvidia-modprobe mask.
sudo bash -eu <<'SH'
if [ -e /sys/module/.nvdriver-cover ]; then
umount -R /sys/module
fi
for target in /run/nvdriver-stage/sysmodule/*; do
if mountpoint -q "$target"; then
umount -R "$target"
fi
done
if mountpoint -q /run/nvdriver-stage/sysfs; then
umount -R /run/nvdriver-stage/sysfs
fi
if mountpoint -q /usr/bin/nvidia-modprobe; then
# Do not remove an unrelated mount over this path.
if [ ! /etc/nvdriver/nvidia-modprobe.mask -ef /usr/bin/nvidia-modprobe ]; then
echo "nvidia-modprobe has an unexpected mount; inspect it before continuing" >&2
exit 1
fi
umount /usr/bin/nvidia-modprobe
fi
SH
Any unmount failure stops the sequence: resolve busy mounts before continuing.
This removes compatibility mounts only; it does not unload a module, rebind a
GPU, remove device aliases, or uninstall the boot configuration above. Before
rebuilding the initramfs for a stock-driver boot, revert those configuration
files as appropriate for your installation. Run dracut -f (or the distro's
initramfs command) after the mounts are removed, so it sees the real module
state and unmasked nvidia-modprobe.