#1051186 *-dkms packages shouldn't fail postinst if all modules to be installed already exist in identical versions

Package:
dkms
Source:
dkms
Submitter:
Andras Korn
Date:
2024-11-16 09:06:03 UTC
Severity:
normal
Tags:
#1051186#5
Date:
2023-09-04 05:54:48 UTC
From:
To:
Hi,

I have computers where I install both zfs-dkms and sometimes zfs-modules-<someversion> packages.

When zfs-modules-<someversion> is installed, zfs-dkms fails postinst:

[...]
zzstd.ko:
Running module version sanity check.
Module version 1.4.5a-2.1.12-2 for zzstd.ko
exactly matches what is already found in kernel 6.4.0-3-amd64.
DKMS will not replace this module.
You may override by specifying --force.
Error! Installation aborted.
dpkg: error processing package zfs-dkms (--configure):
 installed zfs-dkms package post-installation script subprocess returned error exit status 6

I think that when all modules to be installed exactly match the ones already in place, that shouldn't result in a failure.

In case you wonder why I'm doing this: these computers take forever to build kernel modules, so whenever possible, I install pre-built modules and want to keep dkms only as a failsafe, to make sure the zfs modules are in place before I reboot (because they're needed for booting).

I'm filing the bugreport against dkms because it contains these lines of code (around line 800):

        if [[ ! "$force" ]]; then
            # if the module has neither version nor srcversion/checksum, check the binary files instead
            local verinfo="$(get_module_verinfo "${dkms_module}")"
            if [[ "$(echo "$verinfo" | tr -d '[:space:]')" ]] || diff "${kernels_module}" "${dkms_module}" &>/dev/null; then
                echo $"Module version $(echo "$verinfo" | head -n 1) for $4${module_suffix}" >&2
                echo $"exactly matches what is already found in kernel $1." >&2
                echo $"DKMS will not replace this module." >&2
                echo $"You may override by specifying --force." >&2
                return 1
            fi
        fi

I believe that "return 1" should be a "return 0" because there is no failure. A binary with the exact same version and/or contents is already installed; that's exactly the outcome dkms was asked to achieve.

I'll file a separate bug against zfs-dkms asking to avoid building the module for kernels for which an appropriate zfs-modules-<version> package is installed.

András