我正在尝试设置一种方法,用于在某些机器上安装 Ubuntu。这些机器是从内部 MMC 存储启动的 x86 机器。我希望该方法尽可能自动化,因为我们可能有大量的机器需要安装它;我的主要目标是使每台机器在安装后都处于一致的状态。我发现这问题,但两个答案都无法解决这个问题。
我正在使用预置文件来自动执行安装步骤;安装似乎通过分区步骤进行,但安装失败并显示令人沮丧的模糊错误消息。以下是我认为相关的 /var/log/syslog 中的行:
Aug 25 17:46:07 base-installer: apt-install or in-target is already running, so you cannot run either of
Aug 25 17:46:07 base-installer: them again until the other instance finishes. You may be able to use
Aug 25 17:46:07 base-installer: 'chroot /target ...' instead.
Aug 25 17:46:07 in-target: Unexpected error; command not executed: 'sh -c debconf-apt-progress --no-progress --logstderr -- apt-get -q -y --no-remove install busybox-initramfs'
Aug 25 17:46:07 base-installer: error: exiting on error base-installer/kernel/failed-package-install
这是我正在使用的预置文件:
# no splash and be verbose
d-i debian-installer/splash boolean false
d-i debian-installer/quiet boolean false
# installer locale
d-i debian-installer/locale string en_US
# keyboard
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# network
d-i hw-detect/load_firmware boolean true
d-i netcfg/choose_interface select enp1s0
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/disable_dhcp boolean true
d-i netcfg/confirm_static boolean true
d-i netcfg/get_ipaddress string my-lan-ip
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string my-lan-gateway
d-i netcfg/get_nameservers string my-nameserver
d-i netcfg/get_hostname string my-hostname
d-i netcfg/get_domain string unassigned-domain
d-i netcfg/hostname string my-hostname
# software mirror
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string my-http-proxy
d-i mirror/suite string xenial
# accounts
d-i passwd/root-login boolean false
d-i passwd/username string myuser
d-i passwd/user-fullname string Some Full Name
d-i passwd/user-password-crypted password my-encrypted-password
d-i user-setup/encrypt-home boolean false
# clock
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string my-ntp-server
# partitioning
d-i partman-auto/disk string /dev/mmcblk0
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select multi
d-i partman/default_filesystem string ext4
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/mount_style select uuid
# installation
d-i live-installer/net-image string /install/filesystem.squashfs
d-i base-installer/kernel/image string linux-image-generic
# apt
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean true
# package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/include string a few packages
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/language-packs multiselect en
d-i pkgsel/update-policy select unattended-upgrades
popularity-contest popularity-contest/participate boolean false
d-i pkgsel/updatedb boolean true
# bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/mmcblk0
# finishing
d-i debian-installer/exit/poweroff boolean true
d-i finish-install/reboot_in_progress note
我在写入了 Ubuntu Server 16.04.3 映像的 USB 驱动器上使用预置文件,并将文件 isolinux/txt.cfg 修改为使用我的预置文件。当我进行正常安装时,安装成功,因此我相信这是预置文件的问题。
请注意,这些盒子无法访问互联网;它们必须使用 HTTP 代理来访问 apt。我已确认 HTTP 代理工作正常,并且它在预置文件中正确指定。
我尝试重写 ISO 映像,但仍然出现同样的错误。
我的预置文件是否存在问题,导致安装失败?
答案1
事实证明,系统日志中还有另一个我错过的有趣错误:
Aug 25 21:03:12 live-installer: /usr/bin/ckbcomp: Can not find file "symbols/en" in any known directory
Aug 25 21:03:12 base-installer: warning: /usr/lib/post-base-installer.d/25live-installer-console-setup returned error code 1
这是我修改后的 txt.cfg 的样子:
default my-installation
LABEL my-installation
menu label ^my custom installation
kernel /install/vmlinuz
append file=/cdrom/preseed/my-installation.seed debian-installer/locale=en_US locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=en console-setup/layoutcode=en netcfg/choose_interface=enp1s0 initrd=/install/initrd.gz ramdisk_size=16384 root=/dev/ram rw quiet
我从这答案,但事实证明它应该是“us”,而不是“en”。更改此设置会导致 ckbcomp 命令成功,从而导致系统安装成功。