Skip to content

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Sep 18, 2025

This spike show how we could use bootc based containers with anaconda. So instead of building our iso from rpm packages and just putting the bootc container into the rpm generated ISO this spike builds the ISO from a bootc container.

This requires that the container has the right content of course (i.e. anaconda). We would move some of the responsibility to the user (or to a tool that helps the user and hides the complexity here like bootc-iso-imagectl or something) to ensure that.

The Containerfile to generate an installer looks something like:

FROM {container_ref}
RUN dnf install -y \
     anaconda \
     anaconda-install-env-deps \
     anaconda-dracut \
     dracut-config-generic \
     dracut-network \
     net-tools \
     squashfs-tools \
     grub2-efi-x64-cdboot \
     python3-mako \
     lorax-templates-* \
     biosdevname \
     prefixdevname \
     && dnf clean all
# shim-x64 is marked installed but the files are not in the expected
# place for https://github.com/osbuild/osbuild/blob/v160/stages/org.osbuild.grub2.iso#L91, see
# workaround via reinstall, we could add a config to the grub2.iso
# stage to allow a different prefix that then would be used by
# anaconda.
# once https://github.com/osbuild/osbuild/pull/2202 is merged we
# can update images/ to set the correct efi_src_dir and this can
# be removed
RUN dnf reinstall -y shim-x64
# lorax wants to create a symlink in /mnt which points to /var/mnt
# on bootc but /var/mnt does not exist on some images.
#
# If https://gitlab.com/fedora/bootc/base-images/-/merge_requests/294
# gets merged this will be no longer needed
RUN mkdir /var/mnt

this basic template works for cs9,cs10,f42 (Note that the goal here is to essentially remove all quirks
and hide them in images/, ideally the containerfile would be just a "FROM \ndnf install anaconda...").

This branch also has a "--installer-payload" switch so to use this one would essentially write: bib --type iso --installer-payload quay.io/centos-bootc/centos-bootc:stream9 quay.io/centos-bootc-anaconda:stream9 (as currently the containerfile changes things like /root which makes it no longer a proper bootc container). We could of course explore making this more user friendly, either by a convention like "suffix -installer" for type iso or by creating a derrived constainer locally ourselfs with the above containerfile or helper or by fixing the issues that require /root to be a real dir (but even with that it would probably be undesired to install a container that contains a full anaconda env so something like installer-payload is probably still be needed).

Note that this is big departure from our current approach and we would need to think about a transition strategy/communication if we go down this route.

Thanks to Ondrej, Colin for their help/inputs in this, I hope it captures what they suggested to explore.

/jira-epic HMS-8839

JIRA: HMS-9392

@cgwalters
Copy link
Contributor

cgwalters commented Sep 18, 2025

AWESOME!!!! Thanks so much for starting this!

Even having an experimental/hidden option for this would be super useful.

shim-x64 is marked installed but the files are not in the expected
place for https://github.com/osbuild/osbuild/blob/v160/stages/org.osbuild.grub2.iso#L91

Yes because they're managed via bootupd; I think we could intersect bootupd with the osbuild ISO logic here.

Or...maybe more generally this is really intersecting bootc install to-filesystem and ISOs.

(as currently the containerfile changes things like /root which makes it no longer a proper bootc container).

Nah it's still a bootc container, we support content in /var (this is /var/roothome), it's just discouraged. https://bootc-dev.github.io/bootc/filesystem.html#var

@mvo5 mvo5 changed the title [RFC] many: switch to bootc based anaconda (away from rpm) [RFC] many: switch to bootc based anaconda (away from rpm) (HMS-9294) Sep 18, 2025
@mvo5 mvo5 changed the title [RFC] many: switch to bootc based anaconda (away from rpm) (HMS-9294) [RFC] many: switch to bootc based anaconda (away from rpm) Sep 18, 2025
@schutzbot schutzbot changed the title [RFC] many: switch to bootc based anaconda (away from rpm) [RFC] many: switch to bootc based anaconda (away from rpm) (HMS-9392) Sep 18, 2025
@achilleas-k
Copy link
Member

This is amazing work. I need to read it in more detail, but from a quick skim it looks great.
TY!

mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 24, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI`. So this commit makes
the location configurable in the same way as we already
have it for the grub2 (non-iso) stage.

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 24, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI`. So this commit makes
the location configurable in the same way as we already
have it for the grub2 (non-iso) stage.

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 24, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
@mvo5 mvo5 changed the title [RFC] many: switch to bootc based anaconda (away from rpm) (HMS-9392) [WIP] many: switch to bootc based anaconda (away from rpm) (HMS-9392) Sep 24, 2025
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 24, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 24, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
@mvo5
Copy link
Collaborator Author

mvo5 commented Sep 24, 2025

AWESOME!!!! Thanks so much for starting this!

Thank you! Really happy that you like it!

[..]

(as currently the containerfile changes things like /root which makes it no longer a proper bootc container).
Nah it's still a bootc container, we support content in /var (this is /var/roothome), it's just discouraged. https://bootc-dev.github.io/bootc/filesystem.html#var

I managed to remove this (and more quirks), I think the only one left is that anaconda does not like it when /mnt is a dangling symlink in the base image. I created https://gitlab.com/fedora/bootc/base-images/-/merge_requests/294 but I'm not sure its the best approach given the discouraged nature of populating /var. OTOH the dangling symlink might also be considered not super nice, idk. Or we could create a stage in osbuild that runs systemd-tmpfiles in a tree, i.e. after we mount the container we run systemd-tmpfiles(?).

@mvo5
Copy link
Collaborator Author

mvo5 commented Sep 25, 2025

Closing in favor of #1059 which is a much cleaner version of this (I used a separate branch to keep this spike around for reference)

@mvo5 mvo5 closed this Sep 25, 2025
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 25, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI/`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI/`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
mvo5 added a commit to mvo5/osbuild that referenced this pull request Sep 26, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI/`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI/`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
mvo5 added a commit to osbuild/osbuild that referenced this pull request Sep 26, 2025
We currently hardcode the location of the efi binaries to
`/boot/efi/EFI/`. This makes sense in general but when working
with bootc containers the location is usually different and
inside `/usr/lib/bootupd/updates/EFI/`. So this commit makes
the location configurable in a  similar way as we already
have it for the grub2 (non-iso) stage (in the grub2 stage
its under `uefi` but in this stage everything is flat
incuding the vendor so `efi_src_dir` is flat as well).

The rational is that we want to build ISOs from bootc base
images (c.f.
osbuild/bootc-image-builder#1053)
but also do not want every bootc installer image to have
a special bootupd grub iso configuration (which would
also hard to maintain as it would be duplicated in every
container). So instead we use this stage to generate the
config and just point to a different EFI dir.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants