OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
pacman-aur critical very-common DISPUTE

DKMS module fails to build during a kernel upgrade, leaving a kernel with no working module

archomarchyendeavouroscachyosmanjarodesktoplaptop
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

Checked on this Omarchy 4 workstation (linux 7.1.9.arch1-2, linux-headers 7.1.9.arch1-2, no linux-lts, dkms 3.4.3-2, kernel-modules-hook 0.1.7-3, nvidia-open-dkms 610.57.04-1, limine-mkinitcpio-hook 1.37.1-1) and against install/hardware/nvidia.sh and install/omarchy-base.packages fetched from quattro. What held: DKMS builds against /usr/lib/modules/<kver>/build, which pacman -Qo shows is owned by linux-headers here. The make.log path holds because nvidia-open-dkms registers the module as plain nvidia (dkms status prints nvidia/610.57.04, 7.1.9-arch1-2, x86_64: installed, and /usr/src holds nvidia-610.57.04). The hook text Install DKMS modules and the dkms install --no-depmod <mod>/<ver> -k <kver> line match /usr/share/libalpm/hooks/70-dkms-install.hook and line 150 of /usr/share/libalpm/scripts/dkms. The linux-lts module directory really ends in -lts (6.18.49-3-lts per the package file list), so the basename glob in step 6 works. The stale-toolchain cause and the -fmin-function-alignment error are exactly what BBS thread 295952 shows, with /opt/cuda/bin/gcc from a .zshenv PATH export. What was wrong: nvidia-dkms no longer exists in the Arch repos (the package page 404s and the search API returns nothing), so both the cause and the danger named a package nobody can install. Omarchy installs nvidia-open-dkms for GSP cards and nvidia-580xx-dkms from its own [omarchy] repo for older ones, never nvidia-open. dkms 3.4.3 autoinstall with no -k acts on the running kernel only (kernelver[0]=$(uname -r) at line 413 of /usr/bin/dkms and have_one_kernel rejects a second -k), so the previous audit note claiming it iterates every kernel was wrong and the per-kernel loop in step 3 is required, not redundant. Omarchy 4 installs linux-headers alongside linux (install/omarchy-other.packages) and nvidia.sh adds the -headers package matching whichever of linux, linux-zen, linux-lts, linux-hardened, linux-t2 or linux-ptl it finds, so on Omarchy the missing-headers cause only applies to a kernel the user added later. Omarchy 4 installs kernel-modules-hook (line 66 of /usr/share/omarchy/install/omarchy-base.packages, same file on quattro), whose 10-linux-modules-pre and -post hooks keep the running kernel's module tree through the transaction, which is why an in-place reload can work on Omarchy and not on plain Arch, consistent with the 2026-09-06 correction to nvidia-modules-missing-from-initramfs-black-screen. sudo mkinitcpio -P cannot work on Omarchy 4: /etc/mkinitcpio.d is empty here, so /usr/bin/mkinitcpio stops with No presets found, and the /usr/local/bin/mkinitcpio wrapper that limine-mkinitcpio-hook installs only prints a warning offering limine-mkinitcpio. The record's limine-mkinitcpio && limine-update pair is redundant: /usr/bin/limine-update runs limine-install and then limine-mkinitcpio itself, and limine-mkinitcpio-install already adds the entry with limine-entry-tool --add-uki, so the UKI got built twice. The after-reboot symptom also differed on Omarchy with NVIDIA: nvidia.sh puts the four nvidia modules in MODULES, mkinitcpio then exits non-zero, limine-mkinitcpio-install prints mkinitcpio failed for kernel ..., skipping and leaves the old UKI in place, so a reboot lands on the old kernel with a driver and userspace mismatch (the other record) rather than the module not found line, which only appears for modules outside MODULES such as vboxdrv and on plain Arch. NOT exercised: no DKMS failure was induced, nothing was rebuilt or rebooted, and dkms autoinstall was not run. The kernel-modules-hook behaviour is read from the hook files, not observed during an upgrade.

The cause above was rewritten on 2026-09-07 to match this note; the fix was corrected by the audit itself.
RISK

Rebooting with a failed DKMS build on an NVIDIA-only machine gives you a black screen or a bare text console with no compositor, and no network manager GUI to fetch a fix with. On Omarchy 4 do not reboot while the update transcript says mkinitcpio failed for kernel ..., skipping.: the UKI on the ESP is stale and the reboot lands on the old kernel with a mismatched nvidia-utils. Keep linux-lts + linux-lts-headers installed and selectable in the boot menu before you reboot. Never try to fix this with pacman -Sy nvidia-open-dkms: a -Sy without -u creates a partial upgrade and makes it strictly worse. Always do a full upgrade (omarchy update on Omarchy, pacman -Syu on Arch). Do not delete /var/lib/dkms to "start clean": that loses the build state for every module including ones that currently work.

Symptom

During omarchy update (Omarchy 4) or pacman -Syu (plain Arch):


(3/9) Install DKMS modules
==> dkms install --no-depmod nvidia/580.95.05 -k 7.1.10-arch1-1
Error! Bad return status for module build on kernel: 7.1.10-arch1-1 (x86_64)
Consult /var/lib/dkms/nvidia/580.95.05/build/make.log for more information.
error: command failed to execute correctly

pacman still exits 0 and omarchy update carries on as if nothing happened.

After rebooting on plain Arch, or on Omarchy 4 for a module that is not early-loaded (VirtualBox, tuxedo, yt6801): no graphical session, or


modprobe: FATAL: Module nvidia not found in directory /lib/modules/7.1.10-arch1-1

VirtualBox users see: Kernel driver not installed (rc=-1908).

On Omarchy 4 with NVIDIA the transcript continues with ==> ERROR: module not found: 'nvidia' (four times) and mkinitcpio failed for kernel 7.1.10-arch1-1, skipping., the boot image on the ESP is never replaced, and a reboot lands on the OLD kernel with a NEW nvidia-utils: black screen or an SDDM login loop instead of the modprobe error. That path is the record nvidia-modules-missing-from-initramfs-black-screen.

Cause

Two distinct causes.

**(a) Missing or mismatched headers.** DKMS builds against /usr/lib/modules/<kernelver>/build, which the *matching* headers package owns (pacman -Qo /usr/lib/modules/$(uname -r)/build reports linux-headers). If you run linux-lts but only have linux-headers and not linux-lts-headers, DKMS has nothing to compile against for that kernel. On Omarchy 4 this only happens for a kernel you added yourself: the installer puts linux-headers next to linux, and install/hardware/nvidia.sh adds the -headers package matching whichever of linux, linux-zen, linux-lts, linux-hardened, linux-t2 or linux-ptl it finds. On plain Arch nothing installs headers for you.

**(b) The out-of-tree source genuinely does not compile against the new kernel.** Common with the NVIDIA driver on a freshly released mainline kernel. The Arch package is nvidia-open-dkms (nvidia-dkms no longer exists in the repos, nvidia-open-dkms provides that name), and Omarchy installs nvidia-open-dkms for GSP-capable cards or nvidia-580xx-dkms from its own [omarchy] repo for older ones. Both register the DKMS module as plain nvidia, so the log is /var/lib/dkms/nvidia/<version>/build/make.log. The other variant of (b) is a stale toolchain earlier in PATH (classically /opt/cuda/bin supplying an old gcc) being picked up instead of the system gcc, producing errors like gcc: error: unrecognized command-line option '-fmin-function-alignment=16'.

Two Omarchy 4 details change what you see afterwards. Omarchy installs kernel-modules-hook, whose pacman hooks save the running kernel's module tree before the transaction and restore it after, so the kernel you are on keeps its modules and you can still modprobe while you repair. And on an NVIDIA machine the four nvidia modules are in MODULES via /etc/mkinitcpio.conf.d/nvidia.conf, so when the build fails mkinitcpio errors, limine-mkinitcpio-install skips installing the new UKI, and the boot image on the ESP stays at the old kernel.

Fix

**1. See what you actually have:**


pacman -Q linux linux-lts linux-zen 2>/dev/null
pacman -Q linux-headers linux-lts-headers linux-zen-headers 2>/dev/null
dkms status
uname -r
ls /usr/lib/modules/

dkms status prints one line per module and kernel, nvidia/580.95.05, 7.1.10-arch1-1, x86_64: installed, and must say installed for **every** kernel version present in /usr/lib/modules.

**2. Install one headers package per installed kernel** (the fix in the majority of cases on plain Arch, and for any second kernel you added on Omarchy 4):


sudo pacman -S --needed linux-headers
# add these only for kernels you actually have:
# sudo pacman -S --needed linux-lts-headers linux-zen-headers

This passes Omarchy's pacman guard, which only stops commands carrying both -S and -u. Installing headers also fires the DKMS pacman hook, so the module may already be rebuilt when this returns.

**3. Rebuild for every installed kernel.** dkms autoinstall with no -k only builds for the kernel you are running (dkms 3.x), so the new kernel needs its own call:


sudo dkms autoinstall                       # running kernel
for d in /usr/lib/modules/*/; do
  kver=$(basename "$d")
  [ -d "$d/build" ] && sudo dkms autoinstall -k "$kver"
done
dkms status

**4. If it still fails, read the real compiler error.** The pacman output only points at it:


dkms status                                  # gives you <module>/<version>
sudo tail -n 80 /var/lib/dkms/nvidia/*/build/make.log     # substitute your module

**5. Stale compiler in PATH** (the unrecognized command-line option class):


gcc --version                # must be the system gcc, not a CUDA/toolchain copy
sudo env -i PATH=/usr/bin:/usr/sbin HOME=/root dkms autoinstall

Remove the offending export PATH="/opt/cuda/bin:$PATH" from ~/.bashrc / ~/.zshenv and re-run.

**6. If upstream is simply not compatible with the new kernel yet, sit on LTS until it is:**


sudo pacman -S --needed linux-lts linux-lts-headers
sudo dkms autoinstall -k "$(basename /usr/lib/modules/*-lts)"

On Omarchy 4 installing linux-lts already runs the DKMS hook and then the Limine hook, which builds a UKI for it and adds a boot entry. Run step 7 anyway so you have read the output yourself.

**7. Rebuild the boot image last**, so the freshly built module actually gets bundled:


# Omarchy 4 (Limine + UKI): the wrapper builds the UKI and updates the Limine entry
sudo limine-mkinitcpio

# plain Arch with a normal initramfs:
sudo mkinitcpio -P

Do not use mkinitcpio -P on Omarchy 4: /etc/mkinitcpio.d is empty there, so it stops with No presets found and the UKI on the ESP is never replaced. limine-update is not needed after limine-mkinitcpio, it just reinstalls the bootloader and runs limine-mkinitcpio a second time. The output must contain no module not found: lines and no mkinitcpio failed for kernel ..., skipping. before you reboot.

Verify

dkms status shows installed for the running kernel *and* every other kernel in /usr/lib/modules. modinfo nvidia | head -3 (or modinfo vboxdrv) resolves without error. After reboot lsmod | grep -E 'nvidia|vboxdrv' is non-empty and nvidia-smi prints a driver version.

Sources

dkms-module-build-fails-on-kernel-upgrade