Skip to content

Create Ubuntu ISO for VMM

To use VMM, the ISO image you provide must support the serial console. In this guide,

we download and modify the ubuntu ISO to boot from serial console.

Download and verify ISO

$ ftp https://releases.ubuntu.com/20.04.2/ubuntu-20.04.2-live-server-amd64.iso
$ ftp https://releases.ubuntu.com/20.04.2/SHA256SUMS
$ ftp https://releases.ubuntu.com/20.04.2/SHA256SUMS.gpg

If gpg is not already installed:

$ doas pkg_add gnupg


$ gpg --keyserver keyserver.ubuntu.com --recv-keys 843938DF228D22F7B3742BC0D94AA3F0EFE21092
gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
$ gpg --verify SHA256SUMS.gpg SHA256SUMS
gpg: Signature made Thu Feb 11 13:07:58 2021 CST
gpg:                using RSA key 843938DF228D22F7B3742BC0D94AA3F0EFE21092
gpg: Good signature from "Ubuntu CD Image Automatic Signing Key (2012) <cdimage@ubuntu.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
$ sha256 ubuntu-20.04.2-live-server-amd64.iso
SHA256 (ubuntu-20.04.2-live-server-amd64.iso) = d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423
$ grep ubuntu-20.04.2-live-server-amd64.iso SHA256SUMS
d1f2bf834bbe9bb43faf16f9be992a6f3935e65be0edece1dee2aa6eb1767423 *ubuntu-20.04.2-live-server-amd64.iso

The two checksums must match perfectly or else you should stop installation.

We run these steps as root:

# vnconfig vnd0 ubuntu-20.04.2-live-server-amd64.iso
# mkdir old new
# mount /dev/vnd0c old
# cp -R old/* new
# cp -R old/.disk new
# umount old
# vnconfig -u vnd0

Make Changes

Here are the diffs of the changes we make:

diff -ru old/isolinux/isolinux.cfg new/isolinux/isolinux.cfg
--- old/isolinux/isolinux.cfg   Mon Feb  1 11:57:37 2021
+++ new/isolinux/isolinux.cfg   Sun Aug 22 00:34:12 2021
` -1,5 +1,7 `                                                               
 # D-I config version 2.0
 # search path for the c32 support libraries (libcom32, libutil etc.)
+serial 0 115200                       
+console 0
 path 
 include menu.cfg
 default vesamenu.c32
diff -ru old/isolinux/rqtxt.cfg new/isolinux/rqtxt.cfg
--- old/isolinux/rqtxt.cfg      Mon Feb  1 11:57:37 2021
+++ new/isolinux/rqtxt.cfg      Sun Aug 22 01:12:25 2021
` -1,4 +1,4 `
 label rescue
        menu label ^Rescue mode
        kernel /install/vmlinuz
-       append vga=788 initrd=/install/initrd.gz rescue/enable=true --- quiet
+       append vga=normal initrd=/install/initrd.gz rescue/enable=true --- console=ttyS0,115200n8
diff -ru old/isolinux/txt.cfg new/isolinux/txt.cfg
--- old/isolinux/txt.cfg        Mon Feb  1 11:57:37 2021
+++ new/isolinux/txt.cfg        Sun Aug 22 00:35:37 2021
` -2,11 +2,11 `
 label live
   menu label ^Install Ubuntu Server
   kernel /casper/vmlinuz
-  append   initrd=/casper/initrd quiet  ---
+  append vga=normal initrd=/casper/initrd --- console=ttyS0,115200n8
 label hwe-live
   menu label ^Install Ubuntu Server with the HWE kernel
   kernel /casper/hwe-vmlinuz
-  append   initrd=/casper/hwe-initrd quiet  ---
+  append vga=normal initrd=/casper/hwe-initrd --- console=ttyS0,115200n8
 label memtest
   menu label Test ^memory
   kernel /install/mt86plus

Generate ISO

# pkg_add xorriso
# xorriso -as mkisofs -r -J -joliet-long -l -cache-inodes -partition_offset 16 -A "Ubuntu/VMM" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ubuntu-20.04.2-live-server-amd64-vmm.iso ./new

VMM

In /etc/vm.conf, we update the cdrom image:

vm "username" {
        owner username
        memory 1024M
        cdrom "/home/iso/ubuntu-20.04.2-live-server-amd64-vmm.iso"
        disk /home/username/username.qcow2
        interface { 
                locked lladdr aa:bb:cc:dd:ee:ff
                switch "switch0"
        }
}

Install

When presented with the boot menu, type help:

boot: help

It will then autoboot in serial console mode.

Install grub into /dev/vda

Ideas taken from: https://giocher.com/words/2018/ubuntu-on-openbsd-vmm/