X

News, tips, partners, and perspectives for Oracle’s virtualization offerings

Guide for VirtualBox VM unattended installation

Valery Portnyagin
Senior Developer

1 Preface

VirtualBox supports the unattended installation from “out of box” for several most common OSs like Ubuntu, RHEL, Oracle Linux, Windows.

NB! There are a lot of versions for these OSs and it may happen that the old versions or some special versions of OSs won’t work properly with unattended scenarios.

The different OSs use the different approaches for unattended installation. So if you want to learn more about it please look into the OSs official pages which describe the details.

There are two ways to run the unattended installation:

1. using the command line utility “VBoxManage” and call the command “unattended install”

2. using GUI frontend and run the “unattended installation wizard” which guides user through the preparations steps.

2 The command “VBoxManage unattended install”

Before launch the command user have to create a new empty VM with desired OS type. VM name or VM uuid will be used by the command. See below.

2.1 Syntax

The full syntax of the command is:

VBoxManage unattended install <uuid|vmname>
<--iso=install-iso> 
[--user=login] 
[--password=password] 
[--password-file=file] 
[--full-user-name=name] 
[--key=product-key] 
[--image-index=number] 
[--install-additions] 
[--no-install-additions] 
[--additions-iso=add-iso] 
[--install-txs] 
[--no-install-txs] 
[--validation-kit-iso=testing-iso] 
[--locale=ll_CC] 
[--country=CC] 
[--time-zone=tz] 
[--hostname=fqdn] 
[--package-selection-adjustment=keyword] 
[--dry-run]
[--auxiliary-base-path=path] 
[--script-template=file] 
[--post-install-template=file] 
[--post-install-command=command] 
[--extra-install-kernel-parameters=params] 
[--language=lang] 
[--start-vm=session-type]

2.2 Base scenario

The base scenario includes the following settings:

  • user passes a machine name or Id. The parameter <uuid|vmname> is passed as the first argument after “VBoxManage unattended install”.
  • user specifies a path to an installation ISO. The parameter is “--iso”.
  • user passes the credentials for a standard user which will be used to login into a guest OS. The parameters are “--user” and “--password”.
    NB! The default values here are user is "vboxuser" and password is "changeme".
  • user passes an activation key (applied only for Windows). The parameter is “--key”.
  • user specifies the variant of OS image which should be installed (applied only for Windows, see the details below in the chapter describing Windows installation). The parameter is “--image-index”.
  • user passes the parameter “--install-additions” and specifies the path to VirtualBox Guest Additions ISO. The parameter is “--additions-iso”.
    NB! The GA parameter is optional but in the most use cases GA are needed anyway. Thus it’s optional but recommended step.

This is enough to setup the unattended installation. VirtualBox makes the checks whether the pointed ISO image contains the OS suited for this type of installation or not. If the checks pass the action can be run. Otherwise user will see the error that this OS type isn’t supported by VirtualBox for the unattended installation.

Also it’s a good style to provide the such settings as “--locale”, “--country” and “--language”. It helps to properly setup guest OS. In the most cases these settings may be omitted without any affect on installation, but in few cases it may lead to badly keyboard settings, OS language settings and etc. It turns up like garbage instead the time or like garbage instead the correct symbols, characters and words in the file\folder explorer:

Garbage instead of the correct date in the file explorer

Illustration: Garbage instead of the correct date in the file explorer

Garbage instead of the correct date and time

Illustration: Garbage instead of the correct date and time

2.3 Example of command output

After successful execution of the command “VBoxManage unattended install” user should see the output like this:

VBoxManage: info: Preparing unattended installation of Ubuntu_64 in machine 'ubu18-un' (497d86a4-fee3-4e03-9ae0-d7f3f90b5774).
VBoxManage: info: Using values:
isoPath = /path/to/ISO image/ubuntu-18.04.1-desktop-amd64.iso
user = some_user
password = some_passwd
fullUserName = Jo Malone
productKey =
additionsIsoPath = /path/to/VBox/ISO additions image/VBoxGuestAdditions.iso
installGuestAdditions = true
validationKitIsoPath =
installTestExecService = false<
locale = ru_RU
country = RU
timeZone = W-SU
proxy =
hostname = ubu18-un.myguest.virtualbox.org
packageSelectionAdjustments =
auxiliaryBasePath = /path/to/ubu18-un/Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-
imageIndex = 1
scriptTemplatePath = /path/to/UnattendedTemplates/ubuntu_preseed.cfg
postInstallScriptTemplatePath = /path/to/UnattendedTemplates/debian_postinstall.sh
postInstallCommand =
extraInstallKernelParameters = auto=true preseed/file=/cdrom/preseed.cfg priority=critical quiet splash noprompt noshell automatic-ubiquity debian-installer/locale=ru_RU keyboard-configuration/layoutcode=us languagechooser/language-name=English localechooser/supported-locales=ru_RU.UTF-8 countrychooser/shortlist=RU --
language = en-US
detectedOSTypeId = Ubuntu_64
detectedOSVersion = 18.04.1 LTS "Bionic Beaver" - Release amd64
detectedOSFlavor =
detectedOSLanguages = en-US
detectedOSHints =
VBoxManage: info: VM 'ubu18-un' (497d86a4-fee3-4e03-9ae0-d7f3f90b5774) is ready to be started (e.g. VBoxManage startvm).

Where he can see all settings that will be used during the installation process.

The folder “/path/to/ubu18-un/” is the folder where new VM has been created and contains VM files and settings. The folder will contain several newly created files with the prefix “Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-” like:

  • Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-aux-iso.viso
  • Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-isolinux-isolinux.cfg
  • Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-isolinux-txt.cfg
  • Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-preseed.cfg
  • Unattended-497d86a4-fee3-4e03-9ae0-d7f3f90b5774-vboxpostinstall.sh

As you may see the ID "497d86a4-fee3-4e03-9ae0-d7f3f90b5774" isn't some random ID it's the ID assigned to new VM.

The file with extension “.viso” is used as the installation media and attached to new VM automatically. The rest files contain information for bootloader, for installation logic, for post-installation steps.

NB! The names of the rest files vary from guest OS type (Debian, Windows, RHEL).

2.4 Run the installation

By default VirtualBox makes all checks and preparations but doesn’t run a real installation, i.e. VirtualBox doesn’t run new VM. If user prefers to launch installation process in one step then the parapemer “--start-vm” with an appropriate session type must be added as the parameter in the command. Otherwise user should manually run new VM via VirtualBox CLI or GUI.

3 The Unattended installation wizard

This approach involves VirtualBox GUI frontend. User as usually click on the icon “New” and follows the wizard creating a new VM.

3.1 Initial page

New VM wizard: Initial page

Illustration: New VM wizard. Initial page

On the initial page user set the name of VM, folder where the VM will be placed, ISO image with OS distributive, type of OS and version of OS. The checkbox “Skip unattended installation” allows not to launch new VM after finishing the wizard. It helps when user wants to look into the VM’s files with VM settings or unattended installation settings before launching the real installation.

3.2 Second page

New VM wizard: second page

Illustration: New VM wizard. Second page

On the second page user provides credentials for new user which account is created in the VM guest OS. The absolute path to GA installation ISO is provided. If OS demands a license key it also sets here.

3.3 Third page

New VM wizard: third page

Illustration: New VM wizard. Third page

On the third page user chooses the base RAM memory and number of CPUs.

3.4 Last page

New VM wizard: last page

Illustration: New VM wizard. Last page

The last page is intended for virtual hard disk settings like disk size and some other minor features.

3.5 Run the installation

After user clicks on the button “Create” on the last wizard page the VM is launched and the unattended installation process begins. If user has set the checkbox “Skip unattended installation” on the first wizard page then the wizard finishes without any further actions. In this case user should manually launch the VM to start the unattended installation process.

If all settings are correct then user will see the window with the launched VM and can observe the installation process. After successful installation user should see the prompt to login to the guest OS.

4. OS Windows

The next versions of Windows OS have been checked for the unattended scenarios:

  • Windows 7
  • Windows 8.1
  • Windows 10
  • Windows Server 2008
  • Windows Server 2012
  • Windows Server 2016
  • Windows Server 2019

4.1 Windows specialties

4.1.1 Editions

Some Windows OS installation ISO disks may contain several editions of one OS. To illustrate, my ISO image with Windows 2012 has 4 editions:

  • Windows Server 2012 Standard (Server Core Installation)
  • Windows Server 2012 Standard (Server with a GUI)
  • Windows Server 2012 Datacenter (Server Core Installation)
  • Windows Server 2012 Datacenter (Server with a GUI)

How to list all editions available on ISO image for installation?

To get the list of editions, mount installation media (usually ISO image), open PowerShell or Command Prompt with Administrator privileges and type the next command “DISM /get-wiminfo /wimfile:X:\sources\install.ext”, where the letter “X” is replaced by the drive letter where the Windows mounted the installation media and “.ext” with the appropriate file extension, which is either “.wim” or “.esd.”. On the mounted media the folder “sources” usually contains all installation stuff.

NB! For Windows 7 pass “boot.wim” as the parameter instead “install.wim”.

Example of the “dism” command:

Windows 2012 editions on the installation ISO

Illustration: Windows 2012 editions on the installation ISO

To choose the edition for installation user must point out it by providing the parameter “--imageIndex” with the number of interested edition. By default, VirtualBox sets the parameter “--imageIndex” to “1”.

4.1.2 Activation key

Another item is an activation key or license key. User must provide a correct key otherwise the installation won’t start. For some Windows OS versions the installer displays the direct message that the provided key isn’t correct, for the other systems there is no a clear message. The installation wizard just displays the window with no available editions for installation and says that “No images are available”. It’s essential to have a license key which is intended and correct for the installed OS. It means user may have a correct key but this key doesn’t suit for the Windows OS edition which is going to be installed.

To set a key user passes the parameter “--key” with a valid key value.

Windows - invalid license key result

Illustration: Windows invalid license key result

Nowadays, there are the volume licensing editions keys for the most Windows OS versions. These keys may be fit for the tests of unattended installation. You can find some keys here - KMS Client Setup Key.

4.2 The new content in the VM machine folder

Files generated after execution of the command “VBoxManage unattended install”:

  • Unattended-<uuid>-autounattend.xml
  • Unattended-<uuid>-aux-floppy.img
  • Unattended-<uuid>-aux-iso.viso
  • Unattended-<uuid>-VBOXPOST.CMD

where <uuid> is VM uuid and looks like “e9c63ff8-0849-4935-b804-f9bd8f2b9e2e”.

The file with extension “.viso” is used as the installation media and attached to new VM automatically. The rest files contain information for bootloader, for installation logic, for post-installation steps.

NB! User may manually change the files but then he will be in charge of any failure during the installation. This approach may be recommended only for an experienced user.

4.3 Installation logs

The post-installation log file is placed on the root of the boot disk (Usually C:\vboxpostinstall.log) in guest OS.

5 OS Ubuntu

The next versions of Ubuntu OS have been checked for the unattended scenarios:

  • Ubuntu 12.04
  • Ubuntu 14.04
  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04

5.1 Ubuntu specialties

There are no specialties for this OS type. In the most cases the unattended installation is successful.

5.2 The new content in the VM machine folder

Files generated after execution of the command “VBoxManage unattended install”:

  • Unattended-<uuid>-aux-iso.viso
  • Unattended-<uuid>-isolinux-isolinux.cfg
  • Unattended-<uuid>-isolinux-txt.cfg
  • Unattended-<uuid>-preseed.cfg
  • Unattended-<uuid>-vboxpostinstall.sh

where <uuid> is VM uuid and looks like “497d86a4-fee3-4e03-9ae0-d7f3f90b5774”.

The file with extension “.viso” is used as the installation media and attached to new VM automatically. The rest files contain information for bootloader, for installation logic, for post-installation steps.

NB! User may manually change the files but then he will be in charge of any failure during the installation. This approach may be recommended only for an experienced user.

5.3 Installation logs

The post-installation log file and GA setup and installation logs are placed in the directory /var/log in the guest OS with the prefix “vbox”. The standard names are: vboxadd-install.log, vboxadd-setup.log, vboxpostinstall.log.

6 OS RHEL

The next versions of RHEL OS have been checked for the unattended scenarios:

  • RHEL 6.1
  • RHEL 7.0
  • RHEL 7.7
  • RHEL 8.0
  • RHEL 8.2

6.1 RHEL specialties

6.1.1 RHEL subscription

RHEL documentation - https://access.redhat.com/documentation/en-us/red_hat_subscription_management/1/html-single/rhsm/index

FAQ - How to register and subscribe a system to the Red Hat Customer Portal using Red Hat Subscription-Manager

The most important part for RHEL is the access to the standard RHEL repositories. It’s needed to install or update the packages\applications. It may require to login to RedHat customer portal using existing credentials. Without this step the repositories are unavailable and as the result some packages can’t be installed.

The quote from RHEL documentation:

As product subscriptions are attached to systems, the system gains access to content repositories that are identified in the system’s certificate. Content repositories are based on the product and on the content delivery network (CDN) that are defined in the rhsm.conf file.

A subscription may include access to optional content repositories in addition to the default repositories that are automatically enabled on the system. These optional repositories must be enabled before the packages in them can be installed even if the system has the appropriate subscriptions for the products in those repositories."

NB! With Red Hat Subscription-Manager, registration and utilization of a subscription is actually a two-part process. First register a system, then apply a subscription.

6.1.2 Utility subscription-manager

User must have been already registered on the RedHat customer portal. If this condition is met then the tool “subscription-manager” is used to register a RHEL machine and subscribe it.

The command syntax:

# subscription-manager register --username <username> --password <password> --auto-attach

where, <username> is the user name to login on the RedHat customer portal, <password> is the user password to login on the RedHat customer portal.

After successful execution user will see the output like:

The system has been registered with ID: 62fd76ed-164d-4cfc-ab44-84bcb379c76b
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status: Subscribed

Here is said that the system has been registered successfully and it has got the ID. Also it’s seen that the system has been subscribed too. If the field “Status” displays “Unsubscribed” than the standard RHEL repositories may be still unreachable. So both conditions must be met for successful work with the repositories.

To call subscription-manager user opens the file Unattended-<uuid>-vboxpostinstall.sh in the VM machine folder, and manually adds the following snippet before the section “Packages needed for GAs”:

log_command_in_target subscription-manager register --username <name> --password <password> --auto-attach
log_command_in_target subscription-manager refresh

replacing the placeholders <name> and <password> with real credentials. After this step user can start the installation process.

6.2 The new content in the VM machine folder

Files generated after execution of the command “VBoxManage unattended install”:

  • Unattended-<uuid>-aux-iso.viso
  • Unattended-<uuid>-isolinux-isolinux.cfg
  • Unattended-<uuid>-ks.cfg
  • Unattended-<uuid>-vboxpostinstall.sh

where <uuid> is VM uuid and looks like “bd78aa4c-1488-45e1-a059-28a335704979”.

The file with extension “.viso” is used as the installation media and attached to new VM automatically. The rest files contain information for bootloader, for installation logic, for post-installation steps.

NB! User may manually change the files but then he will be in charge of any failure during the installation. This approach may be recommended only for an experienced user.

6.3 Installation logs

The post-installation log file and GA setup and installation logs are placed in the directory /var/log in the guest OS with the prefix “vbox”. The standard names are: vboxadd-install.log, vboxadd-setup.log, vboxpostinstall.log.

7 OS Oracle Linux

The next versions of OL OS have been checked for the unattended scenarios:

  • Oracle Linux 6.1
  • Oracle Linux 7.0
  • Oracle Linux 7.7
  • Oracle Linux 8.0
  • Oracle Linux 8.2

7.1 UEK kernel

The most important part for Oracle Linux is to build GA for uek kernel.

This is done automatically by internal VirtualBox logic. Briefly, a script finds the available kernels and if UEK kernel was found installs the packages needed to build GA with this kernel. User doesn’t worry about it.

7.2 The new content in the machine VM folder

Files generated after execution of the command “VBoxManage unattended install” are the same as for RHEL (see chapter 6.2)

NB! User may manually change the files but then he will be in charge of any failure during the installation. This approach may be recommended only for an experienced user.

7.3 Installation logs

The post-installation log file and GA setup and installation logs are placed in the directory /var/log in the guest OS with the prefix “vbox”. The standard names are: vboxadd-install.log, vboxadd-setup.log, vboxpostinstall.log.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.