Skip to content

Conversation

@chewi
Copy link
Contributor

@chewi chewi commented Apr 22, 2025

Misc changes needed to use new Dracut with sysroot feature

This must be reviewed in tandem with flatcar/scripts#2837.

Flatcar has lagged behind on Dracut 053 for quite a while. The latest version is currently 106, although it did jump from 060 to 100 when it changed hands.

It's hard to summarise the changes here, so please see the commit messages. The main change is that we now run Dracut with its --sysroot argument, removing the need to chroot and jump through hoops to avoid the Portage sandbox in the coreos-kernel ebuild.

Before you ask, the extglob stuff is needed twice, once when the script is parsed, and once when the install() function is executed. Bash is weird.

How to use

This is only usable with my chewi/dracut branch in flatcar/scripts. You will need the latest SDK due to changes in my earlier PR. You should be able to update dracut in the SDK, plus dracut and bootengine in the board root, before building coreos-kernel.

Testing done

I have done a lot of manual testing and CI testing, as well as a close inspection of the initrd changes, in tandem with my chewi/dracut branch in flatcar/scripts.

  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@chewi chewi self-assigned this Apr 22, 2025
@chewi chewi marked this pull request as ready for review April 23, 2025 09:22
@chewi chewi requested a review from a team April 23, 2025 09:23
@krnowak
Copy link
Member

krnowak commented Apr 23, 2025

Before you ask, the extglob stuff is needed twice, once when the script is parsed, and once when the install() function is executed. Bash is weird.

Yeah, the situation is stupid. extglob is enabled by default for interactive shells, but not for non-interactive ones. It's annoying.

chewi added 7 commits April 23, 2025 12:02
* It wasn't working with Dracut's sysroot feature.
* It was writing some wrappers to the wrong directory.
* It was creating a wrapper for a script that is sourced, not exec'd.
* It was creating wrappers for symlinks, using more space.
* It was creating wrappers for files that didn't exist.
* It was creating wrappers for core utilities that might be needed by
  other modules before /sysusr is mounted.

Signed-off-by: James Le Cuirot <[email protected]>
These were all broken because ln_r was not the right helper to use.

Signed-off-by: James Le Cuirot <[email protected]>
Tools like Clevis are executed from /sysusr/usr, so we need to ensure
this is mounted by trying to execute them.

Signed-off-by: James Le Cuirot <[email protected]>
Flatcar doesn't set a root password, so we have to use sulogin's --force
option to get an emergency shell.

Signed-off-by: James Le Cuirot <[email protected]>
These are pulled in by default in newer Dracut versions, but they have
large dependencies, and we already cover tpm2-tss with the clevis
module.

Signed-off-by: James Le Cuirot <[email protected]>
@chewi chewi force-pushed the chewi/dracut-sysroot branch from 6c5f208 to 8f808c1 Compare April 23, 2025 11:02
@chewi chewi merged commit 26231c6 into flatcar-master Apr 23, 2025
@chewi chewi deleted the chewi/dracut-sysroot branch April 23, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants