Skip to content

PSA: systemd in initramfs #72401

@kirelagin

Description

@kirelagin

This is something like an RFC, but more of a heads-up: we need systemd in initramfs. The advantages are:

  • Smoother transition into stage-2 from stage-1 with a lot of interesting state passed.
  • systemd knows some cool tricks we could use, such as proper unmounting or using a tmpfs/overlaysfs to make the system stateless.
  • Some people say it’s faster, because it’s systemd: C, parallel execution, socket activation, etc.
  • Apparently there are some open issues that will be more-or-less trivially resolved by having a systemd-based initramfs (things like networking, I’m not sure, but I definitely saw some).
  • Likely, a lot of other good things, I’m not sure, suggestions welcome.

Therefore I started nixos-init. It is more of a skeleton rather than something working, however it already really starts systemd in initramfs, and this systemd even tries to mount root (if you add root= to the command line), so, I suppose, this thing will actually boot a system (not that I tried) if mounting root does not involve anything “interesting” (such as encryption or LVM). Once again, at this point it is just a prototype, but it already has a logo, so you can be sure it’s legit.

The plan is roughly the following (in no particular order):

  • Polish rootfs detection. It seems that the fstab generator is stupid enough to be unable to generate sensible units for the root filesystem from anything that is not the kernel command line arguments, and I am not very happy with it, so I was hoping I’d be able to find a work around that will not involve writing the .mount unit by hand.
  • Have a “minimalistic” version of systemd without 100 Mb of useless libs in its closure (should be fairly straightforward but will require tweaking the expression, which is currently too rigid).
  • Make the thing boot mobile-nixos instead of its current boring stage-1 shell script.
  • Achieve feature parity with current stage-1. I don’t even know what this involves, but, I suspect, it’s basically just LVM (add the unit file?), cryptsetup (uncomment cryptsetup in the systemd expr?), and then something about the iso (pass systemd.volatile= on the command line?).

Let me know what you think, and feel free to join the fun.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.9.needs: community feedbackThis needs feedback from more community members.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions