Skip to content

Add deferred logic for BUILD_DEPENDS#587

Merged
scaronni merged 3 commits into
dkms-project:mainfrom
scaronni:main
May 8, 2026
Merged

Add deferred logic for BUILD_DEPENDS#587
scaronni merged 3 commits into
dkms-project:mainfrom
scaronni:main

Conversation

@scaronni
Copy link
Copy Markdown
Member

@scaronni scaronni commented May 7, 2026

Add deferred logic for BUILD_DEPENDS with multiple package upgrades (kernel, modules and dependent modules) when invoking autoinstall.

The issue

Practical issue in Ubuntu:

  1. Module with a dependency specified:
$ cat /usr/src/nvidia-fs-2.26.6/dkms.conf | grep BUILD_DEPENDS
BUILD_DEPENDS[0]="nvidia"
  1. A transaction involving an update of the kernel and the nvidia DKMS module at the same time:
Autoinstall on 6.14.0-1011-nvidia-64k succeeded for module(s) kernel-mft-dkms knem mlnx-ofed-kernel xpmem.
nvidia-fs/2.26.6 autoinstall failed due to missing dependencies: nvidia.

Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.
run-parts: /etc/kernel/header_postinst.d/dkms exited with return code 1
dpkg: error processing package linux-headers-6.14.0-1011-nvidia-64k (--configure):
 installed linux-headers-6.14.0-1011-nvidia-64k package post-installation script subprocess returned error exit status 1
  1. At the end of the upgrade, DKMS triggers a rebuild of nvidia-fs, which now succeeds because the nvidia module has now been built:
Autoinstall of module nvidia-fs/2.26.6 for kernel 6.14.0-1011-nvidia-64k (aarch64)
Building module(s).......... done.
Signing module /var/lib/dkms/nvidia-fs/2.26.6/build/nvidia-fs.ko
Found pre-existing /lib/modules/6.14.0-1011-nvidia-64k/ubuntu/nvidia-fs/nvidia-fs.ko.zst, archiving for uninstallation
Installing /lib/modules/6.14.0-1011-nvidia-64k/updates/dkms/nvidia-fs.ko.zst
Running depmod... done.

Autoinstall on 6.14.0-1011-nvidia-64k succeeded for module(s) iser isert kernel-mft-dkms knem mlnx-nfsrdma mlnx-nvme mlnx-ofed-kernel nvidia srp xpmem nvidia-fs.

But at this point, the initial failure causes the apt transaction to report a failure:

Errors were encountered while processing:
 linux-headers-6.14.0-1011-nvidia-64k
 linux-headers-nvidia-64k-6.14
 linux-nvidia-64k-6.14

Deferred logic for hard dependencies

autoinstall now distinguishes two kinds of unresolved BUILD_DEPENDS (taken from the comments in dkms.in):

  • "real" missing dependency:
    The dependency is a DKMS-managed module (in known_modules) that we tried but could not install (e.g. circular dependency, build failure of the dependency).

  • "deferred" missing dependency:
    The dependency is not registered with DKMS at all. This commonly happens during multi-package installs where the dependency's source package has not yet been configured by dpkg/rpm, so its postinst hasn't run dkms add yet. The dependency may also be supplied by something outside DKMS entirely. Either way, the current autoinstall run cannot make progress on it, but a later trigger (the dependency package's own postinst, or a re-run of this hook) will. Don't fail the whole transaction in that case.

By running dkms build directly, as it was before, exit 13 is still returned unless --force is used. The relaxation (the deferred logic) is only on the automated path where DKMS doesn't have full visibility into pending package operations.

@scaronni scaronni requested review from amilonenv, anbe42 and zeroepoch and removed request for zeroepoch May 7, 2026 07:28
@scaronni scaronni marked this pull request as ready for review May 7, 2026 07:47
@scaronni scaronni marked this pull request as draft May 7, 2026 12:56
@scaronni scaronni marked this pull request as ready for review May 7, 2026 14:46
@scaronni scaronni self-assigned this May 7, 2026
Copy link
Copy Markdown
Collaborator

@amilonenv amilonenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me.

Comment thread run_test.sh
@scaronni scaronni merged commit 603ebdc into dkms-project:main May 8, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants