I didn’t actually validate these instructions but this wiki looks pretty helpful for doing the actual installation of Ubuntu into Virtualbox. Basically, just create a new VirtualBox machine from the “Machine” menu, make sure to add a disk (VDI mode); then edit the machine settings and add the Ubuntu ISO to the IDE Storage controller as a CDROM device. Then boot the machine and select the “Install Ubuntu” option. Once that completes, power off the virtual machine.
Now you need to convert the VDI image to raw format. Note that this will create a file as large as you specified the disk to be, so make sure you have sufficient disk space. On my Ubuntu Laptop, the disk image is stored in “/home/dmoseley/Documents/VirtualBox/Ubuntu 18/Ubuntu 18.vdi”. It may be different in your case:
$ VBoxManage clonehd ~/Documents/VirtualBox/Ubuntu\ 18/Ubuntu\ 18.vdi /work/dmoseley/scratch/foo.img --format raw
This foo.img file should be usable with mender-convert however please note that we have not added support for Ubuntu/X86 in mender-convert yet so you will likely have further development to do to get this to work.
HTH,
Drew