installkernel-systemd-boot will not install kernel file to /boot, if /boot/${MACHINE_ID} directory is not present.. this is handled by /usr/lib/kernel/install.d/00-entry-directory.install and it has a condition to just exit if the dir does not exist. so I think whenever we call installkernel, we should check if installkernel-systemd-boot is used and create machineid specific boot directory before calling install.
also /boot/loader/entries is not created if /boot/${MACHINE_ID} is not present as result of ^
I think if /etc/machine-id is not present it may be even appropriate to error out, because only dracut will install initrd to classical /boot location, and kernel will remain in /usr/src/<ver>
installkernel implementations are really supposed to be stand-alone, so I think it'd be best to either make installkernel-systemd-boot a wrapper that takes care of this or handle this at ebuild level. I think creating /boot/${MACHINE_ID} should be fine, given that the user probably choose installkernel-systemd-boot explicitly. Not sure about generating machine-id though.
*** Bug 795033 has been marked as a duplicate of this bug. ***
reading https://www.freedesktop.org/software/systemd/man/machine-id.html there are couple edge cases to handle, in case installation is done in a chroot, 1) file exists and set to "uninitialized" - idk how to handle that, machine-id is unknown. 2) file does not exist, or empty. should we defer to systemd to actually generate it? or we do it? systemd-machine-id-setup has --root option and can actually generate one, systemd does not have to be running to run that binary.
Let's maybe start with the generic idea that any env that doesn't work results in fatal error. Then consider what we can fix automatically.
here's how kernel-install solves it: # Reuse directory created without a machine ID present if it exists. if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then MACHINE_ID="Default" elif [[ -f /etc/machine-id ]]; then read MACHINE_ID < /etc/machine-id else MACHINE_ID="Default" fi pretty simple. so we should create 'Default' if hostid is unknown and it will be picked up by bootloader, and not leave system unbootable.
PR here https://github.com/gentoo/gentoo/pull/21195
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41da652a218b9413cb24174f03c812d04b138c9e commit 41da652a218b9413cb24174f03c812d04b138c9e Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2021-06-11 04:35:06 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2021-06-26 22:02:30 +0000 sys-kernel/installkernel-systemd-boot: bump, create machine-id dir add a plugin to create proper directory for kernels. without it /usr/lib/kernel/install.d/00-entry-directory.install will silently exit and kernel will not be installed at all. Closes: https://github.com/gentoo/gentoo/pull/21195 Closes: https://bugs.gentoo.org/794646 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> .../files/00-00machineid-directory.install | 28 +++++++++++++++++++++ .../installkernel-systemd-boot-1.ebuild | 29 ++++++++++++++++++++++ 2 files changed, 57 insertions(+)