我尝试在 VirtualBox - Vagrant 上安装 Ubuntu 16.04 LTS,并使用 Packer 工具自动创建和配置虚拟机。当我启动命令时,packer build
自动安装屏幕正确运行,引导命令已传递,问答自动回答。
但检测到分区磁盘配置有错误。
你能帮助我理解为什么我的预置或启动命令文件的一部分是错误的吗?
VM 上的屏幕错误:
preseed.cfg 文件:
# Ubuntu Server 16.04
d-i debian-installer/locale string en_GB.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select gb
d-i keyboard-configuration/layout string "United Kingdom"
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned
d-i netcfg/get_domain string unassigned
d-i mirror/country string UK
d-i mirror/http/proxy string
d-i clock-setup/utc boolean true
d-i time/zone string Europe/London
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string uk.pool.ntp.org
d-i partman-auto/disk string /dev/vda
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string sys_vg
d-i partman-auto/choose_recipe atomic
d-i partman-auto-lvm/guided_size string max
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-auto/confirm boolean true
d-i passwd/root-login boolean false
d-i passwd/make-user boolean false
d-i passwd/user-fullname string tux
d-i passwd/username string tux
d-i passwd/user-password password Password1
d-i passwd/user-password-again password Password1
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
tasksel tasksel/first multiselect server, openssh-server
d-i pkgsel/include string openssh-server update-motd
d-i pkgsel/update-policy select none
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
json packer的启动命令部分:
"<enter><f6><esc>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs><bs><bs>",
"<bs><bs><bs>",
"auto preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/test-preseed.cfg ",
"debian-installer=en_CA locale=en_CA kbd-chooser/method=us ",
"hostname=rails-5-jade ",
"fb=false debconf/frontend=noninteractive ",
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
"keyboard-configuration/variant=USA console-setup/ask_detect=false ",
"vga=788 initrd=/install/initrd.gz quiet --- ",
"<enter>"
答案1
我在使用 Packer 的 QEMU 构建器时也遇到了同样的问题。我遇到的问题是,我定义了以下行
d-i partman-auto/disk string /dev/sda
在我的预置文件中,但 Packer 没有找到磁盘(与上面提到的“无文件系统”错误相同)。必须将行更改为
d-i partman-auto/disk string /dev/vda
与 QEMU 一起工作。