Foreman Discovery Image @ CentOS 10 prototype

Hello,

the foreman discovery image is currently based on CentOS Stream 9. I instructed a LLM to do 1:1 refactoring from lorax-based LiveCD to bootc image-builder building process. This slightly chances the generated artifact and boot arguments, but other than that it is the same FDI as we know it. Then once I tested it, it was upgraded from Stream 9 to 10 as well.

The build process

What is changing is the build process, no more shell script and anaconda kickstarts, everything is in a single Containerfile and the build is something like:

podman build --pull=always \
  --build-arg FDI_VERSION="$(git describe --tags --always)" \
  --build-arg FDI_RELEASE="$(date -u +%Y%m%d).1" \
  -t localhost/fdi:stream10 .

The containerfile has half a dozen of environment variables where things like root password can be set up. What is cool about bootc containers is one can test them via podman directly without the need of building the PXE OS image (which is slower).

To turn container file into OS image, you use image-builder now which is the ultimate tool maintained by Red Hat engineering for building images (cloud, virtualization, live PXE)

sudo image-builder build pxe-tar-xz \
  --bootc-ref localhost/fdi:stream10 \
  --arch x86_64 \
  --blueprint bootc/pxe.toml \
  --output-dir output \
  --with-manifest --with-buildlog

Usage

Download the artifacts from a scratchbuild I published:

Or from GitHub Action overview page of the PR:

The resulting artifacts is a tarball which contains vmlinuz, initrd.img, a separate squashfs rootfs.img, grub.cfg, an EFI/ bootloader tree, and an upstream README.

Now, what is changing for end users is that files for the PXE/TFTP directory are slightly different now. What you need to do for discovery to work is to put the following into the TFTP folder /var/lib/tftpboot/boot/fdi-image/:

  • vmlinuz
  • initrd.img
  • rootfs.img
  • grub.cfg (you only need the ostree= value from it not the file itself)

Then update the Discovery Template with the following kernel command line options:

menuentry 'Foreman Discovery Image' --id discovery {
  linuxefi boot/fdi-image/vmlinuz \
    root=live:http://<%= @host.tftp_server %>:8000/httpboot/boot/fdi-image/rootfs.img \
    ostree=REPLACE_WITH_EXACT_PATH_FROM_ARCHIVE \
    ip=dhcp \
    rd.neednet=1 \
    fstab=no \
    proxy.url=<%= foreman_server_url %> \
    proxy.type=foreman \
    BOOTIF=01-$mac
  
  initrdefi boot/fdi-image/initrd.img
}

Make sure HTTPBoot feature is turned on on that TFTP proxy. The ostree argument is required and it is always different for each FDI build, you will find it in the tarball in grub.cfg. This is a little bit clunky, but the OS will not boot without it.

Limitations

What image-builder cannot build is an ISO file, but this can be manually built if needed.

Feedback

Please test this and report back

2 Likes

We have a successful report, FDI is working fine so far. Keep the reports coming!