blue-build/cli

Fail to install Custom Kernel because of TMPFS usage instead of being in root filesystem

Closed this issue · 0 comments

Hello! I've been trying to replace the default kernel on a Fedora CoreOS-like image (rpm-ostree based) and I havent been able to do so. Dracut errors out with a invalid cross-device link (os error 18) issue when installing the kernel-fsync package from Sentry. Apparently the kernel package tries to generate the initramfs image and hardlinks it from /tmp over to /path/to/initramfs and fails because the filesystem the initramfs image is is different from the rootfs. A fix for this would be to generate all RUN statements without --mount=type=tmpfs,target=/tmp and with a rm -rf /tmp/* /var/tmp/* at the end of the statements.

image

Minimal reproduction:

FROM quay.io/fedora/fedora-coreos:stable

ARG FEDORA_MAJOR_VERSION=39

# Try replacing the /var directory with /tmp, it wont work anymore.
RUN --mount=type=tmpfs,target=/var \
    curl "https://copr.fedorainfracloud.org/coprs/sentry/kernel-fsync/repo/fedora-${FEDORA_MAJOR_VERSION}/sentry-kernel-fsync-fedora-${FEDORA_MAJOR_VERSION}.repo" >> /etc/yum.repos.d/_copr_sentry-kernel-fsync.repo && \
    rpm-ostree cliwrap install-to-root / && \
    rpm-ostree override replace \
    --experimental \
    --from repo=copr:copr.fedorainfracloud.org:sentry:kernel-fsync \
        kernel \
        kernel-core \
        kernel-modules \
        kernel-modules-core \
        kernel-modules-extra \
        kernel-uki-virt && \
    rm -rf /tmp/* /var/tmp/* && \
    ostree container commit
    

This issue is basically what #119 says, but with a bit more detailed info about what is happening.