使用 PXE 通过网络 Apt-Mirror 无人值守安装 Ubuntu Server 12.04 期间出错

JAG*_*JAG 9 server networking pxe 12.04

我正在尝试使用 apt-mirror 通过网络使用“Ubuntu 12.04 服务器”映像进行 PXE 引导并完全重建新服务器,但在安装过程中出现多个错误。我能够成功地使用物理 CDROM 重建同一台服务器(使用来自“ubuntu-12.04.2-server-amd64.iso”映像的完全相同的文件创建)而没有问题,但我在通过网络构建时遇到了问题在对磁盘进行分区并开始最后一次大文件传输后,会提供以下错误消息。结果,我一直无法使用我公司的内部网络(使用外部存储库工作)构建成功的服务器 PXE。

错误 1:

!! 安装基础系统

卸载警告

警告:无法下载包弹出 (ver 2.1.5+deb1+cvs20081104-9 arc amd64)

错误 2:

!! 安装基础系统

卸载警告

警告:无法下载包 liblzma5 (ver 5.1.1alpha+20110809-3 arc amd64)

错误 3:

!! 安装基础系统

卸载警告

警告:无法下载包 libstdc++6 (ver 4.6.3-1ubuntu5 arc amd64)

出现了更多类似的错误,但为简洁起见已被省略...

这是/var/log/syslog的最后一部分:

...
Jul 12 17:30:00 partman-lvm:   Logical volume "swap_1" successfully removed
Jul 12 17:30:00 udevd[24071]: inotify_add_watch(6, /dev/dm-1, 10) failed: No such file or directory
Jul 12 17:30:00 partman-lvm:   0 logical volume(s) in volume group "coolservername" now active
Jul 12 17:30:00 partman-lvm:   Volume group "coolservername" successfully removed
Jul 12 17:30:00 partman-lvm:   Labels on physical volume "/dev/sda3" successfully wiped
Jul 12 17:30:02 partman-lvm:   Physical volume "/dev/sda3" successfully created
Jul 12 17:30:02 partman-lvm:   Volume group "coolservername" successfully created
Jul 12 17:30:02 partman-lvm:   Logical volume "root" created
Jul 12 17:30:02 partman-lvm:   Logical volume "swap_1" created
Jul 12 17:30:06 kernel: [  184.508873] Adding 16695292k swap on /dev/mapper/coolservername-swap_1.  Priority:-1 extents:1 across:16695292k
Jul 12 17:30:07 partman: mke2fs 1.42 (29-Nov-2011)
Jul 12 17:30:21 kernel: [  199.286079] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: errors=remount-ro
Jul 12 17:30:22 apt-install: Queueing package e2fsprogs for later installation
Jul 12 17:30:22 main-menu[514]: (process:25003): /var/lib/partman/devices/=dev=sda
Jul 12 17:30:23 main-menu[514]: DEBUG: resolver (libnewt0.52): package doesn't exist (ignored)
Jul 12 17:30:23 main-menu[514]: DEBUG: resolver (ext2-modules): package doesn't exist (ignored)
Jul 12 17:30:23 main-menu[514]: INFO: Menu item 'bootstrap-base' selected
Jul 12 17:30:23 debconf-copydb: Cannot open question file /target/var/cache/debconf/config.dat: No such file or directory
Jul 12 17:30:23 debconf-copydb: Cannot open template file /target/var/cache/debconf/templates.dat: No such file or directory
Jul 12 17:30:23 base-installer: chroot: can't execute 'debconf-set-selections': No such file or directory
Jul 12 17:30:23 base-installer: warning: /usr/lib/base-installer.d/20console-setup returned error code 127
Jul 12 17:30:55 base-installer: error: exiting on error base-installer/debootstrap-failed
Jul 12 17:30:55 main-menu[514]: WARNING **: Configuring 'bootstrap-base' failed with error code 1
Jul 12 17:30:55 main-menu[514]: WARNING **: Menu item 'bootstrap-base' failed.
Jul 12 17:30:56 main-menu[514]: INFO: Modifying debconf priority limit from 'high' to 'medium'
Jul 12 17:30:56 debconf: Setting debconf/priority to medium
Jul 12 17:30:57 main-menu[514]: DEBUG: resolver (libnewt0.52): package doesn't exist (ignored)
Jul 12 17:30:57 main-menu[514]: DEBUG: resolver (ext2-modules): package doesn't exist (ignored)
Jul 12 17:30:59 main-menu[514]: INFO: Menu item 'save-logs' selected
Run Code Online (Sandbox Code Playgroud)

我首先使用 pxelinux ( https://help.ubuntu.com/community/PXEInstallServer )实现了一个 DHCP/TFTP 解决方案,但后来使用 syslinux 转移到 gpxelinux 以尝试让它工作(而且似乎使用 HTTP 是比 TFTP 等更快)。仍然没有成功,我尝试使用一个简单的 Kickstart 文件:

install
url --url http://10.16.25.80:4040/ubuntu/repository/
Run Code Online (Sandbox Code Playgroud)

...以及一个完整的apt-mirror存储库(如此处所建议的 -> Unable to install 12.10 with PXE),没有任何改进。我也尝试使用“ubuntu-12.04.2-alternate-amd64.iso”图像。

服务器硬件(我正在尝试重新映像的那个)

  • 戴尔 PowerEdge R320
  • 4 个物理硬盘驱动器配置为硬件 RAID 0,带有一个 4TB 虚拟驱动器。
  • 16GB 内存

关于主机服务器(用于构建的服务器)

托管服务器具有类似的硬件,并且之前使用 web-ui 配置了 Ubuntu Server 12.04(精确)和 Chef 服务器 10.18.2,该 web-ui 将 merb 用于 Web 服务 (HTTP)。该服务器充当 DHCP/HTTP/TFTP/APT-MIRROR 主机。

已安装的 DHCP

sudo apt-get install isc-dhcp-server

/etc/default/isc-dhcp-server

INTERFACES="eth0"
Run Code Online (Sandbox Code Playgroud)

/etc/dhcp/dhcpd.conf

ddns-update-style none;
option domain-name "corp.com";
option domain-name-servers dns1.corp.com, dns2.corp.com;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 10.16.25.0 netmask 255.255.255.0 {
  range 10.16.25.195 10.16.25.199;
  option domain-name "corp.com";
  option domain-name-servers 10.10.10.200, 10.10.10.201;
  option routers 10.16.25.1;
  option broadcast-address 10.16.25.254;
  option ntp-servers 10.10.10.203;
  default-lease-time 600;
  max-lease-time 7200;
  filename "gpxelinux.0";
}
Run Code Online (Sandbox Code Playgroud)

已安装 TFTP

sudo apt-get install tftpd-hpa

/etc/default/tftpd-hpa

RUN_DAEMON=”yes”
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
Run Code Online (Sandbox Code Playgroud)

已安装的 SysLinux

sudo apt-get install syslinux

/var/lib/tftpboot/pxelinux.cfg/default

...
LABEL Server (Preseed/HTTP)
    KERNEL http://10.16.25.80:4040/pxe/ubuntu/12.04/alternate-amd64/install/netboot/ubuntu-installer/amd64/linux
    APPEND auto=true interface=eth0 hostname=coolservername url=http://10.16.25.80:4040/pxe/preseed/coolservername.seed initrd=http://10.16.25.80:4040/pxe/ubuntu/12.04/alternate-amd64/install/netboot/ubuntu-installer/amd64/initrd.gz --    
Run Code Online (Sandbox Code Playgroud)

配置一个预置文件

种子文件位于 http://10.16.25.80:4040/pxe/preseed/coolservername.seed

# Language:
d-i debian-installer/language string en
# Country:
d-i debian-installer/country string US
# Detect keyboard layout?
d-i console-setup/ask_detect boolean false
# Country of origin for the keyboard:
d-i keyboard-configuration/layout select English (US)
# Keyboard layout:
d-i keyboard-configuration/variant select English (US)
# Domain name:
d-i netcfg/get_domain string corp.com
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# Configure the application repository mirror
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string 10.16.25.80:4040
d-i mirror/http/directory string /pxe/ubuntu/repository/
#d-i mirror/http/directory string /pxe/ubuntu/12.04/server-amd64/
#d-i mirror/http/directory string /pxe/ubuntu/12.04/alternate-amd64/
d-i mirror/http/proxy string
d-i mirror/suite string precise
# Create a normal user account
d-i passwd/user-fullname string A really cool default user
d-i passwd/username string coolusername
# Normal user's encrypted password (using an MD5 hash)
d-i passwd/user-password-crypted password 12345678901234567890123456789012
# Set to true to encrypt the first user's home directory
d-i user-setup/encrypt-home boolean false
# Only ask the UTC question if there are other operating systems installed.
d-i clock-setup/utc-auto boolean true
# Controls whether or not the hardware clock is set to UTC
d-i clock-setup/utc boolean true
# Time zone setup
d-i time/zone string US/Pacific
# Configure disk storage and partitions
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
# For LVM partitioning, you can select how much of the volume group to use
# for logical volumes.
d-i partman-auto-lvm/guided_size string max
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
# By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
d-i debian-installer/allow_unauthenticated boolean true
# Package selection - run this grep (from existing) to see list of available options
# "grep Task /usr/share/tasksel/ubuntu-tasks.desc"
tasksel tasksel/first multiselect server, standard
# Individual additional packages to install
d-i pkgsel/include string openssh-server
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
d-i pkgsel/upgrade select full-upgrade
# Policy for applying updates. May be "none" (no automatic updates),
# "unattended-upgrades" (install security updates automatically), or
# "landscape" (manage system with Landscape).
d-i pkgsel/update-policy select none
# By default, the system's locate database will be updated after the
# installer has finished installing most packages. This may take a while, so
# if you don't want it, you can set this to "false" to turn it off.
d-i pkgsel/updatedb boolean true
# Only install basic language packs. Let tasksel ask about tasks.
d-i pkgsel/language-pack-patterns string
# No language support packages.
d-i pkgsel/install-language-support boolean false
# Verbose output and no boot splash screen.
d-i debian-installer/quiet boolean false
d-i debian-installer/splash boolean false
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if it also finds some other
# OS, which is less safe as it might not be able to boot that other OS.
d-i grub-installer/with_other_os boolean true
# Wait for two seconds in grub
d-i grub-installer/timeout string 2
# This will prevent the installer from ejecting the CD during the reboot.
d-i cdrom-detect/eject boolean false
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# Overwrite the server's network configuration file (/etc/network/interfaces)
d-i preseed/run string coolservername.sh
Run Code Online (Sandbox Code Playgroud)

安装 apt-mirror

sudo apt-get install apt-mirror

/etc/apt/mirror.list

set nthreads     20
set _tilde 0
deb http://us.archive.ubuntu.com/ubuntu precise main main/debian-installer restricted restricted/debian-installer universe universe/debian-installer multiverse multiverse/debian-installer
deb-amd64 http://us.archive.ubuntu.com/ubuntu precise main main/debian-installer restricted restricted/debian-installer universe universe/debian-installer multiverse multiverse/debian-installer
deb-i386 http://us.archive.ubuntu.com/ubuntu precise main main/debian-installer restricted restricted/debian-installer universe universe/debian-installer multiverse multiverse/debian-installer
deb http://us.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu
Run Code Online (Sandbox Code Playgroud)

http://10.16.25.80:4040/pxe/ubuntu/repository 是“/var/spool/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu/”中镜像文件的符号链接。

在克服这些错误并成功帮助重新映像/重建此服务器方面的任何帮助将不胜感激,因为我花了很多时间进行调查和搜索而没有运气...

提前谢谢了!!