Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept --arch based on uname -m names (ie x86_64/aarch64) in addition to GOARCH like arch (ie amd64/arm64) #12680

Closed
Romain-Geissler-1A opened this issue Dec 22, 2021 · 8 comments · Fixed by containers/common#867
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Romain-Geissler-1A
Copy link
Contributor

Romain-Geissler-1A commented Dec 22, 2021

/kind feature

Description

I personally think it would be a nice to have if podman build/run would accept a flag "--arch=aarch64". Right now it doesn't. Example trying podman in podman with upstream podman:

> podman run --privileged -t -i --rm quay.io/podman/upstream podman run -t -i --rm --arch=aarch64 fedora uname -a
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Error: choosing an image from manifest list docker://registry.fedoraproject.org/fedora:latest: no image found in manifest list for architecture aarch64, variant "", OS linux

normally it's been several months that for example "docker buildx build" accepts using aarch64 rather than arm64.

Why would this help ? In case of multiarch builds which we are right now trying to use in Amadeus, I wish I could easily do some podman in docker/podman or podman side by side podman scenarios where the top level container is itself an emulated container running qemu and that the emulated arch would "propagate" in the child container too. Eg, in other words, if this could work (run from an x86_64 machine), this would be cool:

> podman run --arch=arm64 --privileged -t -i --rm quay.io/podman/upstream sh -c 'podman run -t -i --rm --arch=$(uname -m) fedora uname -a'                                                                                                                       
Trying to pull quay.io/podman/upstream:latest...
Getting image source signatures
Copying blob sha256:9cf36a3ba6d8ca7d2f69c34d3b5a25e0a5cbc91c4acbab0877fdd676dadebbb7
Copying blob sha256:73333db80aa9f76e1ed26dcdf52e4d3ab82f90e926417e0f2ad6c4ba843a3030
Copying blob sha256:37f8fd3d39b73a8a6155ddf09aa1ecc7f71e8d89e5e129a0607b2a9534e11c4f
Copying blob sha256:6f738690ee1a0c7a9cdbf7cba15c9c819b5930bb69f91530d7210c403da94e65
Copying blob sha256:0502db657bc4fdee90878f5c45f94c853c3bb5b9bf38e0c17daf1234a8f6a80f
Copying blob sha256:5c3bf42ff74e848b614d64d2ba88ca422e52a41af585d592522b7928b26959ce
Copying blob sha256:3151ed8e5ab4415cfc88a864fc5fe641666ec1973ceaa375d5de7c7d808dc737
Copying blob sha256:64bc8d331a3817298597d901b025292791739e6ac167dc60b65e009a3b03a23b
Copying config sha256:13d6fc982c6c3cc9b6a7936c68304ca1c98f58d27e1b385073c1343d11b0fc80
Writing manifest to image destination
Storing signatures
ERRO[0000] failure getting variant                       error="getCPUInfo for pattern: Cpu architecture: not found"
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Error: choosing an image from manifest list docker://registry.fedoraproject.org/fedora:latest: no image found in manifest list for architecture aarch64, variant "", OS linux

(by the way, it seems it doesn't work because of another error "ERRO[0000] failure getting variant error="getCPUInfo for pattern: Cpu architecture: not found", which I don't know if you want to fix as well).

And final point, but here if you want we can keep it private between Amadeus and Red Hat since it's more RHEL related than podman related (you have my mail adress already ;) ): right now Red Hat doesn't provide the package qemu-user-static for RHEL, at least on RHEL 8, and it was refused in the past when I opened an internal Red Hat ticket to have it. Since I have the feeling multi-arch builds using qemu will come more and more, does Red Hat has now plans (maybe for RHEL 9) to provide an official RHEL qemu-user-static packages (based on the fedora one, of course) ?

Cheers,
Romain

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 22, 2021
@rhatdan
Copy link
Member

rhatdan commented Dec 22, 2021

I am fine with this, interested in opening a PR for this? The only issue, I see is that when inspecting the image, users would see a different value.

I ask for x86_64 but when I inspect image I get amd64.

I have had the same problem confusing the two names.

@vrothberg
Copy link
Member

Please note that the accepted values are clearly restricted in the OCI specifications. We should be very careful to add "custom" architectures.

@Romain-Geissler-1A
Copy link
Contributor Author

I just checked the latest upstream version. It seems that buildah already accepts --arch aarch64:

[root@80618a6d5cac docker]# buildah build --arch aarch64 .
STEP 1/2: FROM fedora
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Getting image source signatures
Copying blob 73333db80aa9 done
Copying config b74713569c done
Writing manifest to image destination
Storing signatures
STEP 2/2: RUN touch /plop   
COMMIT
Getting image source signatures
Copying blob 23902272e46a skipped: already exists
Copying blob 41cb5151506c done
Copying config ea5bf1b532 done
Writing manifest to image destination
Storing signatures
--> ea5bf1b5322
ea5bf1b53229bc7cf80f169f275d4e30c8e890e5de34cbef36f1bb658dd1273b



[root@80618a6d5cac docker]# buildah version
Version:         1.24.0-dev
Go Version:      go1.16.12
Image Spec:      1.0.2-dev
Runtime Spec:    1.0.2-dev
CNI Spec:        1.0.0
libcni Version:  v1.0.1
image Version:   5.17.1-dev
Git Commit:      0bd4dd1a
Built:           Wed Dec 22 13:50:43 2021
OS/Arch:         linux/amd64
BuildPlatform:   linux/amd64

but podman doesn't (for now):

[root@31132cbd1e91 docker]# podman build --arch aarch64 .
STEP 1/2: FROM fedora
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:latest...
Error: error creating build container: choosing an image from manifest list docker://registry.fedoraproject.org/fedora:latest: no image found in manifest list for architecture aarch64, variant "", OS linux

[root@31132cbd1e91 docker]# podman version
Client:       Podman Engine
Version:      4.0.0-dev
API Version:  4.0.0-dev
Go Version:   go1.16.12
Git Commit:   3280204f727bb733b1c615cff68e8377a61eb185 
Built:        Wed Dec 22 14:05:51 2021
OS/Arch:      linux/amd64

I will try to find by myself how this is achieved in buildah and see if I can shamelessly copy/paste this in podman as well ;)

@vrothberg
Copy link
Member

Note that the fedora manifest list (see below) has no matching entry for aarch64, so it seems correct to me that Podman errors out.

$ skopeo inspect --raw  docker://registry.fedoraproject.org/fedora| jq .
{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 429,
      "digest": "sha256:90bd0861ab68bcd5af83f0dad80ddaa8ffff2a82cb45be05e7877e945b600047",
      "platform": {
        "architecture": "arm64",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 429,
      "digest": "sha256:bc3c3ea948bb5cf187f8cfbe31b2c95f629bd489401172af05b908a6d118e4ee",
      "platform": {
        "architecture": "armhfp",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 429,
      "digest": "sha256:af44b415bf02cc12574a28d38eba7a8ffb33d4daca409b2839df4807a9be21c3",
      "platform": {
        "architecture": "ppc64le",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 429,
      "digest": "sha256:558e0e31794c285b076efc864cf8438af5959f6cbd3b77818c908d0f78954394",
      "platform": {
        "architecture": "s390x",
        "os": "linux"
      }
    },
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "size": 429,
      "digest": "sha256:c2dabcec02da4ba2d867ab0fdb6cfd7d9a16c7b11fc1f74b3270711e584afe02",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    }
  ]
}

@vrothberg
Copy link
Member

Buildah is using containerd's platform normalization (e.g., containers/buildah@9f9f32ceddf4) so it seems that containerd is supporting it as well. So it seems Podman should as well. I think that we could handle that down in libimage.

@nalind @rhatdan WDYT?

@rhatdan
Copy link
Member

rhatdan commented Dec 22, 2021

Yes I think this is a good idea.

@vrothberg vrothberg self-assigned this Dec 22, 2021
vrothberg added a commit to vrothberg/common that referenced this issue Dec 22, 2021
Buildah, containers and probably other container engines are normalizing
the platform parameters to support common values.  For instance, "x86_64"
is normalized to the OCI conformant "amd64".

Use the same normalization when copying images and looking up local
images.  Also add some debug logs to facilitate future debugging.

Fixes: containers/podman/issues/12680
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member

PR over in c/common: containers/common#867

@Romain-Geissler-1A
Copy link
Contributor Author

Romain-Geissler-1A commented Dec 22, 2021

Ah thanks for looking at it. I had found the platform.Normalize call, but I really understand nothing to Go, this thing is much more complicated than C++ that I use everyday ! ;)

vrothberg added a commit to vrothberg/common that referenced this issue Dec 23, 2021
Buildah, containers and probably other container engines are normalizing
the platform parameters to support common values.  For instance, "x86_64"
is normalized to the OCI conformant "amd64".

Use the same normalization when copying images and looking up local
images.  Also add some debug logs to facilitate future debugging.

Fixes: containers/podman/issues/12680
Signed-off-by: Valentin Rothberg <[email protected]>
vrothberg added a commit to vrothberg/common that referenced this issue Dec 23, 2021
Buildah, containers and probably other container engines are normalizing
the platform parameters to support common values.  For instance, "x86_64"
is normalized to the OCI conformant "amd64".

Use the same normalization when copying images and looking up local
images.  Also add some debug logs to facilitate future debugging.

Fixes: containers/podman/issues/12680
Signed-off-by: Valentin Rothberg <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants