Add service for root disk unlocking#90
Conversation
|
It turns out that the systemd-generators in the initramfs run very early, even before device files for block devices are created in If we decide that it's not feasible to implement this generator, we could instead implement a systemd service that runs in the initramfs or even during late user space boot. That service would determines the UUID of the ROOT partition and add |
|
About the timing; generators may run multiple times. We could also have a look at how the systemd gpt auto generator manages to "wait" for the device. |
I might be reading the code wrong, but I think the systemd-gpt-auto-generator does not itself wait for device files to appear. Instead, it generates a cryptsetup service that waits for a device file to appear, which is later created by udev (see here). We could adapt that strategy by adding a systemd service that decrypts the ROOT partition once it's available, but the whole idea was to just piggy-back on the cryptsetup-generator rather than writing our own decryption service.
What did you have in mind here? One option that might work (not sure whether that's what you thought of) is to trigger re-running of generators by adding a service that runs |
|
Thanks, thinking about this I guess we can try to define a helper service that runs the logic to invoke the generator. Since we know what service the generator will write out, we can explicitly start this generated service with |
…th other generators
fa49847 to
b9f3b12
Compare
Sounds good 👍 I implemented this approach. Let me know what you think. |
b9f3b12 to
66145c3
Compare
|
I added the service under |
Hello @simoncampion, the only usable systemd command for this scenario is |
|
@ader1990 Thanks for the hint! That's a neat command. |
Add service for root disk unlocking
Currently, root disk unlocking in the initramfs has to be triggered by setting a kernel argument
rd.luks...in the Ignition config. This has two disadvantages. First, it would be nicer for the users if they did not have to set a kernel argument to make root disk unlocking work. Second, during first boot, it leads to an unnecessary systemd-cryptsetup unit that (at least sometimes) fails. While this failing unit causes no harm, it does make the tests fail and might confuse users.The
systemd-cryptsetup-generatordoes not generate because we don't have appropriate entries in/etc/crypttabin the initramfs. This PR adds a service that works around this issue by generating acrypttabfile, callingsystemd-cryptsetup-generatoron that crypttab file to generate asystemd-cryptsetupservice to decrypt the root, and then starting that service.How to use
Root disk decryption set up with
storage.luksin Ignition should work without passing special kernel arguments in the Ignition config.Testing done
I built the amd64 image based on this scripts PR and ran the TPM and Tang tests as modified in this bootengine PR.
I failed to get cross-compilation to work and hence have not run the arm64 tests yet. Running CI on the scripts PR will build the arm64 image and I can then run the updated tests against that image.
changelog/directory (user-facing change, bug fix, security fix, update)/bootand/usrsize, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.