#1014455 systemd-boot: kernel postrm hook runs twice on purge

Package:
systemd-boot
Source:
systemd
Description:
simple UEFI boot manager - tools and services
Submitter:
Andrea Pappacoda
Date:
2022-07-07 17:57:03 UTC
Severity:
normal
#1014455#5
Date:
2022-07-06 12:42:59 UTC
From:
To:
Hi, I just noticed that when purging an installed kernel, the
/etc/kernel/postrm.d/systemd-boot hook runs twice; here's an example:

    # apt purge linux-image-5.17.0-1-amd64
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following packages will be REMOVED:
      linux-image-5.17.0-1-amd64*
    0 upgraded, 0 newly installed, 1 to remove and 37 not upgraded.
    After this operation, 454 MB disk space will be freed.
    Do you want to continue? [Y/n]
    (Reading database ... 221345 files and directories currently installed.)
    Removing linux-image-5.17.0-1-amd64 (5.17.3-1) ...
    I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.18.0-2-amd64
    I: /initrd.img.old is now a symlink to boot/initrd.img-5.18.0-2-amd64
    /etc/kernel/postrm.d/initramfs-tools:
    update-initramfs: Deleting /boot/initrd.img-5.17.0-1-amd64
    /etc/kernel/postrm.d/systemd-boot:
    Removing kernel version 5.17.0-1-amd64 from systemd-boot...
    (Reading database ... 216472 files and directories currently installed.)
    Purging configuration files for linux-image-5.17.0-1-amd64 (5.17.3-1) ...
    /etc/kernel/postrm.d/systemd-boot:
    Removing kernel version 5.17.0-1-amd64 from systemd-boot...

I don't personally know well enough how these scripts are invoked and I can't
propose a solution, but the scripts suggested by Andre and Sam in bug #826045
seem to not have this issue.

#1014455#10
Date:
2022-07-06 12:48:21 UTC
From:
To:
Am 06.07.22 um 14:42 schrieb Andrea Pappacoda:

See https://salsa.debian.org/systemd-team/systemd/-/merge_requests/155

#1014455#15
Date:
2022-07-06 13:01:50 UTC
From:
To:
Am 06.07.22 um 14:48 schrieb Michael Biebl:

Please send updates/improvements to those kernel/initramfs hooks as
merge requests on salsa.

Thanks

#1014455#20
Date:
2022-07-07 17:02:59 UTC
From:
To:
Il giorno mer 6 lug 2022 alle 14:48:21 +02:00:00, Michael Biebl
<biebl@debian.org> ha scritto:

I know about that merge request, I'm the one who submitted it :)

Apart from copying what the initramfs-tools hook does I don't know how
to properly fix this.

#1014455#25
Date:
2022-07-07 17:53:10 UTC
From:
To:
Am 07.07.22 um 19:02 schrieb Andrea Pappacoda:

Sure, I know that :-) I posted the URL as cross reference