5.11. bootc-image-builder를 사용하여 상태 비저장 PXE 이미지 빌드
bootc-image-builder 툴을 사용하여 네트워크 부팅에 적합한 kernel, initrd, squashfs rootfs와 같은 아티팩트 세트를 사용하여 bootc 컨테이너 이미지를 pxe-tar-xz 이미지 유형으로 변환할 수 있습니다.
사전 요구 사항
- bootc 컨테이너입니다.
-
dracut-live및squashfs-tools패키지는 Containerfile에 포함되어 있습니다. -
컨테이너 이미지는
initramfs에 빌드된dmsquash-live모듈을 사용하여 빌드됩니다. 예를 들어 Containerfile을 참조하십시오. - 생성된 아티팩트를 호스팅하는 기능적 TFTP 또는 HTTP 서버입니다.
프로세스
컨테이너 파일을 생성합니다.
FROM quay.io/<namespace>/<image>:latest RUN dnf -y install dracut-live squashfs-tools && dnf clean all # Override using composefs for ostree (it is incompatible with the squashfs rootfs) RUN cat <<EOF > /usr/lib/ostree/prepare-root.conf [composefs] enabled = no [sysroot] readonly = true EOF # Include the dmsquash-live module in the initramfs RUN cat <<EOF > /usr/lib/dracut/dracut.conf.d/40-pxe.conf compress="xz" add_dracutmodules+=" qemu qemu-net livenet dmsquash-live " early_microcode="no" EOF # Rebuild the initrd RUN set -xe; kver=$(ls /usr/lib/modules); env DRACUT_NO_XATTR=1 dracut -vf /usr/lib/modules/$kver/initramfs.img "$kver" # Mask services that aren't compatible with running from the rootfs RUN systemctl mask bootc-generic-growpart.service bootc-publish-rhsm-facts.service RUN bootc container lint컨테이너 이미지를 빌드합니다.
$ podman build -f ./Containerfile -t bootc-dracutbootc-image-builder를 실행하여tar파일을 생성합니다.$ mkdir -p ./output$ sudo podman run \ --rm \ -it \ --privileged \ --pull=newer \ --security-opt label=type:unconfined_t \ -v ./config.toml:/config.toml:ro \ -v ./output:/output \ registry.redhat.io/rhel10/bootc-image-builder:latest \ --type pxe-tar-xz \ --local \ localhost/bootc-dracut:latestContainerfile이 원격 시스템에 있는 경우
localhost/bootc-dracut:latest를 올바른 URL로 바꿉니다.생성된
tar파일은 패키지 기반pxe-tar-xz이미지와 동일합니다. 유일한 차이점은grub.cfg파일에ostree=…이 커널 명령줄에 추가되었으며rootfs.img파일은 패키지 기반 시스템 대신 OSTree 시스템입니다.
검증
배포하기 전에 컨테이너 이미지가 올바르게 빌드되었으며 필요한 구성 파일과 모듈이 포함되어 있는지 확인합니다.
빌드한 컨테이너를 검사합니다.
$ podman run --rm -it localhost/bootc-dracut:latest /usr/bin/bash-
/usr/lib/ostree/prepare-root.conf및/usr/lib/dracut/dracut.conf.d/40-pxe.conf파일이 올바르게 생성되었는지 확인합니다. initramfs 모듈을 확인하여
dmsquash-live및ostree모듈이 있는지 확인합니다.$ lsinitrd --mod /usr/lib/modules//initramfs.img*
문제 해결
- GRUB 메뉴를 사용할 수 없음
- 원인: EFI 바이너리 또는 구성 파일이 잘못 배치됩니다.
-
해결 방법:
grub.cfg파일이grubx64.efi파일과 동일한 디렉토리에 있는지 확인합니다.BOOTX64.EFI,grubx64.efi및grub.cfg파일을 TFTP 서버가 가리키는 디렉터리의 루트에 배치합니다.
rootfs.img파일이 로드되지 않음-
원인:
[FAILED] initrd-switch-root.service - Switch Root를 시작할 수 없습니다. -
해결 방법: initramfs에
dmsquash-live모듈이 포함되어 있는지 확인합니다. -
원인:
curl은rootfs.img파일을 다운로드하려고 하는 루프에 붙어 있습니다.Warning: failed to download live image: error 253 -
해결 방법:
grub.cfg파일에서rootfs.img파일이root=live:…에 지정된 위치에 있는지 확인합니다. HTTP 서버 로그를 확인하여 요청 경로가 예상 위치와 일치하는지 확인합니다.
-
원인:
- OSTree root가 마운트되지 않음
-
원인:
ostree-prepare-root: 지정된 OSTree 루트를 찾을 수없음 -
해결 방법:
grub.cfg파일이 동일한tar파일에서 시작된rootfs.img파일과 일치하는지 확인합니다.grub.cfg파일의ostree=…항목은rootfs.img파일의 경로를 가리켜야 합니다. 빌드 프로세스에서 OSTree 디렉터리에서 이 UUID를 설정하기 때문에rootfs.img파일이grub.cfg파일과 일치하지 않을 때 불일치가 발생합니다. -
원인:
composefs를 마운트하지 못했습니다: composefs: failed to mount: Input/output error -
해결 방법:
prepare-root.conf파일에서composefs가 비활성화되어 있는지 확인합니다.
-
원인: