-
Notifications
You must be signed in to change notification settings - Fork 69
test: initrd in /usr #3241
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
base: main
Are you sure you want to change the base?
test: initrd in /usr #3241
Conversation
@chewi My idea is to load the "normal" initrd as loopback mount from |
Build action triggered: https://github.com/flatcar/scripts/actions/runs/17452085773 |
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.
Although I shared the same concern about losing functionality that we would have to reimplement, I hadn't yet identified any such functionality, so I'm not quite ready to throw out my proposal to go straight from tiny initrd to real /usr. I'd really like to know what your specific concerns are.
This is an interesting approach in any case. My own alternative would have been to mount /usr as an overlay with the initrd, deleting all the duplicate files from the initrd, but I hadn't fully thought it through.
Regarding verity, I think it only needs to be set up once. I didn't enable verity in my own experiment, but /sysroot/usr was simply a bind mount of /usr. I think that would still work with verity applied.
mkdir "${S}"/build/bootengine | ||
cat "${S}"/build/bootengine.cpio | while cpio --no-absolute-filenames -d -m -D "${S}"/build/bootengine -i ; do :; done | ||
# Lacking read permissions even for user | ||
chmod u+r "${S}"/build/bootengine/etc/gshadow | ||
# CPU microcode should stay in the minimal initrd | ||
rm -rf "${S}"/build/bootengine/kernel "${S}"/build/bootengine/early_cpio | ||
# TODO: rework /usr verity mount to reuse the one from the minimal initrd | ||
mksquashfs "${S}"/build/bootengine "${S}"/build/bootengine.img -all-root -noappend -xattrs-exclude ^btrfs. |
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.
mkdir "${S}"/build/bootengine | |
cat "${S}"/build/bootengine.cpio | while cpio --no-absolute-filenames -d -m -D "${S}"/build/bootengine -i ; do :; done | |
# Lacking read permissions even for user | |
chmod u+r "${S}"/build/bootengine/etc/gshadow | |
# CPU microcode should stay in the minimal initrd | |
rm -rf "${S}"/build/bootengine/kernel "${S}"/build/bootengine/early_cpio | |
# TODO: rework /usr verity mount to reuse the one from the minimal initrd | |
mksquashfs "${S}"/build/bootengine "${S}"/build/bootengine.img -all-root -noappend -xattrs-exclude ^btrfs. | |
mkdir "${S}"/build/bootengine || die | |
pushd "${S}"/build/bootengine || die | |
sudo lsinitrd --unpack "${S}"/build/bootengine.cpio || die | |
# TODO: rework /usr verity mount to reuse the one from the minimal initrd | |
sudo mksquashfs . "${S}"/build/bootengine.img -noappend -xattrs-exclude ^btrfs. || die | |
popd || die |
This is running with RESTRICT="userpriv"
, so you can use sudo
here. That will ensure the device nodes are created correctly. lsinitrd --unpack
will not include the microcode.
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.
Also, might as well use mkfs.erofs
now!
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.
With bsdtar (which is in the SDK), you can even avoid extracting if dracut
is called with --no-compress --no-early-microcode
.
bsdtar -c @"${S}"/build/bootengine.cpio | mkfs.erofs --tar=f "${S}"/build/bootengine.raw
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.
Thanks for the improvements!
Also, might as well use
mkfs.erofs
now!
Yes, it's not part of the SDK yet.
My intention was to keep most things untouched so that we can focus on the bare task of jumping into the regular initrd and avoid any risk of reimplementing all needed initrd logic. Things that should run from the initrd are: Ignition stages, hostname setup with afterburn (and basic network setup for them while they prepare the final network setup for the real system), setup of the |
Okay, but I wasn't proposing rewriting all that. Dracut puts those scripts into an initrd. I was just going to put them in /usr instead. It's more or less the same thing. It's the scripts that Dracut itself provides through its own modules that I was concerned about. |
The question is on how these things are started because they run in a context with dependencies. Having only one set of systemd units for both the initrd and the final system doesn't work if we want to make use of systemd in the initrd - it would run all enabled units under |
It's from Gentoo commit 573964683c6f490e3a1ff040ec21c9d3b8d8b154. Signed-off-by: Kai Lueke <[email protected]>
4306d75
to
0bfc20a
Compare
Pulls in flatcar/bootengine#110 Co-authored-by: James Le Cuirot <[email protected]> Signed-off-by: Kai Lueke <[email protected]>
0bfc20a
to
9941c9d
Compare
Still WIP
How to use
Depends on flatcar/bootengine#110
Testing done
changelog/
directory (user-facing change, bug fix, security fix, update)/boot
and/usr
size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.