How to create a UBOS development VM for Parallels Desktop on Apple Silicon computers
/docs/development/misc/setting-up-arch-linux/setup-developer-vm-apple-silicon-parallels/
Install Parallels Desktop for Apple Silicon computers
- This is a paid product that can be obtained from https://www.parallels.com/products/desktop/.
Obtain an Arch Linux ARM image
- Download an ISO with the string “latest” in it from https://release.archboot.com/aarch64/latest/iso/.
Run the Arch Linux ARM image as the virtual machine to create the development VM with
-
Run Parallels Desktop. If it asks you to install add-on’s, decline. If it asks you to Install Windows, select “Option Options” instead.
-
In Parallels Desktop, create a new virtual machine:
-
Select “Install Windows, Linux or macOS from an image file”, and “Continue”.
-
Click “select a file” and choose the downloaded ISO.
-
Ignore “Unable to detect operating system” and “Continue”.
-
Select “Other Linux” and “OK”.
-
Enter name: “ubosdev_aarch64-parallels-YYYYMMDD-I” where YYYYMMDD is the date, and I is a number starting with 1. (Don’t add a UBOS channel to the name, as this is Arch.)
-
Check “Customize settings before installation”, accept the other defaults, and “Create”.
-
In the “Hardware” tab, enter 8192 MB for “Memory”. (4096 produces a very strange error message later in the boot.) Leave all other defaults.
-
Close the popup and click “Continue”.
-
-
The VM automatically starts. Accept all defaults until you get to “Hit ENTER for shell login”; that will take a 5-10 minutes. Then hit
^C
to abort. (If you find yourself in the Archboot Arch Linux Installation with its blue background: cancel, and select “Exit Program”.)
Install Arch on the empty disk and configure it
-
Wait for the shell to appear.
-
Update the bootstrap VM and install some packages we need:
# pacman -Sy # pacman -S btrfs-progs gptfdisk parted dosfstools arch-install-scripts vi
-
Zero out the first bytes on the disk for extra robustness:
# dd if=/dev/zero of=/dev/sda bs=1M count=8 conv=notrunc
-
Clear the partition table:
# sgdisk --clear /dev/sda
-
Create the partitions (UEFI, /boot and /) and change them to the right types.
# sgdisk --new=1::+1M /dev/sda # sgdisk --new=2::+512M /dev/sda # sgdisk --new=3:: /dev/sda # sgdisk --typecode=1:EF02 /dev/sda # sgdisk --typecode=2:EF00 /dev/sda
-
Make sure changes are in effect:
# sync # partprobe /dev/sda
-
Create filesystems for partitions other than the UEFI partition:
# mkfs.vfat /dev/sda2 # mkfs.btrfs /dev/sda3
-
Mount the partitions so we can install:
# mount /dev/sda3 /mnt # mkdir /mnt/boot # mount /dev/sda2 /mnt/boot
-
Perform the actual install of the base packages:
# pacstrap /mnt base
-
Generate the right
fstab
:# genfstab -U -p /mnt >> /mnt/etc/fstab
-
Chroot into your future root disk and finish the installation:
# arch-chroot /mnt
-
Add the UBOS keyring so we can install our own packages:
# curl -O https://depot.ubosfiles.net/yellow/$(uname -m)/os/ubos-keyring-0.9-2-any.pkg.tar.xz # pacman -U ubos-keyring-0.9-2-any.pkg.tar.xz # rm ubos-keyring-0.9-2-any.pkg.tar.xz
-
Add the UBOS tools repo:
# echo '' >> /etc/pacman.conf # echo '[ubos-tools-arch]' >> /etc/pacman.conf # echo 'Server = https://depot.ubosfiles.net/yellow/$arch/ubos-tools-arch' >> /etc/pacman.conf
-
Install more packages:
# pacman -Sy # pacman -S linux-aarch64 mkinitcpio amd-ucode sudo vim btrfs-progs \ gdm gnome-console gnome-control-center gnome-session gnome-settings-daemon \ gnome-shell gnome-keyring nautilus \ ubos-tools-arch
If asked which alternatives to install, choose the defaults.
-
Create a ramdisk:
# mkinitcpio -p linux-aarch64
-
Configure the boot loader:
# bootctl --path /boot install
-
Install a locale:
# perl -pi -e 's!#en_US.UTF-8 UTF-8!en_US.UTF-8 UTF-8!' /etc/locale.gen # locale-gen
-
Set up networking:
# echo '[Match]' > /etc/systemd/network/wired.network # echo 'Name=en*' >> /etc/systemd/network/wired.network # echo '' >> /etc/systemd/network/wired.network # echo '[Network]' >> /etc/systemd/network/wired.network # echo 'DHCP=ipv4' >> /etc/systemd/network/wired.network # echo 'IPv4Forwarding=1' >> /etc/systemd/network/wired.network # echo 'IPv6Forwarding=1' >> /etc/systemd/network/wired.network # systemctl enable systemd-networkd systemd-resolved systemd-timesyncd
-
Create a user with the right permissions and no password:
# useradd -m ubosdev # chmod 755 ~ubosdev # passwd -d ubosdev # echo ubosdev ALL = NOPASSWD: ALL > /etc/sudoers.d/ubosdev # chmod 600 /etc/sudoers.d/ubosdev
-
No root password:
# passwd -d root
-
Exit from the
arch-chroot
shell with^D
.
-
-
Remainder of networking setup:
# rm /mnt/etc/resolv.conf # ln -s /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf
-
Configure UEFI:
-
Loader configuration:
# echo timeout 4 > /mnt/boot/loader/loader.conf # echo default arch >> /mnt/boot/loader/loader.conf
-
Boot entry configuration:
# echo title Arch > /mnt/boot/loader/entries/arch.conf # echo linux /Image >> /mnt/boot/loader/entries/arch.conf # echo initrd /amd-ucode.img >> /mnt/boot/loader/entries/arch.conf # echo initrd /initramfs-linux.img >> /mnt/boot/loader/entries/arch.conf # echo options root=PARTUUID=$(lsblk -o PARTUUID /dev/sda3 | tail -1 ) rootfstype=btrfs rw cgroup_disable=memory add_efi_memmap >> /mnt/boot/loader/entries/arch.conf
-
-
Power off the virtual machine:
# systemctl poweroff
-
Remove the ISO file from the VM:
- In the Parallels Control Center, select the “ubosdev_aarch64-parallels-YYYYMMDD-I” VM, right-click, and select “Configure…”.
- In the “Hardware” tab, select CD/DVD.
- In the “Source” drop-down, select Disconnect.
- Close the Configuration window.
Remaining configuration
-
Start the VM again.
-
At the console, log in as
ubosdev
. There is no password. -
Fix the locale (command won’t run earlier)
% sudo localectl set-locale LANG=en_US.UTF-8
-
Enable Gnome:
% sudo systemctl enable gdm
-
Power off the virtual machine:
% sudo systemctl poweroff
Create a virtual appliance for distribution
-
In the Parallels Control Center, right-click on the “ubosdev_aarch64-utm-YYYYMMDD-I” VM and select “Prepare for transfer”.
-
Click “Continue” and wait for the “Packing” process to finish. The VM now has subtitle “Package” and the gears icon has disappeared.
-
Right-click on the VM again, and select “Show in Finder”.
-
Copy the file with a name that also contains the processor architecture, the current date and an index:
ubosdev_aarch64-parallels-YYYYMMDD-I.pvmp
, e.g.ubosdev_aarch64-parallels-20240405-1.pvmp
. (Don’t add a UBOS channel to the name, as this is Arch.)