Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]: initialRamdisk: Use systemd for initrd's /init #74842

Closed
wants to merge 1 commit into from

Conversation

ElvishJerricco
Copy link
Contributor

Motivation for this change
  • This parallelizes early boot.
  • Systemd generators like the cryptsetup and fstab ones can be used to handle mounting and prompting for passwords.
  • Plymouth can start much earlier, in early boot, making the boot graphics much cleaner.
  • Systemd services from other packages can be used.
  • systemd-ask-password can be used.

NOTE: This is a WIP. I'm opening this PR now mostly for feedback on the concept.

Things done
  • Set initrd's /init to the systemd binary.
  • Use systemctl switch-root instead of switch_root.
  • Minimize the size inflation. Currently this only inflates a base initrd by 1M. I'd like to get this down further though.
  • Switch to fstab and crypttab generators.
  • Make sure none of the NixOS tests have broken.
  • Start plymouth in initrd.
  • Use systemd for setting up the initrd network stack.
  • Offer a trivial NixOS module interface for adding packages' systemd services to initrd.
  • Use systemd's emergency.target on failure to boot.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@flokli
Copy link
Contributor

flokli commented Dec 2, 2019

Very nice! Tackling this is on my todo list for quite some time, I'm happy to see this happening now :-)

As far as lvm and cryptsetup foo is concerned, I just polished #66856.

@bjornfor
Copy link
Contributor

bjornfor commented Dec 3, 2019

Cross referencing #72401 and #72802.

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@flokli flokli added this to To Do in systemd via automation Jun 1, 2020
@flokli
Copy link
Contributor

flokli commented Jun 1, 2020

This is still very much appreciated, but blocked by other systemd PRs. Stalebot, you're wrong!

@flokli flokli removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@ryantm ryantm marked this pull request as draft October 23, 2020 01:59
@worldofpeace
Copy link
Contributor

Is this blocked anymore @flokli?

@worldofpeace worldofpeace mentioned this pull request Feb 23, 2021
16 tasks
worldofpeace added a commit to worldofpeace/nixpkgs that referenced this pull request Feb 25, 2021
The BGRT theme is probably a close as to "FlickerFree" we can
get without NixOS#74842.
It's more agnostic than the Breeze theme.

We also install all of themes provided by the packages, as it's possible
that one theme needs the ImageDir of another, and they're small files
anyways.

Lastly, how plymouth handles logo and header files is
a total mess, so hopefully when they have an actual release
we won't need to do all this symlinking.
@flokli
Copy link
Contributor

flokli commented Mar 16, 2021

I started looking at

Switch to fstab and crypttab generators.

The problem here is that we'd need to confiure something like this:

systemd.services."systemd-growfs@".restartIfChanged = false;
systemd.services."systemd-growfs@".path = [ config.system.path ];
systemd.services."systemd-makefs@".restartIfChanged = false;
systemd.services."systemd-makefs@".path = [ config.system.path ]

… but the unit file we want to override is created inside the systemd generator.

Currently, the systemd.services.<name> logic simply check if the base unit file is already provided (not by Nix), and if so, creates an override unit.

We can't distinguish between this just being an incomplete unit file configuration vs. an override. @adrianparvino, thoughts?

@stale
Copy link

stale bot commented Sep 14, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 14, 2021
@pasqui23
Copy link
Contributor

@flokli are you still developing this or @ElvishJerricco 's pr takes precedence?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 14, 2021
find $out/bin -type f | while read i; do
find $out/bin $out/lib -type f | while read i; do
case $i in
$out/lib/ld*.so.?) continue;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A default that nothing should happen would be a good idea.

@flokli
Copy link
Contributor

flokli commented Sep 16, 2021

@flokli are you still developing this or @ElvishJerricco 's pr takes precedence?

I'm not actively working on this right now.

@pasqui23
Copy link
Contributor

@flokli So should we close this considering #120015 has been mre recently updated?

@flokli
Copy link
Contributor

flokli commented Sep 18, 2021

@flokli So should we close this considering #120015 has been mre recently updated?

This would probably be a question for @ElvishJerricco, the author of both PRs. They share a lot of description at least…

@pasqui23
Copy link
Contributor

@ElvishJerricco showld we close this? #120015 seems to be more recently updated.

@dasJ dasJ removed this from To Do in systemd Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants