X

A Bridge to the Cloud...

Oracle VM VirtualBox 5.2: unattended Guest OS install

Simon Coter
Director of Product Management, Oracle Linux and Virtualization

VirtualBox 5.2 introduced a very cool enhancement: unattended Guest OS installation.

Thanks to this feature you can get a Virtual Machine automatically and completely installed without human intervention; the same feature, between the others, also grants to have an identical Virtual Machine each time you decide to install the Operating System.

 

Here a quick example on how-to get an unattended Guest OS install:

  • Create the Virtual Machine, achievable by CLI or GUI

# VM="Win10-autoinstall"

# VBoxManage createvm --name $VM --ostype "Windows10_64" --register

 

 

 

  • Setup Virtual Storage/Disks for the Virtual Machine, achievable by CLI or GUI

# VBoxManage createhd --filename /VirtualBox/$VM/$VM.vdi --size 32768

# VBoxManage storagectl $VM --name "SATA Controller" --add sata --controller IntelAHCI

# VBoxManage storageattach $VM --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium /VirtualBox/$VM/$VM.vdi

# VBoxManage storagectl $VM --name "IDE Controller" --add ide

# VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium /u01/Software/en_windows_10_pro_10240_x64_dvd.iso

 

 

 

 

 

 

 

 

  • Define Misc settings for the Virtual Machine (optional)

# VBoxManage modifyvm $VM --ioapic on

# VBoxManage modifyvm $VM --boot1 dvd --boot2 disk --boot3 none --boot4 none

# VBoxManage modifyvm $VM --memory 8192 --vram 128

 

 

 

 

  • Virtual Machine unattended configuration

# VBoxManage unattended install $VM --iso=/u01/Software/en_windows_10_pro_10240_x64_dvd.iso --user=scoter --full-user-name="Mr. Coter" --password secret --key "your-windows-key" --install-additions --time-zone=UTC

 

 

 

  • Start the Virtual Machine to get your guest OS installed

# VBoxManage startvm $VM --type headless

 

 

Ok, now you can have your coffee/tea break while waiting to the your Virtual Machine installed and ready to use.

Thanks to this feature you can get different OS automatically and installed by 10 lines of scripting and by sharing the same code to others, everyone will have the same identical Virtual Machine running on top of VirtualBox; on this blog article we saw an example related to Microsoft Windows OS but the same concept also applies to different Linux distributions and others.

Further details on "Unattended Guest OS Install" are available on official Oracle VM VirtualBox documentation here!

Join the discussion

Comments ( 15 )
  • Purush Neel Wednesday, May 2, 2018
    Hi,

    I tried using the above steps for Windows Server 2016 Datacenter edition and found that Windows Install GUI window popped up and is waiting for user input on language, keyboard language and country. Is there a way to avoid these manual intervention during the Windows Server 2016 install process. I am not sure if I missed a switch in the command line
    Virtualbox Version:
    -------------------
    Oracle VM VirtualBox Command Line Management Interface Version 5.2.8

    Command:
    --------
    vboxmanage unattended install MY-VM --iso=C:TempWindows2016Server.iso --user=Administrator --password=XXXXXXXXX --full-user-name=Administrator --key=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX --install-additions --additions-iso=C:TempVBoxGuestAdditions.iso --hostname=XXXXXXXX.YYYY.ZZZZZ

    Output:
    -------
    VBoxManage.exe: info: Preparing unattended installation of WindowsNT_64 in machine 'MY-VM' (xxxxxxxxxxxxxxxxxxxxxxxx).
    VBoxManage.exe: info: Using values:
    isoPath = C:TempWindows2016Server.iso
    user = Administrator
    password = XXXXXXXXX
    fullUserName = Administrator
    productKey = XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    additionsIsoPath = C:TempVBoxGuestAdditions.iso
    installGuestAdditions = true
    validationKitIsoPath =
    installTestExecService = false
    locale = en_US
    country = US
    timeZone = Eastern Standard Time
    proxy =
    hostname = XXXXXXXX.YYYY.ZZZZZ
    packageSelectionAdjustments =
    auxiliaryBasePath = C:TempVMMY-VMUnattended-xxxxxxxxxxxxxxxxxxxxxxxx
    imageIndex = 1
    scriptTemplatePath = C:Program FilesOracleVirtualBoxUnattendedTemplateswin_nt5_unattended.sif
    postInstallScriptTemplatePath = C:Program FilesOracleVirtualBoxUnattendedTemplateswin_postinstall.cmd
    postInstallCommand =
    extraInstallKernelParameters =
    language = en-US
    detectedOSTypeId = WindowsNT_64
    detectedOSVersion =
    detectedOSFlavor =
    detectedOSLanguages = en-US
    detectedOSHints =
    VBoxManage.exe: info: VM 'MY-VM' (xxxxxxxxxxxxxxxxxxxxxxxx) is ready to be started (e.g. VBoxManage startvm).


    Please advise.

    Thanks,
    Purush
  • Simon Tuesday, May 8, 2018
    Hi Purush,

    I've just tried to get Win2016 Datacenter installed by "unattended installation"; it seems that the only thing that needs manual intervention is related to the "Datacenter Edition" choice (first step).
    That said, I've already talked with the engineering team and we'll get this issue fixed.
    Thanks for your precious feedback.

    Simon
  • Jonathan Sunday, January 13, 2019
    Env:

    Host: Ubuntu 18.04.1 LTS
    Vbox version: 5.2.18_Ubuntur123745

    Running on Ubuntu host, trying to install Lubuntu guest. The installl fails as it can't find the Unattended Templates:

    VBoxManage: error: Failed to open '/usr/share/virtualbox/UnattendedTemplates/ubuntu_preseed.cfg' (VERR_FILE_NOT_FOUND)


    "/usr/share/virtualbox" doesn't have "UnattendedTemplates" dir, so the attmpted install fails.

    BoxManage: info: Starting unattended installation of Ubuntu_64 in machine 'lubuntu-auto' (7a3d6166-0964-4d62-ad5b-7a039f0ead65).
    VBoxManage: error: Failed to open '/usr/share/virtualbox/UnattendedTemplates/ubuntu_preseed.cfg' (VERR_FILE_NOT_FOUND)
    VBoxManage: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component UnattendedWrap, interface IUnattended, callee nsISupports
    VBoxManage: error: Context: "Prepare()" at line 1643 of file VBoxManageMisc.cpp


    Any ideas? No idea why all of these are missing. checked whole filesystem, and "ubuntu_preseed.cfg" doesn't exist. Installed using apt. Why is this missing?
  • Simon Monday, January 14, 2019
    Hi Jonathan,

    can you please retry with the updated 5.2.22 or even 6.0 VirtualBox release ?
    I've just checked on a Linux system and the unattended conf file for Ubuntu is there on VirtualBox 6.0.

    Simon
  • Jonathan Monday, January 14, 2019
    Hi Simon,

    Thanks for coming back to me so quickly.

    I viewed the virtualbox src and copied the files from trunk, and had tried again. It generates the iso from the preseed cfg successfully, but the install fails for ubuntu 18.10 desktop, and lubuntu, and 8.04.1 ubuntu server. Created the ios, but all installs fail.

    Will try to upgrade to latest 5.x or 6.x, but 5.2.18 is the latest available on apt...
  • Jonathan Monday, January 14, 2019
    Hi Simon,

    Still a problem in the 6.0 install on ubuntu, but a new one now:

    VBoxManage: error: Failed to open '/usr/share/virtualbox/UnattendedTemplates/ubuntu_preseed.cfg' (VERR_FILE_NOT_FOUND)

    they are actually here:

    jonathan@jonathan-laptop:/usr/share/virtualbox$ locate UnattendedTemplates
    /usr/lib/virtualbox/UnattendedTemplates
    /usr/lib/virtualbox/UnattendedTemplates/debian_postinstall.sh
    /usr/lib/virtualbox/UnattendedTemplates/debian_preseed.cfg
    /usr/lib/virtualbox/UnattendedTemplates/fedora_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/ol_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/redhat67_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/redhat_postinstall.sh
    /usr/lib/virtualbox/UnattendedTemplates/rhel3_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/rhel4_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/rhel5_ks.cfg
    /usr/lib/virtualbox/UnattendedTemplates/ubuntu_preseed.cfg
    /usr/lib/virtualbox/UnattendedTemplates/win_nt5_unattended.sif
    /usr/lib/virtualbox/UnattendedTemplates/win_nt6_unattended.xml
    /usr/lib/virtualbox/UnattendedTemplates/win_postinstall.cmd


    oops. that looks like a bug.
  • Greg Thursday, January 17, 2019
    Same host version as Jonathan, running virtualbox 6.0 but I'm getting the same verr_file_not_found issue.

    And /usr/share/virtualbox does not have the unattendedtemplates folder.
  • Jonathan Thursday, January 17, 2019
    Installed on 6.0. The scripts are now there, but they dont work with ubuntu or lubuntu 1810. They are also in the wrong location, and had to simlink them for the vboxmanage scripts to start working.

    Looks half-baked, and buggy. Pls have your team look at this.

    My setup: Ubuntu guest and host(s).
  • Simon Saturday, January 19, 2019
    Hi Jonathan/Greg,

    thanks for your precious feedback.
    I've just opened a ticket to our engineering team reporting the issue that I've also verified on my own system.
    Thanks

    Simon
  • Jonathan Sunday, January 20, 2019
    Awesome, thanks so much for the follow-ups!
  • Jonathan Els Wednesday, June 12, 2019
    Hi, did this ever get fixed, or any idea for a planned scheduled release?
  • Simon Tuesday, June 25, 2019
    Hi Jonathan,

    which OS / Linux distribution are you trying to install ? Which issue did you get ?

    Simon
  • Jonathan Els Thursday, July 4, 2019
    Tried installing Ubuntu 18.04, 18.10 and Lubutunu 18.04 and 18.10.

    All don't work - tested about 2 months ago.
  • Jonathan Els Thursday, July 4, 2019
    to qualify last message, as possibly unclear:

    I have Ubuntu 18.10 host.

    Tested unattended installs of Ubuntu and Lubuntu 18.04 and 18.10 guests.
  • Simon Friday, July 5, 2019
    Hi Jonathan,

    VBox team is working on different fixes related to the unattended installation.
    That said, thanks for your feedback.

    Simon
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.