
當我使用 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 中執行 Debian 9 或 Ubuntu 18.0.4 LTS 的 100% 無人值守安裝?
答案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