public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] kernel-install.eclass: fix test phase on systemd systems
@ 2023-12-11  7:43 Andrew Ammerlaan
  2023-12-11 11:11 ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Ammerlaan @ 2023-12-11  7:43 UTC (permalink / raw)
  To: gentoo-dev

Patch is part of https://github.com/gentoo/gentoo/pull/34024

Best regards,
Andrew

 From 03e17149eef9eba08f8c8bf32845c18106d32290 Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Date: Mon, 11 Dec 2023 08:36:58 +0100
Subject: [PATCH] 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@gentoo.org>
---
  eclass/kernel-install.eclass | 12 ++++++++++++
  1 file changed, 12 insertions(+)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index b4d84f3986c0d..f2a6ec75f2a88 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -231,6 +231,17 @@ 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
+	cat <<-EOT >> "${imageroot}/etc/os-release" || die
+	NAME=Gentoo
+	ID=gentoo
+	PRETTY_NAME="Gentoo Linux"
+	ANSI_COLOR="1;32"
+	HOME_URL="https://www.gentoo.org/"
+	SUPPORT_URL="https://www.gentoo.org/support/"
+	BUG_REPORT_URL="https://bugs.gentoo.org/"
+	VERSION_ID="dist-kernel testing"
+	EOT

  	kernel-install_create_init "${imageroot}/sbin/init"

@@ -263,6 +274,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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH] kernel-install.eclass: fix test phase on systemd systems
  2023-12-11  7:43 [gentoo-dev] [PATCH] kernel-install.eclass: fix test phase on systemd systems Andrew Ammerlaan
@ 2023-12-11 11:11 ` Michał Górny
  2023-12-11 11:22   ` [gentoo-dev] [PATCH v2] " Andrew Ammerlaan
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2023-12-11 11:11 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

On Mon, 2023-12-11 at 08:43 +0100, Andrew Ammerlaan wrote:
> Patch is part of https://github.com/gentoo/gentoo/pull/34024
> 
> Best regards,
> Andrew
> 
>  From 03e17149eef9eba08f8c8bf32845c18106d32290 Mon Sep 17 00:00:00 2001
> From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
> Date: Mon, 11 Dec 2023 08:36:58 +0100
> Subject: [PATCH] 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@gentoo.org>
> ---
>   eclass/kernel-install.eclass | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
> index b4d84f3986c0d..f2a6ec75f2a88 100644
> --- a/eclass/kernel-install.eclass
> +++ b/eclass/kernel-install.eclass
> @@ -231,6 +231,17 @@ 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
> +	cat <<-EOT >> "${imageroot}/etc/os-release" || die
> +	NAME=Gentoo
> +	ID=gentoo
> +	PRETTY_NAME="Gentoo Linux"
> +	ANSI_COLOR="1;32"
> +	HOME_URL="https://www.gentoo.org/"
> +	SUPPORT_URL="https://www.gentoo.org/support/"
> +	BUG_REPORT_URL="https://bugs.gentoo.org/"
> +	VERSION_ID="dist-kernel testing"
> +	EOT
> 

Can't we just copy it from host?

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH v2] kernel-install.eclass: fix test phase on systemd systems
  2023-12-11 11:11 ` Michał Górny
@ 2023-12-11 11:22   ` Andrew Ammerlaan
  2023-12-11 11:55     ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Ammerlaan @ 2023-12-11 11:22 UTC (permalink / raw)
  To: gentoo-dev

>> +	# Initrd images with systemd require some os-release file
>> +	cat <<-EOT >> "${imageroot}/etc/os-release" || die
>> +	NAME=Gentoo
>> +	ID=gentoo
>> +	PRETTY_NAME="Gentoo Linux"
>> +	ANSI_COLOR="1;32"
>> +	HOME_URL="https://www.gentoo.org/"
>> +	SUPPORT_URL="https://www.gentoo.org/support/"
>> +	BUG_REPORT_URL="https://bugs.gentoo.org/"
>> +	VERSION_ID="dist-kernel testing"
>> +	EOT
>>
> 
> Can't we just copy it from host?
> 
I guess we can, we would be assuming that the host has a valid one but 
this shouldn't be a problem since at least for systemd systems you can 
apparently not boot at all if it is not valid. v2:

 From 0a22dcc93c8ba16cdb450f2443ad256e56111d6e Mon Sep 17 00:00:00 2001
From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Date: Mon, 11 Dec 2023 08:36:58 +0100
Subject: [PATCH] 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@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 b4d84f3986c0d..e244f6d51a9cd 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 /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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH v2] kernel-install.eclass: fix test phase on systemd systems
  2023-12-11 11:22   ` [gentoo-dev] [PATCH v2] " Andrew Ammerlaan
@ 2023-12-11 11:55     ` Michał Górny
  0 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2023-12-11 11:55 UTC (permalink / raw)
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2894 bytes --]

On Mon, 2023-12-11 at 12:22 +0100, Andrew Ammerlaan wrote:
> > > +	# Initrd images with systemd require some os-release file
> > > +	cat <<-EOT >> "${imageroot}/etc/os-release" || die
> > > +	NAME=Gentoo
> > > +	ID=gentoo
> > > +	PRETTY_NAME="Gentoo Linux"
> > > +	ANSI_COLOR="1;32"
> > > +	HOME_URL="https://www.gentoo.org/"
> > > +	SUPPORT_URL="https://www.gentoo.org/support/"
> > > +	BUG_REPORT_URL="https://bugs.gentoo.org/"
> > > +	VERSION_ID="dist-kernel testing"
> > > +	EOT
> > > 
> > 
> > Can't we just copy it from host?
> > 
> I guess we can, we would be assuming that the host has a valid one but 
> this shouldn't be a problem since at least for systemd systems you can 
> apparently not boot at all if it is not valid. v2:
> 
>  From 0a22dcc93c8ba16cdb450f2443ad256e56111d6e Mon Sep 17 00:00:00 2001
> From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
> Date: Mon, 11 Dec 2023 08:36:58 +0100
> Subject: [PATCH] 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@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 b4d84f3986c0d..e244f6d51a9cd 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 /etc/os-release "${imageroot}/etc/os-release" || die

This should probably be BROOT.

> 
>   	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
> 
> 

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-11 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11  7:43 [gentoo-dev] [PATCH] kernel-install.eclass: fix test phase on systemd systems Andrew Ammerlaan
2023-12-11 11:11 ` Michał Górny
2023-12-11 11:22   ` [gentoo-dev] [PATCH v2] " Andrew Ammerlaan
2023-12-11 11:55     ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox