Hello there,
I’m running NixOS in UTM on Mac OSX. I’m trying to use rosetta. I’m following UTM tuttorial on this topic and managed to mount rosseta but I seems to not be able to register it. There is this step:
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
Which I roughly translated to configuration.nix
as:
boot.binfmt.registrations. "x86_64-linux" = {|
magicOrExtension = "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\50\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";
openBinary = true;
interpreter = "/mnt/rosetta/rosetta";
preserveArgvZero = true;
matchCredentials = true;
fixBinary = true;
};
But I’m getting error that:
Failed assertions:
- boot.binfmt.registrations. "x86_64-linux" cannot have fixBinary when the interpreter is invoked through a shell.
So I tried to set fixBinary to false and then rebuild ends up in:
warning: the following units failed: systemd-binfmt.service x systemd-binfmt.service - Set Up Additional Binary Formats
Loaded: loaded (/etc/systemd/system/systemd-binfmt.service; enabled; presets: ignored)
Drop-In: /nix/store/x4jpxyf1z14vc14vx7715r2h060n8slz-system-units/systemd-bianfmt.service.d
-overrides.conf
Active: failed (Result: exit-code) since Mon 2025-03-24 20:13:00 CET; 295ms ago
Invocation: cf279713dcee4ba798e4d50e8cf9e6bc
Docs: man: systemd-binfmt.service (8)
man: binfmt.d(5)
https://docs.kernel.org/admin-guide/binfmt-misc.html
https://systemd.10/API_FILE_SYSTEMS
Process: 1604 ExecStart=/nix/store/4mqnz22j9nm5c9fwaph2jxzlba9zlnab-systemd-256.10/lib/systemd/systemd-binfmt (code=exited, status=1/FAILURE)
Main PID: 1604 (code=exited, status=1/FAILURE)
IP: 0B in, OB out
I0: 136K read, 0B written
Mem peak: 1.5M
CPU: 3ms
Mar 24 20:12:59 master systemd[1]: Starting Set Up Additional Binary Formats...
Mar 24 20:13:00 master systemd-binfmt [1604]: /etc/binfmt.d/nixos.conf:1: Failed to add binary format 'x86_64-linux': Invalid argument
Mar 24 20:13:00 master systemd [1]: systemd-binfmt.service: Main process exited, scode=exited, status=1/FAILURE
Mar 24 20:13:00 master systemd [1]: systemd-binfmt.service: Failed with result 'exit-code'.
Mar 24 20:13:00 master systemd [1]: Failed to start Set Up Additional Binary Formats.
warning: errors) occurred while switching to the new configuration
Compilation exited abnormally with code 1 at Mon Mar 24 20:13:00, duration 8.85
I did not setup spice tools yet so if there is minor typo or something, it is because I copied those lines using OCR.
Anybody have experience with this, know how to resolve it?
Thank you.