-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
PSA: systemd in initramfs #72401
Comments
Ok, lol, it is not a bug, it is a feature, but I don’t think there is a template for them 🤔. |
Why not just use somethin like Dracut? |
@lovesegfault The short answer is, basically, “for the same reasons why we do not just use Portage”. Dracut is essentially a “build system” written in Shell that takes a bunch of modules and combines them. Nix does the same and does it better. |
And since I am already writing in this issue, here is a small status update: I tweaked the systemd expression to make optional dependencies really optional. This brought the systemd’s closure size down to 68 Mb, 27 of which is glibc. I am now trying to build it with musl, and I am almost there, all the dependencies successfully cross-compiled, and now I am just staring at systemd’s compilation errors that are a result of differences between glib and musl. |
Current closure:
I think it’s good enough for now, I am a little tired of optimising this one to be honest. If someone want to help, you are welcome.
Regarding glibc vs. musl, there are two possible approaches (and both of them have already been implemented by people on the internet):
IIUC, systemd developers have been hostile to the idea of supporting other libc’s, but, on the other hand, I’m pretty sure I saw some musl-related patches being applied on the mailing list. musl developers are also not huge fans of improving glibc compatibility. Their position is that they want to be compliant with the standards, so they will merge anything only if it does not contradict the standards (yes, apparently, there are things in glibc that are no in line with POSIX, but do not quote me on this), and if it looks like it might become the standard soon. So, as one could imagine, getting something merge into libc is tricky as well. I am not sure what move would be right here, as I have both sides have valid arguments. I think the best approach would be a mix of the two: contribute to systemd changes that revert it to officially standardised APIs, where it makes sense; contribute to musl where it does not contradict existing standards; provide a compatibility layer in all other cases. Maybe, I’ll get back to it one day, but for now I am not entirely convinces that it is a good idea. |
People who want to type their encryption passphrase on their familiar layout, I think this is worth keeping or at least keeping the user's configured consoleKeymap. That aside, great work! |
Hey @kirelagin I haven't looked at this stuff yet, but it's sounds promising! Me and @flokli have been eyeing taking a stab at this for quite some time already. We did some preliminaries recently, like getting systemd built with We hang around a lot on #nixos-systemd in freenode. Please feel free to join that channel. It's populated by people who usually do systemd maintenance work for NixOS. I'm pretty sure everybody there is very willing to collaborate and brainstorm on this! |
@arianvp Hey, that’s cool! Tbh I haven’t been doing a lot of IRC recently, but that channel sounds like something I should be watching now. |
I can recommend checking out https://matrix.org which has a bridge to Freenode if you are rusty around IRC. It has a more friendly user interface :) e.g. you can join through: https://riot.im/app/#/room/#freenode_#nixos-systemd:matrix.org |
Hey, I'm very interested in this, whats with features like copytoram or findiso? does systemd support them natively or do we have to reimplement them? |
Sorry, I am not really familiar with how the live cd works, I plan to look into it slightly later. But as I mentioned in my first comment, systemd natively knows how to assemble a stateless system from the underlying root mountpoint and overlayfs (which can be in RAM) on top of it – I haven’t looked into the livecd stuff, so I don’t know, but isn’t it better than copytoram? I have no idea what findiso is, but if it is something about discovering the rootfs, then I don’t think systemd does anything like that. |
ah, that sounds indeed sufficient. We can check it later. |
I guess
|
Actually from further reading the specs of
Anyhow, we can for sure set up mount rules in |
Um, my plan was to set it to |
Oh, judging from the code, it takes only the name of the file, and then it searches for it on all devices that it can find and mount. I imagine, there are better ways to do this through integration with udev or something like this, to only search removable drives or I dunno. |
Ah you're right about After reading the git history of @Lassulus I now better understand the purpose of I think in systemd initrd it can be implemented using the following kernel params, if
From what I understand from https://www.supergrubdisk.org/wiki/Loopback.cfg the If the search behaviour is desired, then we should keep the shell script around for finding the ISO image and then mounting it as a systemd oneshot service perhaps. |
the |
How should it? The kernel doesn't know how the on-cd bootloader previously read from the boot file system, so looping over each available file system in the initrd is the only thing it can do. This could be made a bit smarter by having the bootloader obtain the uuid of that filesystem, and passing it in too, but |
Ah, and @arianvp, that cmdline is wrong. |
As the top post talks about an initramfs while the now proposed PR #74842 modifies the current initrd of NixOS: Are people aware that initramfs and initrd are different approaches at the same problem but not the same thing? An initrd is a virtual compressed whole file system, while an initramfs is a compressed cpio archive. And are there any strong preferences for or against one of them? I just noticed that most of my used other distributions (openSUSE, Arch, Gentoo) have switched to using an initramfs. Edit:
So it turns out that NixOS' current initrd already is an initramfs and everyone is using the wrong terminology?! |
Yes. Even the NixOS options say 'initrd' and not 'initramfs' (e.g. |
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:
|
This is still being worked on, it's just a lot of work. |
Heads up to everyone interested in here - the necessary lvm derivation refactoring was merged, and #66856 should add the cryptsetup bits. Help welcome in proposing a test for #66856 (comment) ;-) |
What are the current outstanding tasks on this? It looks like the preliminary changes to the systemd package were merged, does that mean "only" mapping the existing boot options to systemd is left? |
@TLATER systemd cryptsetup support did land, so in theory, we should be able to make use of However, we'd also need to take a look at the If you want, you can start giving this a try. I propose joining |
Any updates on this? 🙃 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/removing-persistent-boot-messages-for-a-silent-boot/14835/1 |
freenode happened, so I think #nixos-systemd is probably gone, and I never managed to get around to it. I'd love to know if the conversation has moved somewhere else. |
It moved to a simiarly named channel in the NixOS matrix instance https://matrix.to/#/#community:nixos.org |
I didn't join Matrix, but am at libera.chat - and in the #nixos-systemd channel there.
|
Are they bridged? If not can we get them bridged? |
Not that I'm aware of.
|
There is a general bridge for libera.chat, though it'd be nice to get one of those fancy matrix-irc cross servers. IRC through matrix is a faff. |
Hey, everyone! So, back then, this work required changes to systemd, and they conflicted with some other changes to the systemd expression that were happening at that time. As a result, it all got stuck and I moved on to other things. However, I am still very interested in this project (except that now that I got a Dell XPS 13 and realised how horrible everything is, I think I might need to start fixing things at an even lower level) and I hope to get back to it soon. To prove my commitment (to myself, in the first place), I went ahead and created a Matrix channel #sensible-initramfs:matrix.org (I don’t believe in IRC anymore). To be clear: I am not actively looking for collaborators right now since nothing is clear yet, but I will be very happy to discuss anything with anyone interested. |
@kirelagin if you hadn't seen, #120015 exists. Hopefully you can collaborate :). |
#164943 has been merged. Can this be closed? |
That PR implements this as an opt-in, and doesn't fully implement everything the old initramfs is capable of yet. It'll take more work to get to an actual systemd-in-initramfs, but it's a very, very good first step :) Not sure if this can be closed, but I think it should perhaps be replaced. I feel like there should be a tracking issue for an actual full conversion that also includes a list of things that are still missing. This issue has become a bit chaotic over the years, and hardly tracks the original work anymore. |
IMHO we'd be better served by closing this issue and opening a new tracking issue for the features missing in the merged effort. The final feature is making it the default. |
We have a project tracking progress here: https://github.com/NixOS/nixpkgs/projects/51 |
This is something like an RFC, but more of a heads-up: we need systemd in initramfs. The advantages are:
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):
cryptsetup
in the systemd expr?), and then something about the iso (passsystemd.volatile=
on the command line?).Let me know what you think, and feel free to join the fun.
The text was updated successfully, but these errors were encountered: