[systemd-devel] why is systemd-remount-fs.service needed in stage-2?

Arian Van Putten arian at wire.com
Sun May 3 21:03:53 UTC 2020


Hey list,

I'm in the process of experimenting with a systemd-based initrd.
However I have two questions concerning the boot process that came up
whilst reading the documentation.

If I understand "man 7 bootup" correctly so far  the initrd mounts /sysroot
based on either the root= kernel parameter or through gpt-auto-generator.
At this point /sysroot is mounted. However /sysroot/etc/fstab might have
additional entries that need to be mounted in the initrd (marked with
"x-initrd").
Next "initrd-parse-etc.service" gets triggered which runs fstab-generator
which then mounts all the entries marked with "x-initrd".
If "/usr" is in a separate partition; I would expect it to _need_ to be
marked "x-initrd" as you want /usr to be present as soon as you boot up the
system. And this causes the "sysroot-usr.mount" unit to be generated and
gets pulled in by "initrd-fs.target".

We're now ready to switch-root to the root-filesystem and move to stage-2.

In stage-2, in early boot.  "systemd-remount-fs.service" runs;  which
remounts / and /usr with the actual options in /etc/fstab.

Two questions about this:

1.  if sysroot-usr.mount already gets pulled in in the initrd by parsing
/sysroot/etc/fstab why do we need to remount /usr   in stage-2 with
"systemd-remount-fs.service"? Didn't we already parse the correct values
from fstab, and hence /usr is already guaranteed to be correctly mounted?

2. relatedly;  why cant after "initrd-parse-etc.service" is run
sysroot.mount  be retriggered with the new options parsed from
/sysroot/etc/fstab as well?  Then to me it sounds like
"systemd-remount-fs.service" is not needed at all for / and /usr. (though
maybe still for /sys and /proc)

My gut feeling the answer to this question is "not all initrd's use
systemd; so they might not parse /sysroot/etc/fstab so early we need to
account for that". Is that the case?

Kind regards,

Arian



-- 



*Zeta Project Germany GmbH  *l  Rosenthaler Straße 40,
<https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g>10178
Berlin,
<https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g>
Germany
<https://maps.google.com/?q=Rosenthaler+Stra%C3%9Fe+40,%C2%A0+10178+Berlin,%C2%A0+Germany&entry=gmail&source=g>



Geschäftsführer/Managing Director: Morten J. Broegger, Dylan Riley

HRB 149847 beim Handelsregister Charlottenburg, Berlin

VAT-ID DE288748675
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200503/f059de1b/attachment.htm>


More information about the systemd-devel mailing list