From 99f10f9380ccebfdf9bd1758464f24d449323cc3 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 1 Aug 2022 12:56:10 +1000 Subject: [PATCH] rockylinux : create machine-id early Somewhere between the upstream container rockylinux/rockylinux:8.6.20220515 and the latest release, systemd started to be pre-installed in the container. With <= 20220515 installing the kernel-core package would end up pulling in systemd. As part of the systemd package installation, the /etc/machine-id file is created and populated. The kernel package post-install steps install the kernel with /bin/kernel-install; this is responsible for copying the kernel binaries into /boot. It does this based on the machine-id, and it seems its failure case with a blank machine-id is to simply skip copying the kernels into /boot. To compound this problem, it seems our bootloader installation doesn't notice that we don't have a kernel installed, so we end up building an unbootable image. Testing is/was showing us this; but as rocky is non-voting and this occured at a random time (rather than in response to a dib change) I think it slipped by us. To work around this, create the machine-id early in the container. We already have paths that remove the machine-id from final images. Change-Id: I07e8262102d4e76c861667a98ded9fc3f4f4b82d --- diskimage_builder/elements/rocky-container/containerfiles/8 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/diskimage_builder/elements/rocky-container/containerfiles/8 b/diskimage_builder/elements/rocky-container/containerfiles/8 index e619137f..d3dd68e8 100644 --- a/diskimage_builder/elements/rocky-container/containerfiles/8 +++ b/diskimage_builder/elements/rocky-container/containerfiles/8 @@ -5,3 +5,8 @@ RUN dnf install -y findutils util-linux sudo python3 NetworkManager RUN systemctl unmask console-getty.service dev-hugepages.mount \ getty.target sys-fs-fuse-connections.mount systemd-logind.service \ systemd-remount-fs.service + +# /etc/machine-id needs to be populated for /bin/kernel-install to +# correctly copy kernels into /boot. We will clear this out in the +# final image. +RUN systemd-machine-id-setup