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

Fix raspberry pi zero cpu variant recognition #2086

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

lstolcman
Copy link
Contributor

@lstolcman lstolcman commented Aug 9, 2023

The PR fixes a corner-case problem in which images for raspberry pi 1 or raspberry pi zero single board computers are downloaded for a wrong architecture, resulting in unability to run containers.

Also, PR adds some prints to improve the debugging.

The problem may be easily reproduced when using a rpi 1 or rpi zero with podman:

current version:

> podman run --log-level=info --syslog busybox echo ok
INFO[0000] podman filtering at log level info
INFO[0000] Setting parallel job count to 4
Resolved "busybox" as an alias (/home/pi/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob 0983f321071f done
Copying config 87837ce2bf done
Writing manifest to image destination
Storing signatures
INFO[0011] Running conmon under slice user.slice and unitName libpod-conmon-148722857d0739cc36a346b4f035448abb0736ea3b10c04132735da82e96b49d.scope
INFO[0012] Got Conmon PID as 21404
INFO[0012] Received shutdown.Stop(), terminating!        PID=21384
➜  podman image ls
REPOSITORY                 TAG         IMAGE ID      CREATED       SIZE
docker.io/library/busybox  latest      87837ce2bf82  3 weeks ago   2.66 MB

expected output:

➜  podman run --log-level=info --syslog busybox echo ok
INFO[0000] ./podman filtering at log level info
INFO[0000] Setting parallel job count to 4
Resolved "busybox" as an alias (/home/pi/.cache/containers/short-name-aliases.conf)
Trying to pull docker.io/library/busybox:latest...
Getting image source signatures
Copying blob 60966b1a2cb7 done
Copying config 9f28bca8fa done
Writing manifest to image destination
WARNING: image platform (linux/arm/v6) does not match the expected platform (linux/arm)
INFO[0009] Received shutdown.Stop(), terminating!        PID=21440
INFO[0010] Failed to add conmon to cgroupfs sandbox cgroup: creating cgroup path conmon: open /sys/fs/cgroup/cgroup.subtree_control: permission denied
INFO[0010] Got Conmon PID as 21459
ok
➜  bin podman image ls
REPOSITORY                 TAG         IMAGE ID      CREATED       SIZE
docker.io/library/busybox  latest      9f28bca8fad0  3 weeks ago   1.91 MB

As we can see, image for arm v7 is downloaded (87837ce2bf82) instead of image for arm v6 (9f28bca8fad0)

I would also expect that explicit notice of the error been returned to the console when running failed (like in docker), however it is not a case here. I believe it is another issue, to be submitted directly to podman repo.
The error 139 is reported in syslog though: conmon fba43d5acde494cff782 <ninfo>: container 2072 exited with status 139

references:

@lstolcman lstolcman force-pushed the rpi-zero-arch-fix branch 2 times, most recently from 0ce4084 to 5cd4ddc Compare August 9, 2023 16:31
Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I know very little about ARM, still, looking at the available documentation, this doesn’t seem to be a very precise fix. Ultimately actually reading the CPU registers directly seems more accurate… but that would require an ARM expert to discuss what the relevant values for the “v6”/“v7” ABI.

Meh, being consistent with containerd seems a good enough of an improvement for now.

internal/pkg/platform/platform_matcher.go Outdated Show resolved Hide resolved
internal/pkg/platform/platform_matcher.go Outdated Show resolved Hide resolved
internal/pkg/platform/platform_matcher.go Outdated Show resolved Hide resolved
// https://www.raspberrypi.org/forums/viewtopic.php?t=12614
// https://github.com/moby/moby/pull/36121#issuecomment-398328286
if runtime.GOARCH == "arm" && variant == "7" {
model, err := getCPUInfo("model name")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking:

Plausibly getCPUInfo could parse everything at once and return a map[key]value. That would remove some of the error paths….

internal/pkg/platform/platform_matcher.go Show resolved Hide resolved
@mtrmac
Copy link
Collaborator

mtrmac commented Aug 11, 2023

I would also expect that explicit notice of the error been returned to the console when running failed (like in docker), however it is not a case here. I believe it is another issue, to be submitted directly to podman repo.

Yes, please file that in https://github.com/containers/podman/issues .

@mtrmac mtrmac added the kind/feature A request for, or a PR adding, new functionality label Sep 4, 2023
@rhatdan
Copy link
Member

rhatdan commented Sep 8, 2023

@lstolcman are you still interested in this PR?

@lstolcman
Copy link
Contributor Author

@rhatdan yes I am. Since I do not have time at the moment to apply the fixes, feel free to do it yourself (or anyone else interested), or I will do once I have some more free time

@lstolcman
Copy link
Contributor Author

@rhatdan @mtrmac please review again

@rhatdan
Copy link
Member

rhatdan commented Dec 17, 2023

LGTM

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Code LGTM. The commit messages do not always match the commit contents; it would probably be simplest to rebase + squash this into one commit now.

Signed-off-by: Łukasz Stolcman <lukasz.stolcman@protonmail.com>
@mtrmac
Copy link
Collaborator

mtrmac commented Jan 2, 2024

Thanks again!

@mtrmac mtrmac merged commit 127a092 into containers:main Jan 2, 2024
10 checks passed
atmosphere-ci bot pushed a commit to vexxhost/atmosphere that referenced this pull request Apr 21, 2024
…1114)

This PR contains the following updates:



Package
Change
Age
Adoption
Passing
Confidence




github.com/containers/image/v5
v5.29.2 -> v5.30.0








WarningSome dependencies could not be looked up. Check the warning logs for more information.


Release Notes

containers/image (github.com/containers/image/v5)
v5.30.0
Compare Source
What's Changed
A fair number of improvements when working with zstd and zstd:chunked-compressed images.
Note that make install now installs policy.json and registries.d/default.yaml.

Refuse compression to zstd when using schema1 by @​mtrmac in containers/image#2196
Don't expose local account details in oci-archive tar files by @​mtrmac in containers/image#2202
Trigger a conversion to OCI when compressing to Zstd by @​mtrmac in containers/image#2204
Add buildtags to avoid fulcio and rekor dependencies by @​siretart in containers/image#2180
copy: do not fail if digest mismatches by @​giuseppe in containers/image#1980
Moving policy.json and default.yaml from containers/skopeo by @​rahilarious in containers/image#2215
Embrace codespell: config, workflow (to alert when new typos added) and get typos fixed by @​yarikoptic in containers/image#2214
Fix raspberry pi zero cpu variant recognition by @​lstolcman in containers/image#2086
storage: validate images converted to zstd:chunked by @​giuseppe in containers/image#2243
Make blob reuse choices manifest-format-sensitive, and allow conversions when writing to format-agnostic transports by @​mtrmac in containers/image#2213
Edit the manifest when pushing uncompressed data from c/storage by @​mtrmac in containers/image#2273
Random storage-related cleanups by @​mtrmac in containers/image#2287
Improve storage transport documentation, primarily about locking by @​mtrmac in containers/image#2291
Fix c/storage destination with partial pulls by @​mtrmac in containers/image#2288
Fix manifest updates when we match a layer by TOC digest by @​mtrmac in containers/image#2294
Cleanly fail when trying to obtain a DiffID of a non-OCI image by @​mtrmac in containers/image#2295
Beautify TOC-related parts of storageImageSource by @​mtrmac in containers/image#2296
storage: use the new ApplyStagedLayer interface by @​giuseppe in containers/image#2301
Also annotate image instances using zstd:chunked as using zstd by @​mtrmac in containers/image#2302
Support editing ArtifactType, preserve it in lists by @​nalind in containers/image#2304
Provide data to correctly report throughput on partial pulls by @​mtrmac in containers/image#2308
Add validation error to digesting reader by @​saschagrunert in containers/image#2312
Fix handling of errors when fetching layers by URLs by @​mtrmac in containers/image#2310
Improve handling of zstd vs. zstd:chunked matching by @​mtrmac in containers/image#2317

New Contributors

@​rahilarious made their first contribution in containers/image#2215
@​yarikoptic made their first contribution in containers/image#2214
@​lstolcman made their first contribution in containers/image#2086
@​bainsy88 made their first contribution in containers/image#2260

Full Changelog: containers/image@v5.29.2...v5.30.0


Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.


 If you want to rebase/retry this PR, check this box


This PR has been generated by Mend Renovate. View repository job log here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for, or a PR adding, new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants