-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
grub module: add extraInitrd option #22969
Conversation
@symphorien, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @wkennington and @obadz to be potential reviewers. |
extraInitrd = mkOption { | ||
type = types.nullOr types.path; | ||
default = null; | ||
example = /boot/extra_initrafms.gz; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example needs to be quoted, otherwise the evaluator will try to actually read it.
52b7524
to
9ed2846
Compare
Sorry, this is now fixed. |
Wow, awesome. Didn't know you could add a second initrd. What are the semantics here? Does the kernel just mount the second initrd over the first one are the contents copied? Seems a bit weird at first glance that the contents of both initrds are available at /. |
The contents are copied. The cpio format that's used for initrds cannot be mounted as it doesn't support efficient random access. |
Thanks for the explanation @dezgeg! |
Motivation for this change
This adds a NixOS option which enables to configure grub to give the kernel a second ,additional initramfs.
My use case is the following:
I have a LUKS encrypted root filesystem, and no /boot partition. Grub asks me a passphrase to open /, read its configuration in /boot and then loads the kernel.
The initramfs then asks me the same passphrase a second time to mount /.
The solution is to create a LUKS keyfile, readable by root only, and put it in the initramfs so that stage1 doesn't need the passphrase anymore. But because of issue #8 one cannot but secret files in the store and thus in the initramfs.
So I have a second, static initramfs in
/boot/custom_initramfs/initramfs.gz
, readable by root only, and containing only the keyfile/key
and the following setup:Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)Only tested on grub2, although the syntax should be the same with grub1.