Running a NetBSD Virtual Machine on VMware ESXi on Arm Fling

Dies ist ein Gastbeitrag von meinem geschätzten Kollegen Jörn Clausen. Der Beitrag wurde in englischer Sprache verfasst und behandelt die Installation von NetBSD auf dem VMware ESXi on ARM Fling.

In October 2020, VMware released a preview of their hypervisor ESXi for
the ARM architecture. It is free to download (registration needed, though) and will run for 180 days, and one of the supported platforms is the Raspberry Pi 4B. So it’s quite easy to give it a try. To install the ESXi ARM Fling, use the instructions you’ll find at the download page. The ESXi installation is not covered by this article.

A lot of Linux distributions and FreeBSD are working as guest OSes, and luckily NetBSD’s motto holds up: „Of course it runs NetBSD!“. Thanks to the work of Jared McNeill, the ARM port of NetBSD will run on ESXi for ARM.

As his instructions for creating a running NetBSD VM are a bit terse, I’d like to elaborate a little bit.

Prerequisites

You will need the following things:

  • ESXi on Arm Fling up and running (duh!)
  • SSH access to the ESXi host (activate either from the console or the
    web interface)
  • qemu-img, for example by installing emulators/qemu from
    pkgsrc

And of course you will need NetBSD. Download the latest installation image either from Jared’s site „https://www.armbsd.org/arm/“ (be sure to download „Generic 64-bit“ from the tab „NetBSD -current“), or use the latest HEAD release: „https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz

Creating a NetBSD VMDK file

Unpack the image:

$ gunzip arm64.img.gz

Increase the image to the size the hard disk should have. In this case, we grow it to just 2 GB:

$ qemu-img resize -f raw arm64.img 2g
Image resized.

Convert the image to a VMDK file

$ qemu-img convert -o compat6 -f raw arm64.img -O vmdk arm64.vmdk

Transfer the last file arm64.vmdk to the datastore on the ESXi host, either using scp or by uploading it via the web interface.

Creating a NetBSD VM

Log on to the ESXi host using ssh. Navigate to the directory where you uploaded the VMDK file. If you used a basic setup with all the defaults, this will be /vmfs/volumes/datastore1/.

Convert the VMDK file to a proper virtual hard disk:

# vmkfstools -i arm64.vmdk -d thin arm64-hd.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'arm64.vmdk'...
Clone: 100% done.

Switch to the web interface of ESXi and create a new VM. Use „Other“ as Guest OS family and „Other (64-bit)“ as Guest OS version.

Remove the hard disk that is automatically added to the VM. Instead, select „Add hard disk“ and „Existing hard disk“. Choose the VMDK you created in the last step (be sure to use arm64-hd.vmdk and not arm64.vmdk).

You can use the default network adapter (E1000e) or you can replace it with the paravirtualized one (VMXNET3).

Running the NetBSD VM

Now start the VM and open the console. The virtual machine should boot straight into the NetBSD boot loader and then into NetBSD. On the first boot, NetBSD will grow the filesystem to use the complete hard disk and reboot. After that, you should be able to login as root.

Now you have a complete NetBSD system. You can even run an X server on the console.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.