Bug#1014581: systemd-boot: kernel hook schould use conforming name

Victor Westerhuis victor at westerhu.is
Sun Aug 28 12:18:55 BST 2022


On Tue, 19 Jul 2022 21:29:06 +0200 Michael Biebl <biebl at debian.org> wrote:
> Am 12.07.22 um 18:16 schrieb Michael Biebl:
> > Control: tags -1 + moreinfo
> > 
> > Am 08.07.22 um 11:14 schrieb Norbert Lange:
> >> Package: systemd-boot
> >> Version: 251.2-7
> >> Severity: normal
> >> X-Debbugs-Cc: nolange79 at gmail.com
> >>
> >> Dear Maintainer,
> >>
> >> The kernel hook in /etc/kernel/{post,pre}inst.d should
> >> be named correctly, to quote the kernel-handbook [1]:
> >>
> >>>    hook scripts for boot loaders must be named using
> >>      the prefix zz- and no other packages may use this prefix
> >>
> >> so zz-systemd-boot whould be correct.
> > 
> > This looks super ugly :-/
> > At the very least they should have picked numerical prefixes...
> > 
> > That said, why does the kernel hook need to run late/last? I.e., does 
> > this actually cause any real issues? If so, can you elaborate.
> > 
> 
> I looked into this a bit more and it is still not obvious/clear to me, 
> why the kernel hook for systemd needs to use the zz prefix (i.e. run 
> late/last). The systemd kernel hook copies the vmlinux-* binary to 
> /boot/efi, but this file is available once the linux-image-* package has 
> been unpacked.
> 
> That said, I could understand if the initramfs hook needs to run last, 
> i.e. /etc/initramfs/post-update.d/systemd-boot. As this hook will copy 
> the initrd to /boot/efi and initramfs hooks *do* modify the initrd image.
> The kernel handbook doesn't mention anything in that regard though, so 
> it seems to be incomplete/wrong for the purposes of systemd-boot?
I recently switched from initramfs-tools to tiny-initramfs to generate 
my initramfs. update-tirfs, contrary to the policy, does not run the 
hooks in /etc/initramfs/post-update.d. However, at least when a kernel 
is being installed, updated or removed these hooks are allowed to skip 
doing any work anyway, according to section 8.5 of the Debian kernel 
handbook.

This means that only step 3, running the hooks in 
/etc/kernel/post{inst,rm}.d are required to do anything.

The issue is that tiny-initramfs sorts after systemd-boot, so the initrd 
is only generated after systemd-boot has tried to copy it already, 
leading to a missing initrd on the first try.

I've solved the issue locally by moving systemd-boot's 
/etc/kernel/post{inst,rm}.d hooks to the name prescribed by policy.

I will also file a corresponding bug (with patch) against tiny-initramfs 
to fix the running of the hooks in /etc/initramfs/post-update.d.
> 
> 
> I'm reluctant to blindly change anything without understanding why.
> So would welcome further input from someone who is familiar with that topic.
> 
> Regards,
> Michael
> 
> 
Regards,
-- 
Victor Westerhuis <victor at westerhu.is>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20220828/3488ad6c/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list