Neither package put gpu_unlock into the initramfs when it was installed: the RPM only ran dkms add, so the module was not even built until the next boot or kernel update, and the Debian package built it but never ran update-initramfs. Removing either left the module in the images. RPM: - %posttrans builds the module for every kernel that has headers, not just the running one (a kernel updated but not yet booted, or a chroot), and installs it with a single dkms call. Fedora's and EPEL's dkms then regenerate the images through post_transaction; without that, dracut rebuilds the images of the kernels that can load it. - %postun rebuilds every image that still carries gpu_unlock: dkms remove regenerates them while the dracut drop-in is still installed. - %preun now also removes the DKMS entry on upgrade (--rpm_safe_upgrade keeps a same-version one), and %post drops entries that older packages left behind. - dkms.conf sets NO_WEAK_MODULES: RHEL's weak-modules cross-linked one kernel's build into the others, and on removal left dangling links that made dracut fail for those kernels. %postun removes any link a kernel package's weak-modules run still created. Debian: postinst and postrm run update-initramfs -u -k all. Tested in AlmaLinux 10.2 containers with three kernels (fresh install, 1.0.0-1 to 1.0.0-2 and to 1.0.1 upgrades, removal, post_transaction disabled) and in Debian trixie (install, reinstall, removal). Supersedes #8, which reported the RPM half of this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 lines
234 B
Bash
11 lines
234 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
#DEBHELPER#
|
|
|
|
# Drop gpu_unlock from every initramfs now that the module and the
|
|
# initramfs-tools drop-in are gone.
|
|
if [ "$1" = remove ] && command -v update-initramfs >/dev/null; then
|
|
update-initramfs -u -k all
|
|
fi
|