commit:     85eb36a4316ea1b462f0dc855a42f3bf5287b821
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 11 07:36:58 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Mon Dec 11 12:39:34 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85eb36a4

kernel-install.eclass: fix test phase on systemd systems

On systemd systems the dracut systemd modules are included automatically.
Systemd insists our dummy root has some valid /etc/os-release file, otherwise
it refuses the switch root operation. However, with this fix it still does not
boot up correctly on systemd systems, it gets stuck in an infinite boot loop.
Presumably the reason has something to do with our dummy root not having a real
systemd init to switch root to. We add the systemd dracut modules to the omit
list to prevent the problem and ensure the test phase behaves the same on
systemd and non-systemd systems.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 eclass/kernel-install.eclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index b4d84f3986c0..22d8ce200016 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -231,6 +231,8 @@ kernel-install_create_qemu_image() {
        # some layout needed to pass dracut's usable_root() validation
        mkdir -p "${imageroot}"/{bin,dev,etc,lib,proc,root,sbin,sys} || die
        touch "${imageroot}/lib/ld-fake.so" || die
+       # Initrd images with systemd require some os-release file
+       cp "${BROOT}/etc/os-release" "${imageroot}/etc/os-release" || die
 
        kernel-install_create_init "${imageroot}/sbin/init"
 
@@ -263,6 +265,7 @@ kernel-install_test() {
                plymouth # hangs, or sometimes steals output
                rngd # hangs or segfaults sometimes
                i18n # copies all the fonts from /usr/share/consolefonts
+               dracut-systemd systemd systemd-initrd # gets stuck in boot loop
        )
 
        # NB: if you pass a path that does not exist or is not a regular

Reply via email to