

The following command will scale up the display output by a factor of 2: $ VBoxManage setextradata "Ubuntu 20.04" GUI/ScaleFactor 2 The Ubuntu installer runs with a resolution of 800圆00 and would look tiny on HiDPI screens if we wouldn't scale up the display output. $ VBoxManage storageattach "Ubuntu 20.04" -storagectl "IDE Controller" -port 0 -device 0 -type dvddrive -medium ~/Downloads/ubuntu-20.04.1-desktop-amd64.iso The VM will boot from this drive first when starting: $ VBoxManage storagectl "Ubuntu 20.04" -name "IDE Controller" -add ide We also create a dvd drive with the Ubuntu ISO mounted in it. $ VBoxManage storageattach "Ubuntu 20.04" -storagectl "SATA Controller" -port 0 -device 0 -type hdd -medium ~/VirtualBox\ VMs/Ubuntu\ 20.04/Ubuntu\ 20.04.vdi $ VBoxManage storagectl "Ubuntu 20.04" -name "SATA Controller" -add sata -bootable on A minimal Ubuntu installation takes about 5GB of space: $ VBoxManage createhd -filename ~/VirtualBox\ VMs/Ubuntu\ 20.04/Ubuntu\ 20.04.vdi -size 20480 -variant Standard We create an empty 20GB hard drive that we can install Ubuntu on. Next we need to configure the storage devices. The current values can be seen with VBoxManage showvminfo "Ubuntu 20.04". To see all available options run VBoxManage modifyvm which will output a list of all flags. In the above command I've also enabled USB and set the Graphics Controller to VMSVGA which is the default controller when using the GUI but set to the legacy VBoxVGA when using the CLI. $ VBoxManage modifyvm "Ubuntu 20.04" -cpus 2 -memory 4096 -vram 128 -graphicscontroller vmsvga -usbohci on -mouse usbtablet We'll increase it to use 2 CPU cores, 4GB RAM and 128MB VRAM: $ VBoxManage createvm -name "Ubuntu 20.04" -ostype Ubuntu_64 -register The default settings use 1 CPU core, 128MB RAM and 8MB VRAM which is not enough. We first create the VM and increase the hardware resources.

The scaling commands can be ignored for non-HiDPI displays.

I've tested this on an apple laptop with retina (HiDPI) display and included instructions to scale the display output. I'm assuming that VirtualBox 6.1 is installed, the VBoxManage CLI is ready to use and the Ubuntu 20.04 ISO has been downloaded. This tutorial describes the installation of Ubuntu 20.04 in VirtualBox by using the VBoxManage CLI. Using the VBoxManage CLI to create a Ubuntu 20.04 VM Home Using the VBoxManage CLI to create a Ubuntu 20.04 VM September 11, 2020
