[WIP] Work In Progress
- The issue is often related to the NVIDIA driver and its interaction with the kernel. Our howto-page Kernel Problems covers this basic case.
- Ensure you can reach a TTY: try Ctrl+Alt+F2 (or F3–F6) if the GUI won’t load.
- This is available in Gist form at https://gist.github.com/flipphillips/258a6fdb034be4729b387a31803967c6
NVIDIA DKMS Driver Installation & Fix Guide for Rocky Linux 9
A complete, production-ready guide to installing and configuring NVIDIA DKMS (kmod-nvidia-latest-dkms) on Rocky Linux 9.
This guide resolves the common blinking cursor (_), Secure Boot module rejection, GDM black screen, and nvidia-persistenced failure issues.
1. Access TTY / Console (If Stuck at Blinking Cursor)
If your system is currently stuck at a black screen with a blinking cursor: 1. Press Ctrl + Alt + F3 (or F4 / F5) to open a virtual console. 2. Log in with your credentials.
2. Clean Up Conflicting / Previous Drivers
Remove any manual .run installations or leftover repository packages:
sudo nvidia-uninstall 2>/dev/null
sudo dnf remove -y "*nvidia*" "*cuda*"3. Enable Required Repositories & Build Tools
Enable EPEL, CRB (CodeReady Builder), and the official NVIDIA CUDA repository:
sudo dnf install -y epel-release
sudo crb enable
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repoInstall DKMS, compilers, and kernel headers matching your running kernel:
sudo dnf install -y dkms gcc make kernel-devel-$(uname -r) kernel-headers-$(uname -r) openssl mokutil4. Configure Secure Boot MOK Signing (If Secure Boot is Enabled)
Rocky Linux 9 blocks unsigned kernel modules under Secure Boot. If Secure Boot is enabled (mokutil --sb-state), configure a Machine Owner Key (MOK) so DKMS automatically signs the driver:
# 1. Create key directory and generate MOK key pair
sudo mkdir -p /var/lib/dkms/mok
cd /var/lib/dkms/mok
sudo openssl req -new -x509 -newkey rsa:2048 \
-keyout MOK.priv -outform DER -out MOK.der \
-nodes -days 36500 \
-subj "/CN=Rocky NVIDIA Driver Key/"
sudo chmod 600 MOK.priv
# 2. Import MOK key into UEFI (set a temporary password you will remember on reboot)
sudo mokutil --import /var/lib/dkms/mok/MOK.der
# 3. Configure DKMS to automatically sign every future kernel rebuild
sudo tee -a /etc/dkms/framework.conf << 'EOF'
mok_signing_key=/var/lib/dkms/mok/MOK.priv
mok_certificate=/var/lib/dkms/mok/MOK.der
EOF5. Install NVIDIA DKMS Drivers
Install via the DNF module stream to ensure all service users, udev rules, and persistence units are properly configured:
sudo dnf module reset nvidia-driver -y
sudo dnf module enable -y nvidia-driver:latest-dkms
sudo dnf install -y nvidia-driver nvidia-driver-cuda kmod-nvidia-latest-dkmsNote for Pascal/GTX 10xx or older GPUs: Use
nvidia-driver:latest-dkms(proprietary). Do NOT use open-kernel modules (nvidia-driver:latest-dkms-open) on pre-Turing architectures.
6. Blacklist Nouveau & Enable DRM Modesetting
Modern GNOME/GDM on Rocky 9 requires Kernel Mode Setting (nvidia-drm.modeset=1). Use grubby to safely append these parameters to all kernel boot entries:
# 1. Modprobe blacklist
echo -e "blacklist nouveau\noptions nouveau modeset=0" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
# 2. Kernel command line parameters (using grubby for safe Rocky 9 / UEFI compatibility)
sudo grubby --update-kernel=ALL --args="rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1"
# 3. Rebuild Initramfs
sudo dracut --regenerate-all --force7. Fix GDM / Wayland Incompatibility (Recommended)
Wayland sessions with proprietary NVIDIA drivers frequently stall GDM at a black screen on Rocky 9. Force GDM to use X11:
sudo sed -i 's/^#WaylandEnable=false/WaylandEnable=false/' /etc/gdm/custom.conf8. Enable NVIDIA Persistence Daemon & Power Services
Ensure the persistence daemon and system power services start automatically at boot:
# Ensure runtime directory and user exist
id nvidia-persistenced &>/dev/null || sudo useradd -r -M -d /var/run/nvidia-persistenced -s /sbin/nologin -c "NVIDIA Persistence Daemon" nvidia-persistenced
sudo mkdir -p /var/run/nvidia-persistenced
sudo chown -R nvidia-persistenced:nvidia-persistenced /var/run/nvidia-persistenced
# Enable persistence and power management services
sudo systemctl enable nvidia-persistenced.service
sudo systemctl enable nvidia-suspend.service nvidia-hibernate.service nvidia-resume.service 2>/dev/null9. Sign Current Modules, Verify DKMS & Reboot
# Sign current modules if Secure Boot is active
SIGN_FILE="/usr/src/kernels/$(uname -r)/scripts/sign-file"
if [ -f "$SIGN_FILE" ] && [ -f "/var/lib/dkms/mok/MOK.priv" ]; then
for mod in $(find /lib/modules/$(uname -r)/extra /lib/modules/$(uname -r)/weak-updates -name "nvidia*.ko*" 2>/dev/null); do
echo "Signing $mod"
sudo $SIGN_FILE sha256 /var/lib/dkms/mok/MOK.priv /var/lib/dkms/mok/MOK.der "$mod"
done
sudo dracut -f
fi
# Check DKMS status
dkms status(Expected output: nvidia/<version>, <kernel-version>, x86_64: installed)
Reboot:
sudo reboot⚠️ Important: MokManager Screen on First Reboot
If Secure Boot is enabled, the blue MokManager screen will appear when the system restarts: 1. Press any key to enter MokManager. 2. Select Enroll MOK \(\rightarrow\) Continue \(\rightarrow\) Yes. 3. Enter the password you created in Step 4. 4. Select Reboot.
10. Verification After Boot
Once the system boots into the graphical desktop, verify the installation in a terminal:
# 1. Verify NVIDIA Driver & GPU status
nvidia-smi
# 2. Check persistence daemon status
systemctl status nvidia-persistenced.service
# 3. Check loaded kernel modules
lsmod | grep nvidia