当我使用 VirtualBox 和 Debian 9 / Ubuntu 18.0.4 启动无人值守安装时,安装在要选择国家/地区的屏幕上停止:
这是我的命令行:
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
我也尝试了VirtualBox 文档,其中列出了该语言的附加参数:
VBoxManage unattended install $VMNAME --user=$OSUSERNAME --password=$OSPASSWORD --country=UK --time-zone=UTC --hostname=testserver.local --iso=./build/$ISOFILENAME --install-additions --language=en-US
...没有成功。这是脚本的输出:
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.
如何在 VirtualBox 中运行 100% 无人值守的 Debian 9 或 Ubuntu 18.0.4 LTS 安装?
答案1
从 Stretch 开始,debian 上的 syslinux 存在一个问题:它会自动启动图形安装程序,而不是启动install
菜单项。
您可以在此处找到有关此问题及其修复的更多详细信息: https://www.virtualbox.org/ticket/18410
基本上,修复包括使用 VirtualBox--auxiliary-base-path
指定 Virtualbox 应从 ISO 中提取 isolinux 文件并对其进行修补的位置。
aux_base_path="$(mktemp -d --tmpdir unattended-install-XXXXX)"
VBoxManage unattended install 'vm-name' --auxiliary-base-path "$aux_base_path"/ ...
(...
是其他选项的占位符)
现在可以修补主 isolinux 配置文件以install
默认运行菜单项而不是 VESA 菜单:
sed -i 's/^default vesa.*/default install/' "$aux_base_path"/isolinux-isolinux.cfg
现在您可以启动虚拟机并进行无人值守安装:
VBoxManage startvm 'vm-name'
笔记:上述命令适用于 unix shell(Linux 和 MacOS)。对于 Windows 控制台,请使用现有文件夹路径(例如%UserProfile%/
代替)"$aux_base_path/"
并使用:
$f = Get-Content isolinux-isolinux.cfg | %{$_ -replace "^default vesa.*","default install"}
$f > isolinux-isolinux.cfg