VirtualBox

Opened 6 years ago

Last modified 5 years ago

#17335 new defect

unattended install uses wrong path for UnattendedTemplates dir

Reported by: Greg Bailey Owned by:
Component: other Version: VirtualBox 5.2.0
Keywords: unattended install rpm package centos Cc:
Guest type: all Host type: Linux

Description

This is for VirtualBox 5.2.2 (that version wasn't available as a selection)

  • Host OS: CentOS 7.4 (all updates current)
  • Version: VirtualBox-5.2-5.2.2_119230_el7-1.x86_64

When trying to use the new "unattended install", it fails, presumably because it's trying to find the UnattendedTemplates directory in the wrong location:

$ vboxmanage unattended install centos7 --iso /iso/CentOS-7-x86_64-Minimal-1708.iso
VBoxManage: info: Preparing unattended installation of RedHat_64 in machine 'centos7' (62f5cf05-2814-4ba8-95f3-4d51a94f5507).
VBoxManage: error: Failed to open '/usr/share/virtualbox/UnattendedTemplates/redhat67_ks.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

The UnattendedTemplates directory appears to be in a different location when installing via RPM:

$ rpm -ql VirtualBox-5.2 | grep 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/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

If I create a symlink from /usr/share/virtualbox/UnattendedTemplates to /usr/lib/virtualbox/UnattendedTemplates, then the unattended installation succeeds.

Attachments (1)

reproduce-bug.sh (2.4 KB ) - added by Robert Nielsen 5 years ago.
Reproduce bug from scratch and (with an env var fix=1) demonstrate workaround.

Download all attachments as: .zip

Change History (5)

comment:2 by Cake, 6 years ago

The debian package has the same problem.

  • Host OS: Debian 9
  • Version: 5.2.18-124319~Debian~stretch

by Robert Nielsen, 5 years ago

Attachment: reproduce-bug.sh added

Reproduce bug from scratch and (with an env var fix=1) demonstrate workaround.

comment:3 by Robert Nielsen, 5 years ago

[attached script: reproduce-bug.sh] # 86 lines

This bug still exhibits (currently VirtualBox 6.0.4), and with other distros (you reported RedHat/CentOS and I'm confirming it exhibits on Debian/Ubuntu).

Using a symbolic link is a perfectly fine workaround, but here an an alternative which does not require root/sudo access.

 VBoxManage unattended install <vm> --iso <iso> --script-template <> --post-install-template <>

You will need to replace <> with the appropriate absolute path.

So, for the reported example it would look something like this:

 VBoxManage unattended install centos-7 --iso /iso/CentOS-7-x86_64-Minimal-1708.iso --script-template /usr/lib/virtualbox/UnattendedTemplates/redhat67_ks.cfg --post-install-template /usr/lib/virtualbox/UnattendedTemplates/redhat_postinstall.sh

I've attached a script which reproduces the bug (from scratch ... downloading the iso and creating the vm before using 'unattended install'). The script also demonstrates the above workaround. Since the reporter (Greg Bailey) used RedHat/Centos I thought it would be more valuable if I used Debian to demonstrate the problem exists on multiple distros.

# to see the bug, do this
./reproduce-bug.sh

# to see my fix, do this
fix=1 ./reproduce-bug.sh

comment:4 by Akemi Yagi, 5 years ago

CC.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use