Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15133

Virtualization • CHR using Apple Virtualization Framework (via UTM)

$
0
0
I'd been experiment using Apple Virtualization Framework (https://developer.apple.com/documentati ... ualization) using the option in MacOS-version of UTM (https://mac.getutm.app).

I normally using VMWare Fusion/ESXi. But UTM (in Apple, NOT QEMU, mode) seems to work okay in my limited testing for a few Linux images. For a lark, I wanted to try CHR using UTM+AppleVMF. Issue is Apple's Virtualization Framework ONLY support UEFI, which CHR – for some unknown reason includes EFI boot files, but the diskpart stuff isn't right.

As it turns out, I somehow got it work. I use CHR on Mac for testing configscripts, so "working" is about all I need. I tried to write up what I did, but post if you try and doesn't work. I do know that CHR does not show the logon prompt on the emulated video display (although the serial port is mirrored as the screen shown below) but serial port and network work fine. /tool/speed-test in a UTM+Apple VM matched a similar bridged network using VMWare Fusion. Since UTM+Apple (e.g. no QEMU) uses less CPU and boot WAY quicker than VMWare Fusion, so far pretty good.

Image



This post had the clue on UEFI issues with CHR: viewtopic.php?p=1025068&hilit=UEFI#p933799
While I did NOT use the script...the post was 100% correct:
For some reason, Mikrotik does actually includes the right bits for UEFI support...but UEFI requires a FAT16 partition — NOT the ext2 that's the boot partition in the CHR .IMG file — so CHR does not work unless some Legacy BIOS is used (which Apple, and other VM platforms, do not offer).

The Mikrotik's help for CHR on Vultr has the big clue to how to avoid needing a script (which will not work on Mac) — boot to the SystemRescure image. See https://help.mikrotik.com/docs/display/ ... stallation

So the Vultr instruction ALMOST works for UTM + Apple Virtualization: e.g. booting UTM with Apple Virtualization enabled to the "SystemRescueCD"... But those need to be COMBINE with the @kriszos to convert the IMG file's partition from ext2 to fat16. Most of the write up below is the process involved in that...

Inside UTM, select:
- hit "+" to add a new VM
- select "Linux" as the type
- check the "Use Apple Virtualization" box
- pick the SystemRescueCD as the "Boot ISO" (after downloading the ISO: https://www.system-rescue.org)
- pick cores/memory as desired
- pick a disk size - RouterOS does not need a big disk... I used 1GB but can be smaller/bigger as desired
- skip shared directory (hit continue)
- now, pick a name for the VM, I used "AppleCHR" and IMPORTANTLY check "Open VM Settings"
- dialog with VM setting will appear:
- under Network, you may to change to use "Bridge" mode (or add more network interface... or less likely, use shared if you really like multiple NATs)
- under Devices section, use "+ New..." to add a "Serial" port (below item network) – default is bring up serial port a new window which is what you want
- reviews other setting, but serial above is about only CRITICAL thing to add
- hit "Save"
- in UTM main window hit Play icon to start the new VM


I'm guessing Vultr is more forgiving than Apple about UEFI. The solution to this is same as @kriszos post above allude: convert the ext2 partition to fat16. And this can be done after the "dd" in SystemRescueCD. The specific steps I used:
- follow other steps from https://help.mikrotik.com/docs/display/ ... stallation
- at same SystemRescueCD's terminal...
- "mountall" after CHR has been extracted/copyed to the /dev/vda disk
- "mkdir /tmp/vda1" to create folder to store RouterOS EFI files in ext2 boot partition
- "cp -r /dev/vda1/* /tmp/vda1" to copy the EFI files
- "umount /dev/vda1" and "umount /dev/vda2" to un-mount the boot and main partitions
- "startx" - to launch X11 (probably some CLI to "parted" work too, but GUI is helpful with disks IMO)
- Hit the icon for "gparted" in the task bar (or run "gparted" from a Terminal in X11 desktop)
- Use the drop-down in upper left to select the /dev/vda disk. You should see two partitions: one ext2 and one ext4.
- Right click on the first one, marked "boot" on right, and select format.
- Pick "fat16" as the format type. This will "cue" the operation.
- Next commit the, use menus or hit the green checkbox in toolbar. Assuming it says success in status window & still marked "boot"...closed gparted.
- Bring up a terminal window from menu/taskbar, and again type "mountall"
- At same terminal, use "cp -r /tmp/vda1 /dev/vda1" to copy the original files back to the re-formatted 1st partition.
- Finally "poweroff"
- CHR should be "installed" and bootable at this point, except you need to remove the SystemRescueCD from UTM – since it will boot to RouterOS at this point.

Note: I only tested on Intel Mac – but I believe UTM with Apple Virtualization framework will work on M1/M2/M3 (ARM) Mac via Rosetta. If someone tries, that LMK if it works.

Statistics: Posted by Amm0 — Tue Feb 20, 2024 5:25 am



Viewing all articles
Browse latest Browse all 15133

Trending Articles