Skip to content

Injecting configuration files after installation, before first boot #531

Open

Description

@jmpolom

How does one inject a configuration file post bootc install but before the first system boot? A customized /etc/fstab is a good example or perhaps some systemd mount units. With a non-ostree system when the installation chroot is setup this is a straightforward copy operation. bootc should document this process a bit better or provide a more convenient method as it will be a common need to drop some configuration files in place post install but before the system boots for the first time. Not everyone will want to adopt ignition to do these tasks.

Activity

  1. cgwalters commented on May 15, 2024

    @cgwalters
    Member

    bootc should document this process a bit better or provide a more convenient method

    See #267 for a more convenient method. We are indeed in a relatively inconsistent situation where e.g. Anaconda allows this, but bootc-image-builder and bootc install don't in any kind of direct way; the above PR helps.

    Not everyone will want to adopt ignition to do these tasks.

    Yes, agreed.

  2. added
    enhancement
    area/install
    area/config
    triaged
    on May 15, 2024
  3. jmpolom commented on May 15, 2024

    @jmpolom
    Author

    I gathered there was divergent functionality here and this was not really supported now. What is the present day workaround?

    What is going on in your PR with let target_etc = root.open_dir("etc").context("Opening deployment /etc")?;? Are you effectively just grabbing the etc directory of the ostree deployment in sysroot? figured this out for myself.

    As for a workaround, should I just dump stuff into <physroot>/ostree/deploy/default/deploy/<hash>/etc/? What I've come up with to use in a script with a filesystem install to get to this location: ostree admin status | head -n 1 | cut -d ' ' -f 3 -

  4. jmpolom commented on May 16, 2024

    @jmpolom
    Author

    As for a workaround, should I just dump stuff into <physroot>/ostree/deploy/default/deploy/<hash>/etc/? What I've come up with to use in a script with a filesystem install to get to this location: ostree admin status | head -n 1 | cut -d ' ' -f 3 -

    ostree admin status --sysroot=<wherever sysroot is mounted> doesn't work right after install as it reports works only if the boot partition is mounted otherwise it reports No deployments. It looks like ostree rev-parse --repo=<wherever sysroot is mounted>/ostree/repo ostree/1/1/0 could work if boot isn't mounted for some reason.

    It would be a much more pleasant experience if bootc install subcommands could cleanly output this bit of info. It is present internally.

  5. cgwalters commented on May 17, 2024

    @cgwalters
    Member

    ostree admin status --sysroot= doesn't work right after install as it reports No deployments.

    It's almost certainly because you have a distinct /boot filesystem which isn't mounted, and ostree uses the bootloader configs as source of truth.

  6. jmpolom commented on May 17, 2024

    @jmpolom
    Author

    ostree admin status --sysroot= doesn't work right after install as it reports No deployments.

    It's almost certainly because you have a distinct /boot filesystem which isn't mounted, and ostree uses the bootloader configs as source of truth.

    This is exactly what the issue was. The documentation for ostree admin status does not indicate it pulls data from /boot, however. I wrongly presumed it inspected the repository somehow.

  7. added 2 commits that reference this issue on Nov 5, 2024
  8. cgwalters commented on Oct 27, 2025

    @cgwalters
    Member

    Especially with composefs we'll need to offer a proper API for this because today anaconda and bootc-image-builder e.g. basically hardcode looking for the ostree deployment, and that will break with a composefs native install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configarea/installenhancementtriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions