Skip to content

feat(live): Add "/usr/bin/chroot" tool to the initrd#2306

Merged
lslezak merged 1 commit intomasterfrom
chroot_in_initrd
Apr 29, 2025
Merged

feat(live): Add "/usr/bin/chroot" tool to the initrd#2306
lslezak merged 1 commit intomasterfrom
chroot_in_initrd

Conversation

@lslezak
Copy link
Copy Markdown
Contributor

@lslezak lslezak commented Apr 29, 2025

Problem

  • The /usr/bin/chroot tool is not included in the initrd image anymore (it was in the past, probably some change in dracut...)

Solution

  • Explicitly include it in the dracut configuration

Usage

It can be used for editing the file in the root image before booting the system. We could include an editor like vim, joe or nano in the initrd but those tools are quite big. In most cases you can just use the editor from the root image itself, you just need a chroot command for that.

  • Boot with rd.break=cleanup option
  • When the dracut maintenance prompt appears just press Enter
  • Then run chroot /sysroot (that's the place where the future root is mounted at this point)
  • Run the editor from the root image simply by using vim ... command
  • Exit chroot (Ctrl+D)
  • Exit maintenance mode (Ctrl+D)
  • The boot continues using the modified files

The initrd size increase is tiny (~30kB uncompressed) compared to adding a full editor.

Testing

  • Tested manually

...to allow manually running the tools from the root
image before switching into it
@lslezak lslezak merged commit 5feaf35 into master Apr 29, 2025
8 checks passed
@lslezak lslezak deleted the chroot_in_initrd branch April 29, 2025 11:30
@imobachgs imobachgs mentioned this pull request May 26, 2025
imobachgs added a commit that referenced this pull request May 26, 2025
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.

2 participants