Skip to content

Commit

Permalink
Use 'unbuild' instead of 'remove' in kernel prerm script
Browse files Browse the repository at this point in the history
When DKMS is invoked by the kernel_prerm.d_dkms script to remove modules
from a kernel that is being removed, it uses the DKMS 'remove' command.
If there are no other installations of the module, it will be removed
completely from DKMS.  That seems to be an undesirable side-effect and
predates the introduction of the DKMS 'unbuild' command which merely
undoes the 'install' and 'build' steps.

Change the script to use 'unbuild' instead of 'remove'.  Keep the echoed
message that says "dkms: removing: ..." because "dkms: unbuilding: ..."
may be confusing to the user.

I have tested it by removing a kernel with a module installed by DKMS
that was the only installed instance of the module.  Without the change,
the module was removed completely from DKMS.  With the change, the
module was removed from the kernel, but was not removed completely.  On
reinstalling the kernel, the module was rebuilt and reinstalled for the
kernel by DKMS.

This change was suggested by @RalfGoebel for issue dell#37 and might be
Debian-specific.

Link: dell#37 (comment)
Tested-by: Ian Abbott <[email protected]>
Signed-off-by: Ian Abbott <[email protected]>
  • Loading branch information
ian-abbott committed Sep 19, 2023
1 parent 029104f commit 4900ce3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel_prerm.d_dkms
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if command -v dkms > /dev/null; then
dkms status -k "$inst_kern" 2>/dev/null | while IFS=",:/ " read -r name vers _ arch status; do
[ "$status" = "installed" ] || continue
echo "dkms: removing: $name $vers ($inst_kern) ($arch)" >&2
dkms remove -m "$name" -v "$vers" -k "$inst_kern" -a "$arch"
dkms unbuild -m "$name" -v "$vers" -k "$inst_kern" -a "$arch"
done
fi

Expand Down

0 comments on commit 4900ce3

Please sign in to comment.