CentOS / centos-bootc

Create and maintain base bootable container images from Fedora ELN and CentOS Stream packages
https://centos.github.io/centos-bootc
Other
45 stars 28 forks source link

Installing a custom kernel does not keep the boot partition #499

Closed oglok closed 5 months ago

oglok commented 5 months ago

I have the following Containerfile:

FROM quay.io/flightctl/flightctl-agent-centos:bootstrap

ADD etc etc

RUN rm -rf /opt && \
    mkdir -p /opt/crio
RUN dnf install -y microshift && \
    systemctl enable microshift.service

RUN dnf install -y kernel-5.14.0-427.14.1.blue1.el9_4

ADD systemd-shutdown /usr/lib/systemd/
RUN rm -rf /opt && ln -s /var /opt
RUN [ ! -L /var/run ] && rm -rf /var/run && ln -s /run /var/

/etc contains a repo where the kernel RPM ( kernel-5.14.0-427.14.1.blue1.el9_4 ) is stored. The container image seems to be built successfully. This image is created to be the upgrade of a base one with a very simple Container file:

FROM quay.io/centos-bootc/centos-bootc:stream9
ADD etc etc

RUN dnf install -y flightctl-agent && \
    systemctl enable flightctl-agent.service

## Add your flightctl configuration and certificates
ADD config.yaml /etc/flightctl/
ADD ca.crt /etc/flightctl/certs/
ADD client-enrollment.* /etc/flightctl/certs/

Using bootc upgrade, pulls the new image (the first Containerfile) and after reboot, I see the two ostree options in grub. However, the staged one that is booting now fails. If you enter in the kernel arguments, the initrd line is missing, and the boot partition does not contain the initramfs disk as it should.


total 8
drwxr-xr-x. 3 root root 4096 Apr 30 15:43 default-28af0175516946659bb525f36bc0fff88ef105a2b4471e1f7ecf7638ea5b57bf
drwxr-xr-x. 3 root root 4096 Apr 30 13:17 default-d341b610f2c5af9c192bccd8453fe5dbe1c2f797a5cfdb683f3222fcef4e6144
[root@localhost ~]# ll /boot/ostree/default-28af0175516946659bb525f36bc0fff88ef105a2b4471e1f7ecf7638ea5b57bf/
total 11664
drwxr-xr-x. 11 root root     4096 Apr 30 15:43 dtb
-rwxr-xr-x.  1 root root 11939803 Apr 30 15:43 vmlinuz-5.14.0-427.14.1.blue1.el9_4.aarch64
[root@localhost ~]# ll /boot/ostree/default-d341b610f2c5af9c192bccd8453fe5dbe1c2f797a5cfdb683f3222fcef4e6144/
total 47416
drwxr-xr-x. 11 root root     4096 Apr 30 13:17 dtb
-rw-r--r--.  1 root root 36562723 Apr 30 13:17 initramfs-5.14.0-437.el9.aarch64.img
-rwxr-xr-x.  1 root root 11981373 Apr 30 13:17 vmlinuz-5.14.0-437.el9.aarch64```

The new custom Kernel RPM does have contain the ramdisk, and it can be installed in a standard RHEL with no issue. 

Is there anything else we should add to the Containerfile? Is this a feature gap in bootc?

Thanks for your support!