Install a Ubuntu 22.04 Server Virtual Machine (VM) via bhyve
My wiki Install a FreeBSD13 VM via bhyve, describes how to install vm-bhyve and config most of the vm-bhyve in host (FreeBSD) system. This page mainly describes additional actions to make a Ubuntu 22.04 server VM work.
install additional VM tool
cc@n1:/ % sudo pkg install grub2-bhyve //required to run Linux or any other guests that need a Grub bootloader
my Ubuntu 22.04 server VM config file
The "grub_run_partition" is found in the section next. Here only lists important configs for the Ubuntu VM, other duplicated configs can be found in Install a FreeBSD13 VM via bhyve.
% cat .templates/linux.conf guest="linux" loader="grub" grub_run_partition="gpt2" grub_run_dir="/grub"
install the Ubuntu 22.04 server VM from ISO
The "-f" option gives the console output for the installation to proceed. Hostname shall have no underscore "_" or dash "-". And make sure the ISO install image is in the ".iso" directory.
% sudo vm create -t linux -s 100G n1linuxvm % sudo vm install -f n1linuxvm ubuntu-22.04.3-live-server-amd64.iso
how to find grub partition
If you encountered the "grub>" prompt after successfully finished installation and reboot, like myself, then you can find the grub partitions like this.
grub> ls (hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1) (host) (lvm/ubuntu--vg-ubuntu--lv) grub> ls (hd0,gpt2)/grub unicode.pf2 i386-pc/ gfxblacklist.txt grub.cfg locale/ fonts/ grubenv
start a console
The "-f" option gives the console output. I have not figured out how to use "vm console" on this Linux VM.
% sudo vm start -f n1linuxvm