Bootc - Building base images from scratch with custom kernel

Hi, Thank you for working on bootc!

Is there a way how to build base image from scratch with custom kernel? I’m following the tutorial from From scratch Fedora/CentOS bootc base container images :: Fedora Docs and trying to remove the kernel and install my custom one without any luck (system is not booting - problem on screenshot). Could you help me what am I doing wrong? Thank you for your answer.

My Containerfile:

FROM quay.io/centos-bootc/centos-bootc:stream10 as builder

# Add custom repos
RUN rm -rf /etc/yum.repos.d/*
COPY ./my.repo /etc/yum.repos.d/
COPY ./RPM-GPG-KEY /etc/pki/rpm-gpg/

# Generate the minimal root filesystem
RUN /usr/libexec/bootc-base-imagectl build-rootfs --manifest=minimal /target-rootfs

# Now start building our image here, inheriting that minimal base.
FROM scratch
COPY --from=builder /target-rootfs/ /
RUN rm -rf /etc/yum.repos.d/*
COPY ./my.repo /etc/yum.repos.d/
COPY ./RPM-GPG-KEY /etc/pki/rpm-gpg/
RUN <<EORUN
set -xeuo pipefail

# Remove all other kernels and clean up /usr/lib/modules
dnf -y remove kernel kernel-core kernel-modules kernel-modules-core || true
rm -rf /usr/lib/modules/*

dnf -y install kernel-ml
dnf -y install openssh-server

systemctl enable sshd

# Clean up unnecessary files
rm -rf /usr/etc

dnf clean all
rm /var/{log,cache,lib}/* -rf
bootc container lint
EORUN

LABEL containers.bootc 1
LABEL ostree.bootable 1

STOPSIGNAL SIGRTMIN+3
CMD ["/sbin/init"]

Booting screenshot:

I don’t think that’s correct. Is that from the bootc docs?

That’s also probably not going to go well.

Thank you — those two commands aren’t correct; they were just my last attempt out of desperation. The result is the same without them. Any other ideas?

Can you try your Containerfile with the default Fedora kernel and see if it boots? If it does, then either something is wrong in you custom kernel or something else is off. Maybe you also need to rebuild the initramfs once you have installed the new kernel to make sure to pick the new kernel modules?

Yes, the same Containerfile with default Fedora kernel boots. I also tried to rebuild the initramfs after installing the new kernel, but with no luck, the result is the same.