osbuild / bootc-image-builder

A container for deploying bootable container images.
https://osbuild.org
Apache License 2.0
87 stars 46 forks source link

Fail to build Centos stream 9 aarch64 qcow2 image on x86_64 machine #333

Open chunfuwen opened 3 months ago

chunfuwen commented 3 months ago

Build Centos stream 9 aarch64 qcow2 image on rhel 9.4 x86_64 machine with below command:

sudo podman run     --rm     -it     --privileged     --pull=newer     --security-opt label=type:unconfined_t     -v $(pwd)/config.json:/config.json     -v $(pwd)/output:/output     quay.io/centos-bootc/bootc-image-builder:latest     --type qcow2     --config /config.json     --target-arch=aarch64 quay.io/centos-bootc/centos-bootc:stream9
Generating manifest manifest-qcow2.json

And got below error message:

WARNING: target-arch is experimental and needs an installed 'qemu-user' package
DONE
Building manifest-qcow2.json
starting -Pipeline source org.osbuild.containers-storage: 7bff610b6c7d4fe6f1fd9a7bbf11eef7a045686ed212cdc654f313e91fd33e9f
Build
  root: <host>
Pipeline build: 89496200c5d0d03bc4f90e99385d640eb0e0bd8d526b9072abea6e7d3d31a123
Build
  root: <host>
  runner: org.osbuild.fedora38 (org.osbuild.fedora38)
org.osbuild.container-deploy: 327f0e4db3829c542877219a5d13a92990a0a8e33df4d3d93b6aa8431cbb86fa {
  "exclude": [
    "/sysroot"
  ]
}
time="2024-04-07T08:56:23Z" level=info msg="Image operating system mismatch: image uses OS \"linux\"+architecture \"arm64\"+\"\", expecting one of \"linux+amd64+\\\"\\\"\""
Getting image source signatures
...

Copying config sha256:99619850986827c70b082e5247a62c29c4fe79b7c63b14a12b293e413b3d0029
Writing manifest to image destination
99619850986827c70b082e5247a62c29c4fe79b7c63b14a12b293e413b3d0029
time="2024-04-07T08:57:24Z" level=error msg="Unable to write image event: \"write unixgram @5d3b0->/run/systemd/journal/socket: sendmsg: no such file or directory\""
Untagged: docker.io/library/tmp-container-deploy-66039802629911:latest
Deleted: 99619850986827c70b082e5247a62c29c4fe79b7c63b14a12b293e413b3d0029
time="2024-04-07T08:57:31Z" level=error msg="Unable to write image event: \"write unixgram @272e4->/run/systemd/journal/socket: sendmsg: no such file or directory\""
time="2024-04-07T08:57:31Z" level=error msg="Unable to write image event: \"write unixgram @272e4->/run/systemd/journal/socket: sendmsg: no such file or directory\""

⏱  Duration: 80s
org.osbuild.selinux: 89496200c5d0d03bc4f90e99385d640eb0e0bd8d526b9072abea6e7d3d31a123 {
  "file_contexts": "etc/selinux/targeted/contexts/files/file_contexts",
  "labels": {
    "/usr/bin/mount": "system_u:object_r:install_exec_t:s0",
    "/usr/bin/ostree": "system_u:object_r:install_exec_t:s0",
    "/usr/bin/umount": "system_u:object_r:install_exec_t:s0"
  }
}
setfiles: Regex version mismatch, expected: 10.42 2022-12-11 actual: 10.40 2022-04-14
setfiles: Regex version mismatch, expected: 10.42 2022-12-11 actual: 10.40 2022-04-14

⏱  Duration: 12s
Pipeline ostree-deployment: 1129c2ba5f4527a90175e96e15ac8a1f8d095d75239f257fdb7f244022b01efe
Build
  root: 89496200c5d0d03bc4f90e99385d640eb0e0bd8d526b9072abea6e7d3d31a123
  runner: org.osbuild.linux (org.osbuild.linux)
org.osbuild.ostree.init-fs: b05324832bd51d95fbce6a89527958821cad1630796bf98924e62e2d93483810 {}
bwrap: execvp /run/osbuild/runner/org.osbuild.linux: Exec format error

⏱  Duration: 0s
manifest - failed
Failed
Error: running osbuild failed: exit status 1
2024/04/07 08:57:57 error: running osbuild failed: exit status 1

Also my qemu-kvm package information follow as:

[root@dell-per430-17 images]# rpm -qa|grep qemu-kvm
qemu-kvm-tools-8.2.0-7.el9_4.x86_64
qemu-kvm-docs-8.2.0-7.el9_4.x86_64
qemu-kvm-common-8.2.0-7.el9_4.x86_64
qemu-kvm-device-display-virtio-gpu-8.2.0-7.el9_4.x86_64
qemu-kvm-ui-opengl-8.2.0-7.el9_4.x86_64
qemu-kvm-ui-egl-headless-8.2.0-7.el9_4.x86_64
qemu-kvm-device-display-virtio-gpu-pci-8.2.0-7.el9_4.x86_64
qemu-kvm-audio-pa-8.2.0-7.el9_4.x86_64
qemu-kvm-block-blkio-8.2.0-7.el9_4.x86_64
qemu-kvm-device-display-virtio-vga-8.2.0-7.el9_4.x86_64
qemu-kvm-device-usb-host-8.2.0-7.el9_4.x86_64
qemu-kvm-device-usb-redirect-8.2.0-7.el9_4.x86_64
qemu-kvm-core-8.2.0-7.el9_4.x86_64
qemu-kvm-block-rbd-8.2.0-7.el9_4.x86_64
qemu-kvm-8.2.0-7.el9_4.x86_6
mvo5 commented 3 months ago

Thanks for reporting this issue. The error

bwrap: execvp /run/osbuild/runner/org.osbuild.linux: Exec format error

indicates there is no qemu-user available here. Given that this is a RHEL host (AIUI) that is expected. Unfortunately we need to be able to run (at least some) non-native code when doing a cross arch build so right now this expected. We could make the error nicer though, this is really not a very user-friendly way to report it.

ondrejbudai commented 3 months ago

@mvo5 We talked about this, and we figure out that we maybe can detect this and bail out sooner, right?

mvo5 commented 3 months ago

@mvo5 We talked about this, and we figure out that we maybe can detect this and bail out sooner, right?

Yes, I will fix that.

[edit: I created https://github.com/osbuild/bootc-image-builder/pull/335 with a draft, need to think a little bit about how to properly integration test it]