Skip to content

vm: detect Rosetta via Virtualization.framework - #1658

Open
malensek wants to merge 1 commit into
abiosoft:mainfrom
malensek:fix-rosetta-detection
Open

malensek wants to merge 1 commit into
abiosoft:mainfrom
malensek:fix-rosetta-detection

Conversation

@malensek

Copy link
Copy Markdown

Previously (see issue #1069), Colima checked for the presence of Rosetta with pgrep oahd for the VZ VM type. However, this check can falsely report that Rosetta is not available:

  • oahd may not be running if a GUI login has not occurred yet.
  • On macOS 27, Linux translation is integrated into the OS and does not require Rosetta to be installed beforehand.

In both cases, Colima outputs "Rosetta2 is not installed" and falls back to QEMU, even though the VZ VM would work and be supported by Lima.

Fix

This change adds a helper, RosettaLinuxInstalled() in util/macos.go that queries VZLinuxRosettaDirectoryShare.availability via osascript, which is essentially the same check Lima does upstream (see pkg/driver/vz/rosetta_directory_share_arm64.go). My feeling is that since Colima is not using cgo, it is a better approach to shell this out to osascript like some of the other platform checks already do. If the check fails or Rosetta is not supported by the host, the Rosetta option is enabled so that the final check can be deferred to Lima.

Testing

  • A test was added for verifying the resulting configuration.
  • I verified that this worked properly (both headless and logged into the GUI) on macOS 26.6.2 and macOS 27.0.1, both with regular user accounts as well as the root user.

@malensek
malensek marked this pull request as ready for review October 26, 2026 23:01
@malensek
malensek force-pushed the fix-rosetta-detection branch from 5fc2755 to 442281a Compare October 27, 2026 05:38
Previously, Colima checked for the presence of Rosetta with `pgrep oahd`
for the `VZ` VM type. However, this check can falsely report that
Rosetta is not available:
* `oahd` may not be running if a GUI login has not occurred yet.
* On macOS 27, Linux translation is integrated into the OS and does not
  require Rosetta to be installed beforehand.

This change queries VZLinuxRosettaDirectoryShare.availability via
`osascript`, which is essentially the same check Lima does upstream.  If
the check fails or Rosetta is not supported by the host, the Rosetta
option is enabled so that the final check is deferred to Lima.

Signed-off-by: Matthew Malensek <malensek@stanford.edu>
@malensek
malensek force-pushed the fix-rosetta-detection branch from 442281a to 487fcfa Compare October 27, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant