Trouble getting Centos 9 binfmt support as guest VM on UTM (original) (raw)

January 14, 2025, 8:41pm 1

I’m trying to use Centos 9 (stream) as a guest OS with UTM on my Mac. My Mac is an M1, and I’m trying to enable Rosetta support.

There’s some things that the VM guest OS needs installed to work with the virtualization host, and one of them is the binary update-binfmts.
For Centos 9, I can’t figure how to find update-binfmts (which is “typically” in package binfmt-support).

Does anyone have experience with using Centos 9 as a VM OS in UTM with Rosetta? Do you know where I can find update-binfmts or the equivalent?

Reference: “Enabling Rosetta” in Rosetta | UTM Documentation

thanks!

charles2 (Charles) January 14, 2025, 10:12pm 2

Fedora doesn’t have x86_64 libraries on aarch64 so it probably won’t work on CentOS either. Debian does and is what the guide is written for.

smooge (Stephen J Smoogen) January 15, 2025, 11:50am 3

I have not had much luck with UTM rosetta and have gone with native aarch64 on the M series instead. The trick I found though is that changes in grub/kernel after RHEL-9.4 require the usage of UTM applehv versus the qemu one. For whatever reason if I updated Ubuntu/Fedora/CentOS Stream linux after a specific kernel/grub update, it would hang on boot. I ended up using the ‘experimental’ apple virtual machine and the systems work flawlessly.

tqcharm (Mike B.) January 15, 2025, 2:12pm 4

I second UTM with Apple Virtualization on an M1 Mac. Using Fedora VMs with no issues whatsoever.

itsayellow (Matt Clapp) January 15, 2025, 2:32pm 5

I am using (the “experimental”) Apple Virtualization on an M1 Mac. I have Rosetta setup in UTM, and also mounted via virtiofs inside the Centos 9 Stream guest. That all seems to work fine.

My problem is I don’t understand how to register /media/rosetta inside the guest Centos as the emulator for x86_64 binaries. The instructions say to use the utility update-binfmts to register rosetta inside the guest OS, but I can’t find that binary or its parent package on Centos.

Is there another way to register rosetta in the guest OS to handle x86_64 binaries?

itsayellow (Matt Clapp) January 15, 2025, 2:35pm 6

Here’s the command the instructions say to use that works on other linuxes I’ve used:

$ sudo /usr/sbin/update-binfmts --install rosetta /media/rosetta/rosetta \
     --magic "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00" \
     --mask "\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \
     --credentials yes --preserve yes --fix-binary yes

I don’t know how to either find update-binfmts or what an alternative is for Centos.

tqcharm (Mike B.) January 15, 2025, 3:03pm 7

Package binfmt-support doesn’t seem to be shipped by Fedora (and probably by CentOS either). Debian-based distros seem to have it.

You might need to work with the source code.

Fedora Asahi Remix also has some documentation about x86-support, in case it might help.

itsayellow (Matt Clapp) January 17, 2025, 9:52pm 8

Thanks all for the help.

For the record, you can do by hand what update-binfmts is doing using binfmt-misc: Kernel Support for miscellaneous Binary Formats (binfmt_misc) — The Linux Kernel documentation

But it’s more annoying and manual.

In the end the fact that centos 9 doesn’t really have support for mult-arch meant that even though I got binaries running with emulation, it was really painful and I don’t recommend it on this flavor of Linux. Ubuntu and Debian have much better, easier multi-arch support.