VBoxManage unattended installation of Debian/Ubuntu waits for input

When I launch an unattended install with VirtualBox and Debian 9 / Ubuntu 18.0.4, the installation stops on the screen where the country is to be selected:

Language selection in Debian 9 Language selection in Ubuntu Server 18.0.4 LTS

This is my command line:

VBoxManage unattended install $VMNAME --user=$OSUSERNAME --password=$OSPASSWORD --country=UK --time-zone=UTC --hostname=testserver.local --iso=./build/$ISOFILENAME --install-additions

VBoxManage startvm $VMNAME --type headless

I have also tried the hints given in the VirtualBox documentation, which lists an additional parameter for the language:

VBoxManage unattended install $VMNAME --user=$OSUSERNAME --password=$OSPASSWORD --country=UK --time-zone=UTC --hostname=testserver.local --iso=./build/$ISOFILENAME --install-additions --language=en-US

... no success. This is the output of the scripts:

VBoxManage: info: Preparing unattended installation of Ubuntu_64 in machine 'testserver' (e643e8fd-28f9-466b-a390-5ca21df28a8b).
VBoxManage: info: Using values:
                           isoPath = /Users/me/Dev/vboxinstall/build/ubuntu-18.04.2-live-server-amd64.iso
                              user = TEST
                          password = TEST
                      fullUserName = 
                        productKey = 
                  additionsIsoPath = /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso
             installGuestAdditions = true 
              validationKitIsoPath = 
            installTestExecService = false
                            locale = en_US
                           country = US
                          timeZone = EAT
                             proxy = 
                          hostname = testserver.local
       packageSelectionAdjustments = 
                 auxiliaryBasePath = /Users/me/VirtualBox VMs/testserver/Unattended-e643e8fd-28f9-466b-a390-5ca21df28a8b-
                        imageIndex = 1
                scriptTemplatePath = /Applications/VirtualBox.app/Contents/MacOS/UnattendedTemplates/ubuntu_preseed.cfg
     postInstallScriptTemplatePath = /Applications/VirtualBox.app/Contents/MacOS/UnattendedTemplates/debian_postinstall.sh
                postInstallCommand = 
      extraInstallKernelParameters =  auto=true preseed/file=/cdrom/preseed.cfg priority=critical quiet splash noprompt noshell automatic-ubiquity debian-installer/locale=en_US keyboard-configuration/layoutcode=us languagechooser/language-name=English localechooser/supported-locales=en_US.UTF-8 countrychooser/shortlist=KE --
                          language = en-US
                  detectedOSTypeId = 
                 detectedOSVersion = 
                  detectedOSFlavor = 
               detectedOSLanguages = en-US
                   detectedOSHints = 
VBoxManage: info: VM 'testserver' (e643e8fd-28f9-466b-a390-5ca21df28a8b) is ready to be started (e.g. VBoxManage startvm).
Waiting for VM "testserver" to power on...
VM "testserver" has been successfully started.

How can I run a 100% unattended installation of Debian 9 or Ubuntu 18.0.4 LTS in VirtualBox?


There's an issue with syslinux on debian from Stretch onwards: it automatically starts the graphical installer instead of starting the install menu entry.

You can find more details about the issue and a fix here: https://www.virtualbox.org/ticket/18410

Basically the fix consists in using VirtualBox's --auxiliary-base-path to specify the location where Virtualbox should extract isolinux files from the ISO and patch them.

aux_base_path="$(mktemp -d --tmpdir unattended-install-XXXXX)"

VBoxManage unattended install 'vm-name' --auxiliary-base-path "$aux_base_path"/ ...

(... is a placeholder for your other options)

It's now possible to patch the main isolinux configuration file to run the install menu entry by default instead of the VESA menu:

sed -i 's/^default vesa.*/default install/' "$aux_base_path"/isolinux-isolinux.cfg

Now you can start the VM and unattended installation should take place:

VBoxManage startvm 'vm-name'

Note: the commands above are for unix shell (Linux & MacOS). For Windows console, use an existing folder path like %UserProfile%/ instead of "$aux_base_path/" and use:

$f = Get-Content isolinux-isolinux.cfg | %{$_ -replace "^default vesa.*","default install"}
$f > isolinux-isolinux.cfg