-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
applehv: Rosetta support #21670
applehv: Rosetta support #21670
Conversation
Why would a user ever disable this? Shouldn't this be on by default? |
To activate Rosetta, you must mount the Rosetta directory on your Linux OS and add the magic code to binfmt_misc. Some users may want to remove this as an afterthought. |
Ephemeral COPR build failed. @containers/packit-build please check. |
Man page needs to be updated as well. @edsantiago are we verifying man pages for podman machine? |
Yes,
|
Hi, before you push again, please rebase on current main. This will be necessary to check man pages and to avoid breaking future main. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of points, AFAIK rossetta only emulates x86_64 on arm macs:
applehv is also support on intel macs so we cannot do the mounts/setup there at all. This code has to handle it.
Also do we really need to set option? Just keep things simple who has to realistically switch this?
Also I don't like that the flag is added on non apple platforms. It would make much more sense to hide this flag when machine is not running on macos.
Also @baude PTAL
@tnk4on i did an initial pass on your PR, but given this is a big change, i hit the big topics first ... thorough code reviews will need to be done once we decide how this fits in podman machine. my biggest comment, which is a repeated here and there in the review, is that rosetta should be enabled via containers common. this keeps it out of podman docs proper, out of the cli, and structs that are supposed to be general in use. However, i would like the rest of the maintainers of machine to comment: @Luap99 @mheon @ashley-cui @n1hility @rhatdan ptal @cfergeau PTAL how are you thinking about enabling rosetta? And finally, should this be held for after we branch? |
3c1ab1e
to
0ca90ce
Compare
@baude I appreciate your review and your comments ! |
I agree that containers.conf in the machine section is the proper place for this. I don't think the CLI option is necessary since I don't think people will be changing back and forth. I do believe most users will want Rosetta=true, since building x86 images on Mac Arm platforms is going to be very common. |
Thanks for the contribution! This looks super promising! One small formatting nit: all files need to end with a newline. |
Thank you all for your comments and reviews. My understanding is that I need to send a PR to containers/common ,right? github.com/containers/common/pkg/config/default.go
github.com/containers/common/pkg/config/config.go
|
Sorry for the late comment:
I agree this should just always be on for apple silicon. The only reason to change this is in the rare case you want qemu-user-static to take precedence, which would be a fairly specialized situation. Only case I think of that happening is if there is some bug in rosetta, which breaks a container you need to run, so you need to temporarily apply a workaround.
IMO there are two issues with it being only specifiable in containers.conf:
I think it's inevitable that we will need provider specific settings, but agree it can create a problem with MxN parameter clutter across providers. I can think of two ways we could handle that
Although not suggesting we do this now. With Rosetta could just wait until someone actually needs it to be turned off. |
@@ -62,7 +63,13 @@ var _ = BeforeSuite(func() { | |||
if pullError != nil { | |||
Fail(fmt.Sprintf("failed to pull wsl disk: %q", pullError)) | |||
} | |||
|
|||
if testProvider.VMType() == define.AppleHvVirt { | |||
cmd := exec.Command("softwareupdate", "--install-rosetta", "--agree-to-license") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this download anything?
I rather have this not be part of the actual test code and part of the CI setup somewhere.
@cevich How easy is this do add to the macos runners by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, download a small file. This requires an Internet connection.
https://support.apple.com/en-us/102527
% du -sh /Library/Updates/Rosetta/SoftwareUpdate/RosettaUpdateAuto.pkg
380K /Library/Updates/Rosetta/SoftwareUpdate/RosettaUpdateAuto.pkg
I agree with including it in the CI setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming it requires privileges to install, then it must be installed during the setup where sudo
is available. Note: After making the addition there, it will take a few days before all the Macs in the testing pool have the change.
Though I'm afraid the softwareupdate
command might fail, doesn't that require the machine to be "attached" (don't know the term) to the Apple mothership via some login?
In either case, somebody (probably me) with privileges to our EC2 dedicated hosts will be needed to test the change (assuming it's possible). Testing setup.sh
changes cannot be automated in any trivial way, since there's a 3-hour turnaround for a fresh machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I have tried, install-rosetta does not require sudo.
I don't know how often Apple updates, but I am concerned about doing a CI setup for every update of the rosetta pkg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I guess the answer is simple, the CI currently passes because that command works just fine as user. I assume you only added this because CI failed without it @tnk4on?
So yes in this case I think we really should add this this to the runner setup, because I Really do not want this in the test suite. This stuff can be run locally by users so we should never install dependencies without their knowledge.
I think we we can add it to contrib/cirrus/mac_runner.sh temporarily until we have it in the proper runner seup linked by @cevich
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we we can add it to contrib/cirrus/mac_runner.sh
Keep in mind these Mac's are shared by multiple tasks and multiple PRs (not at the same time). If you add it into that script, maybe wrap it in a condition that checks if it's already installed first?
doing a CI setup for every update of the rosetta pkg.
The Macs servicing CI are recreated roughly every 24 hours. If/when it's installed in the big setup.sh
script, any updates would be picked up over time. This isn't ideal, since multiple runs of a PR could net different results depending on which Mac you get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you move this command into contrib/cirrus/mac_runner.sh
for now. Possibly checking if it is already installed before calling this command.
I don't like this being in the test code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can work on a proper integration in the automation repo later but for now we should get this merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened a Jira card to track this.
pkg/machine/ignition/ignition.go
Outdated
{ | ||
Enabled: BoolToPtr(true), | ||
Name: "unregister-handler.service", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just so we do not forget, if we go a ahead with containers/podman-machine-os#8 this must be removed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it, and latest machine-mac CI passed !
Cockpit tests failed for commit 02be9b4. @martinpitt, @jelly, @mvollmer please check. |
@Luap99 @baude @ashley-cui PTAL |
@tnk4on Any reason this has the Hold Label? |
@rhatdan I think we are still not done deciding whether to pre-install rosetta on the mac CI mothership in this discussion(#21670 (comment)). |
Enough users hitting issues on qemu-user-static, so I would like to get this on by default and see if it works. |
@tnk4on Also if you don't mind I prefer the commits to be squashed because the later commits fixes code from the previous commit in this PR so it doesn't really make sense to have them separated. |
Signed-off-by: Shion Tanaka <[email protected]>
Ephemeral COPR build failed. @containers/packit-build please check. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, tnk4on The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
34d2d20
into
containers:main
Let's get this in the next release |
@mheon: new pull request created: #22757 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This PR adds Rosetta support to the AppleHV Podman machine(only v5).
Rosetta is only available on macOS with Apple Silicon.
With Rosetta, the execution performance is several times better than QEMU emulation.
https://developer.apple.com/documentation/virtualization/running_intel_binaries_in_linux_vms_with_rosetta
Todo
CLI option docsrosetta.InstallRosetta
vfkit optionNote
[SELinux context] > resolved
Perhaps because of the use of vfkit, the SELinux context needs to be with*exec_t
when mounting the Rosetta directory.On lima and UTM which support Rosetta, it can be executed withnfs_t
without error.https://github.com/lima-vm/lima/blob/88c89165273d87b33753a593af867b20c1d1c67d/pkg/cidata/cidata.TEMPLATE.d/boot/05-rosetta-volume.sh#L22Does this PR introduce a user-facing change?
[no new tests needed]