07 - 12 - 2024

Missing nvidia DKMS module after system update

I had few times situation when after system update had incorrect sequence. What I mean, it updated nvidia dkms module first and a few packages later kernel was updated. This lead to missing nividia DKMS module during boot, and in my case booting without X11...

The fix of this issue is very trivial, but might be useful for beginners.

(OPTIONAL) Remove previous build of the kernel module

┌─[22:08:58]─[root@sco]
└──> / $ >> /usr/sbin/dkms remove -m nvidia -v 337.25-10.1 --all --rpm_safe_upgrade
-------- Uninstall Beginning --------
Module:  nvidia
Version: 337.25-10.1
Kernel:  3.11.10-17-desktop (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
Removing any linked weak-modules

nvidia.ko:
 - Uninstallation
   - Deleting from: /lib/modules/3.11.10-17-desktop/updates/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.
depmod.............
Backing up initrd-3.11.10-17-desktop to /boot/initrd-3.11.10-17-desktop.old-dkms
Making new initrd-3.11.10-17-desktop

(If next boot fails, revert to initrd-3.11.10-17-desktop.old-dkms image)
mkinitrd..........

DKMS: uninstall completed.
------------------------------
Deleting module version: 337.25-10.1
completely from the DKMS tree.
------------------------------
Done.

Compile the module for the running kernel. if you want to use different kernel use -k switch

┌─[22:10:03]─[root@sco]
└──> / $ >> /usr/sbin/dkms build -m nvidia -v 337.25-10.1

Creating symlink /var/lib/dkms/nvidia/337.25-10.1/source ->
                 /usr/src/nvidia-337.25-10.1

DKMS: add completed.
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.11.10-17-desktop module KERNEL_UNAME=3.11.10-17-desktop...............
cleaning build area....
DKMS: build completed.

Install newly generated module. 

┌─[22:14:23]─[root@sco]
└──> / $ >> /usr/sbin/dkms autoinstall -m nvidia -v 337.25-10.1

nvidia:
Running module version sanity check.
 - Original module
 - No original module exists within this kernel
 - Installation
 - Installing to /lib/modules/3.11.10-17-desktop/updates/

Adding any weak-modules

Kernel image:   /boot/vmlinuz-3.11.10-11-desktop
Initrd image:   /boot/initrd-3.11.10-11-desktop
KMS drivers:     nvidia
Root device: UUID=eb32cae2-6d93-47aa-b8cf-a6c3d2ec9c29 (/dev/sdb2) (mounted on / as btrfs)
Resume device: /dev/disk/by-id/md-uuid-1126515b:6d79d2e8:d5223668:1a391b71 (/dev/md127)
Microcode: Adding Intel microcode 06-1a-05
Kernel Modules: thermal_sys thermal processor fan drm nvidia raid0 raid1 raid10 async_tx async_memcpy xor async_xor raid6_pq async_pq async_raid6_recov raid456 scsi_dh scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh_rdac libcrc32c zlib_deflate btrfs xhci-hcd hid-logitech-dj hid-holtek-kbd hid-lenovo-tpkbd hid-ortek hid-roccat hid-roccat-common hid-roccat-arvo hid-roccat-isku hid-samsung ohci-pci crc32c-intel 
Features:       acpi md intel_microcode kms plymouth block usb btrfs resume.userspace resume.kernel
depmod....
Backing up initrd-3.11.10-17-desktop to /boot/initrd-3.11.10-17-desktop.old-dkms
Making new initrd-3.11.10-17-desktop
(If next boot fails, revert to initrd-3.11.10-17-desktop.old-dkms image)
mkinitrd..........
DKMS: install completed.

Each command can use -k switch to specify kernel version. In example we could use: /usr/sbin/dkms autoinstall -m nvidia -v 337.25-10.1 -k 3.11.10-11-desktop