Re: Better handle systemd-boot and installkernel changes in HB

Immolo <[email protected]> Sat, 8 Nov 2025 17:36:04 +0000
Newsgroups gmane.linux.gentoo.documentation
Message-ID <CAHfWF5mmYmkR36p9wGi0Uab-EVx48Kg9geYPWbzVt7Y=FVxa7w@mail.gmail.com>
--000000000000a34513064318bf33
Content-Type: text/plain; charset="UTF-8"

> I agree, this should not be required, if /etc/kernel/cmdline is present
>> then the check will pass.

> The path is also different for systemd kernel-install versus
installkernel.

Oh that explains why I originally read your chroot warning as vague before.

I'll update once we have agreed on how we want  it to look.

>>
>> Note I can live with us mentioning this suppression file but I just want
>> to be clear on why we're doing it.
>>
>>>   This gives systemd-boot a blank kernel cmdliine to use rather than
using the installcd's cmdine and gets around the
>>>   chroot check if the user
>>>>   decides to use ~ARCH.
>>>
>>>   For GRUB:
>>>
>>>     Create the following to pass chroot checks for
{{Package|sys-kernel/installkernel}}:
>>>        touch /etc/kernel/install.d/05-check-chroot.install
>>>
>> I'm not following this bit.. can't we just disable the check for grub
>> instead somehow?

> It is disabled for grub (or well it should be, that is how I intended
for this to work).

The disabled check is currently not working, So far confirmed by a user on
Reddit
and on my test VM.

As I didn't understand why your code isn't working yet, I opted to handle
this in the
cleanup pass (It's how we deal with major faults in telecoms and I just
noticed today
I apply this logic in Gentoo bugs I deem major.)

Kind regards,

immolo

On Sat, 8 Nov 2025 at 17:17, Nowa Ammerlaan <[email protected]> wrote:

> On 08/11/2025 00:51, Sam James wrote:
> > Nowa Ammerlaan <[email protected]> writes:
> >
> >> Hi all,
> >
> > [I've replied to immolo below as well. Let's please try not top-post as
> > it's hard to follow then.]
> >
> >>
> >> With regards to EFISTUB, I double checked that before and found that it
> actually does not use /proc during configuration.
> >> Uefi-mkconfig used to do that, but it no longer does precisely because
> folks were running into this problem.
> >>
> >> With regards to the Handbook, I'd just instruct users to configure the
> desired cmdline in /etc/kernel/cmdline instead of
> >> touching the file. Sd-boot features auto detection but that does not
> work for every setup and users will likely want to
> >> configure other options anyway. There should also really be no need to
> clean that file up afterwards since users will
> >> very likely want to make adjustments to the kernel cmdline after
> installation.
> >>
> >
> > I guess it depends on how floppym feels about the usefulness of the grub
> > autodetection. I don't know either way.
> >
> >> In general users should configure some cmdline (regardless of the used
> bootloader) before installing the kernel and
> >> rebooting. So perhaps there should be a whole separate section
> dedicated to configuring the cmdline for grub, sd-boot,
> >> kernel built-in, or via dracut.
> >>
> >
> > That might be a good solution in the end, yeah.
> >
> >> Best regards,
> >> Nowa
> >>
> >> On 7 November 2025 15:44:49 CET, Immolo <[email protected]>
> wrote:
> >>
> >>   H,
> >>
> >>   In my previous email I made some errors in my summary and the fix
> didn't not fully solve the issue for Gentoo. Thanks
> >>   to Nowa for being patient and explaining the parts I did not fully
> grasp.
> >>
> >>   The summary is now https://bugs.gentoo.org/965211 highlighted users
> were not understanding the current steps in the
> >>   Handbook to correctly setup systemd-boot and EFISTUB systems. In turn
> this caused a support queue issue for the same
> >>   task happening over and over. Gentoo has now added a chroot detection
> feature to sys-kernel/installkernel, which
> >>   helps identify when a user has fallen into this trap.
> >>
> >>   The HB needs an update that solves the issue for current stable users
> and how to deal with the chroot detection for ~
> >>   ARCH users.
> >>
> >>   My solution to this is as follows.
> >>
> >>   Part 1:
> >>
> >>   Add the following text and steps to
> https://wiki.gentoo.org/wiki/Handbook:Parts/Installation/Kernel
> >>
> >>   Add to both systemd-boot and EFSSTUB:
> >>
> >>     By default systemd-boot/EFISTUB will take the kernel cmdline from
> the system, which is less than ideal for an
> >>   install from live media.
> >>     To workaround this the following changes must be made:
> >>
> >>       touch /etc/kernel/cmdline
> >
> > OK.
> >
> >>       touch /etc/kernel/install.d/05-check-chroot.install
> >>
> >
> > Why is this bit needed? Should we tell people to touch /etc/cmdline
> > instead/as well?
>
> I agree, this should not be required, if /etc/kernel/cmdline is present
> then the check will pass.
>
> The path is also different for systemd kernel-install versus installkernel.
>
> >
> > Note I can live with us mentioning this suppression file but I just want
> > to be clear on why we're doing it.
> >
> >>   This gives systemd-boot a blank kernel cmdliine to use rather than
> using the installcd's cmdine and gets around the
> >>   chroot check if the user
> >>   decides to use ~ARCH.
> >>
> >>   For GRUB:
> >>
> >>     Create the following to pass chroot checks for
> {{Package|sys-kernel/installkernel}}:
> >>        touch /etc/kernel/install.d/05-check-chroot.install
> >
> > I'm not following this bit.. can't we just disable the check for grub
> > instead somehow?
>
> It is disabled for grub (or well it should be, that is how I intended
> for this to work).
>
> >
> > Does it make sense to tell users to always be doing this for grub?
> >
> >>
> >>   GRUB does not require any other tweaks which aren't already well
> explained in the HB so this is all that is needed.
> >>
> >>   A copy/paste can be found at
> https://wiki.gentoo.org/wiki/User:Immolo/Sandbox/Kernel-systemd-boot
> >>
> >>   Part 2 (Optional):
> >>
> >>   Clean up the changes made so the blank /etc/kernel/cmdline is removed
> and make Nowa's previous attempt easy to follow
> >>   at
> >>   https://wiki.gentoo.org/wiki/Handbook:AMD64/Blocks/Bootloader
> >>   I don't like the idea of keeping /etc/kernel/cmdline for any longer
> than
> >>   is required for the install. This resolves that issue, however I
> would like someone
> >>   else to check if it's the correct call.
> >>
> >
> > I think I could go either way on this.
> >
> > * Removing it: this means that once they are booted, we follow upstream
> >    behaviour.
> >
> > * Keeping the empty file: when users reenter a chroot later on for
> >    recovery or something, they may well completely forget about this
> >    problem if we've deleted the file. The problem we're solving here
> >    isn't just about new installs but also recovery...
> >
> >>   This can be both viewed and copied from
> https://wiki.gentoo.org/wiki/User:Immolo/Sandbox/Bootlloader-systemd-boot
> >>
> >>   These steps have now been confirmed as the fix by a user on Reddit,
> so all that is
> >>   required now is for Nowa to please give a quick once over and if she
> is happy
> >>   then this should be taken as the confirmed solution into the HB ASAP.
> >>
> >>   NOTE: Alpha and HPPA might need a second edit due to some wikicode
> quirks
> >>   I can only spot those when we make these changes though. (I'm 70%
> sure they will
> >>   be OK though.)
> >>
> >>   Kind regards,
> >>
> >>   immolo
> >> [...]
> >
> > thanks for working on this,
> > sam
>
>

--000000000000a34513064318bf33
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">&gt; I agree, this should not be required=
, if /etc/kernel/cmdline is present <br>&gt;&gt; then the check will pass.<=
br>
<br>&gt; The path is also different for systemd kernel-install versus insta=
llkernel.<span class=3D"gmail-im"></span></div><div dir=3D"ltr"><br></div><=
div>Oh that explains why I originally=C2=A0read=C2=A0your chroot warning as=
 vague before.</div><div><br></div><div>I&#39;ll update=C2=A0once we have a=
greed=C2=A0on how we want=C2=A0 it to look.</div><div dir=3D"ltr"><br><span=
 class=3D"gmail-im"></span></div><div dir=3D"ltr"><span class=3D"gmail-im">=
&gt;&gt; <br>&gt;&gt; Note I can live with us mentioning this suppression f=
ile but I just want<br>&gt;&gt; to be clear on why we&#39;re doing it.<br>&=
gt;&gt; <br>&gt;&gt;&gt;=C2=A0 =C2=A0This gives systemd-boot a blank kernel=
 cmdliine to use rather than using the installcd&#39;s cmdine and gets arou=
nd the<br>&gt;&gt;&gt;=C2=A0 =C2=A0chroot check if the user<br>&gt;&gt;&gt;=
&gt;=C2=A0 =C2=A0decides to use ~ARCH.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;=C2=
=A0 =C2=A0For GRUB:<br>&gt;&gt;&gt;<br>&gt;&gt;&gt;=C2=A0 =C2=A0 =C2=A0Crea=
te the following to pass chroot checks for {{Package|sys-kernel/installkern=
el}}:<br>&gt;&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 touch /etc/kernel/install.=
d/05-check-chroot.install<br>&gt;&gt;&gt; <br>&gt;&gt; I&#39;m not followin=
g this bit.. can&#39;t we just disable the check for grub<br>&gt;&gt; inste=
ad somehow?<br>
<br></span>&gt; It is disabled for grub (or well it should be, that is how =
I intended <br>for this to work).</div><div dir=3D"ltr"><br></div><div>The =
disabled check is currently not working, So far confirmed by a user on Redd=
it</div><div>and on my test VM.</div><div><br></div><div>As I didn&#39;t un=
derstand why your code isn&#39;t working yet, I opted to handle this in the=
</div><div>cleanup pass (It&#39;s how we deal with major faults in telecoms=
 and I just noticed today</div><div>I apply this logic in Gentoo bugs I dee=
m major.)=C2=A0 =C2=A0</div><div><br></div><div>Kind regards,</div><div><br=
></div><div>immolo</div><br><div class=3D"gmail_quote gmail_quote_container=
"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, 8 Nov 2025 at 17:17, Nowa A=
mmerlaan &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 08/11/202=
5 00:51, Sam James wrote:<br>
&gt; Nowa Ammerlaan &lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt; writes:<br>
&gt; <br>
&gt;&gt; Hi all,<br>
&gt; <br>
&gt; [I&#39;ve replied to immolo below as well. Let&#39;s please try not to=
p-post as<br>
&gt; it&#39;s hard to follow then.]<br>
&gt; <br>
&gt;&gt;<br>
&gt;&gt; With regards to EFISTUB, I double checked that before and found th=
at it actually does not use /proc during configuration.<br>
&gt;&gt; Uefi-mkconfig used to do that, but it no longer does precisely bec=
ause folks were running into this problem.<br>
&gt;&gt;<br>
&gt;&gt; With regards to the Handbook, I&#39;d just instruct users to confi=
gure the desired cmdline in /etc/kernel/cmdline instead of<br>
&gt;&gt; touching the file. Sd-boot features auto detection but that does n=
ot work for every setup and users will likely want to<br>
&gt;&gt; configure other options anyway. There should also really be no nee=
d to clean that file up afterwards since users will<br>
&gt;&gt; very likely want to make adjustments to the kernel cmdline after i=
nstallation.<br>
&gt;&gt;<br>
&gt; <br>
&gt; I guess it depends on how floppym feels about the usefulness of the gr=
ub<br>
&gt; autodetection. I don&#39;t know either way.<br>
&gt; <br>
&gt;&gt; In general users should configure some cmdline (regardless of the =
used bootloader) before installing the kernel and<br>
&gt;&gt; rebooting. So perhaps there should be a whole separate section ded=
icated to configuring the cmdline for grub, sd-boot,<br>
&gt;&gt; kernel built-in, or via dracut.<br>
&gt;&gt;<br>
&gt; <br>
&gt; That might be a good solution in the end, yeah.<br>
&gt; <br>
&gt;&gt; Best regards,<br>
&gt;&gt; Nowa<br>
&gt;&gt;<br>
&gt;&gt; On 7 November 2025 15:44:49 CET, Immolo &lt;<a href=3D"mailto:immo=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wr=
ote:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0H,<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0In my previous email I made some errors in my summary =
and the fix didn&#39;t not fully solve the issue for Gentoo. Thanks<br>
&gt;&gt;=C2=A0 =C2=A0to Nowa for being patient and explaining the parts I d=
id not fully grasp.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0The summary is now <a href=3D"https://bugs.gentoo.org/=
965211" rel=3D"noreferrer" target=3D"_blank">https://bugs.gentoo.org/965211=
</a> highlighted users were not understanding the current steps in the<br>
&gt;&gt;=C2=A0 =C2=A0Handbook to correctly setup systemd-boot and EFISTUB s=
ystems. In turn this caused a support queue issue for the same<br>
&gt;&gt;=C2=A0 =C2=A0task happening over and over. Gentoo has now added a c=
hroot detection feature to sys-kernel/installkernel, which<br>
&gt;&gt;=C2=A0 =C2=A0helps identify when a user has fallen into this trap.<=
br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0The HB needs an update that solves the issue for curre=
nt stable users and how to deal with the chroot detection for ~<br>
&gt;&gt;=C2=A0 =C2=A0ARCH users.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0My solution to this is as follows.<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0<br>
&gt;&gt;=C2=A0 =C2=A0Part 1:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0Add the following text and steps to <a href=3D"https:/=
/wiki.gentoo.org/wiki/Handbook:Parts/Installation/Kernel" rel=3D"noreferrer=
" target=3D"_blank">https://wiki.gentoo.org/wiki/Handbook:Parts/Installatio=
n/Kernel</a><br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0Add to both systemd-boot and EFSSTUB:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0By default systemd-boot/EFISTUB will take the k=
ernel cmdline from the system, which is less than ideal for an<br>
&gt;&gt;=C2=A0 =C2=A0install from live media.<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0To workaround this the following changes must b=
e made:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0touch /etc/kernel/cmdline<br>
&gt; <br>
&gt; OK.<br>
&gt; <br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0touch /etc/kernel/install.d/05-check-chr=
oot.install<br>
&gt;&gt;<br>
&gt; <br>
&gt; Why is this bit needed? Should we tell people to touch /etc/cmdline<br=
>
&gt; instead/as well?<br>
<br>
I agree, this should not be required, if /etc/kernel/cmdline is present <br=
>
then the check will pass.<br>
<br>
The path is also different for systemd kernel-install versus installkernel.=
<br>
<br>
&gt; <br>
&gt; Note I can live with us mentioning this suppression file but I just wa=
nt<br>
&gt; to be clear on why we&#39;re doing it.<br>
&gt; <br>
&gt;&gt;=C2=A0 =C2=A0This gives systemd-boot a blank kernel cmdliine to use=
 rather than using the installcd&#39;s cmdine and gets around the<br>
&gt;&gt;=C2=A0 =C2=A0chroot check if the user<br>
&gt;&gt;=C2=A0 =C2=A0decides to use ~ARCH.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0For GRUB:<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0Create the following to pass chroot checks for =
{{Package|sys-kernel/installkernel}}:<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 touch /etc/kernel/install.d/05-check-ch=
root.install<br>
&gt; <br>
&gt; I&#39;m not following this bit.. can&#39;t we just disable the check f=
or grub<br>
&gt; instead somehow?<br>
<br>
It is disabled for grub (or well it should be, that is how I intended <br>
for this to work).<br>
<br>
&gt; <br>
&gt; Does it make sense to tell users to always be doing this for grub?<br>
&gt; <br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0GRUB does not require any other tweaks which aren&#39;=
t already well explained in the HB so this is all that is needed.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0A copy/paste can be found at <a href=3D"https://wiki.g=
entoo.org/wiki/User:Immolo/Sandbox/Kernel-systemd-boot" rel=3D"noreferrer" =
target=3D"_blank">https://wiki.gentoo.org/wiki/User:Immolo/Sandbox/Kernel-s=
ystemd-boot</a><br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0Part 2 (Optional):<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0Clean up the changes made so the blank /etc/kernel/cmd=
line is removed and make Nowa&#39;s previous attempt easy to follow<br>
&gt;&gt;=C2=A0 =C2=A0at<br>
&gt;&gt;=C2=A0 =C2=A0<a href=3D"https://wiki.gentoo.org/wiki/Handbook:AMD64=
/Blocks/Bootloader" rel=3D"noreferrer" target=3D"_blank">https://wiki.gento=
o.org/wiki/Handbook:AMD64/Blocks/Bootloader</a><br>
&gt;&gt;=C2=A0 =C2=A0I don&#39;t like the idea of keeping /etc/kernel/cmdli=
ne for any longer than<br>
&gt;&gt;=C2=A0 =C2=A0is required for the install. This resolves that issue,=
 however I would like someone<br>
&gt;&gt;=C2=A0 =C2=A0else to check if it&#39;s the correct call.<br>
&gt;&gt;<br>
&gt; <br>
&gt; I think I could go either way on this.<br>
&gt; <br>
&gt; * Removing it: this means that once they are booted, we follow upstrea=
m<br>
&gt;=C2=A0 =C2=A0 behaviour.<br>
&gt; <br>
&gt; * Keeping the empty file: when users reenter a chroot later on for<br>
&gt;=C2=A0 =C2=A0 recovery or something, they may well completely forget ab=
out this<br>
&gt;=C2=A0 =C2=A0 problem if we&#39;ve deleted the file. The problem we&#39=
;re solving here<br>
&gt;=C2=A0 =C2=A0 isn&#39;t just about new installs but also recovery...<br=
>
&gt; <br>
&gt;&gt;=C2=A0 =C2=A0This can be both viewed and copied from <a href=3D"htt=
ps://wiki.gentoo.org/wiki/User:Immolo/Sandbox/Bootlloader-systemd-boot" rel=
=3D"noreferrer" target=3D"_blank">https://wiki.gentoo.org/wiki/User:Immolo/=
Sandbox/Bootlloader-systemd-boot</a><br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0These steps have now been confirmed as the fix by a us=
er on Reddit, so all that is<br>
&gt;&gt;=C2=A0 =C2=A0required now is for Nowa to please give a quick once o=
ver and if she is happy<br>
&gt;&gt;=C2=A0 =C2=A0then this should be taken as the confirmed solution in=
to the HB ASAP.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0NOTE: Alpha and HPPA might need a second edit due to s=
ome wikicode quirks<br>
&gt;&gt;=C2=A0 =C2=A0I can only spot those when we make these changes thoug=
h. (I&#39;m 70% sure they will<br>
&gt;&gt;=C2=A0 =C2=A0be OK though.)<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0Kind regards,<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 =C2=A0immolo<br>
&gt;&gt; [...]<br>
&gt; <br>
&gt; thanks for working on this,<br>
&gt; sam<br>
<br>
</blockquote></div></div>

--000000000000a34513064318bf33--