命令行安装在 16.04 mini.iso 中不起作用(不是 ubuntu 服务器)

命令行安装在 16.04 mini.iso 中不起作用(不是 ubuntu 服务器)

我目前在创建预置的 Ubuntu 16.04 32 位安装时遇到了问题。我正在 Ubuntu 16.04 桌面上的 VirtualBox VM 中安装。我使用的 iso 如下:http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-i386/current/images/netboot/mini.iso

我的安装提示如下 在此处输入图片描述

而且我可以通过点击 来获得启动提示<esc>在此处输入图片描述

Advanced options我也可以通过选择->Command-line expert install并点击“当被选中 <tab>时”来获得不同的提示(其中已经填写了大量文本) Command-line expert install在此处输入图片描述

我目前遇到的问题是,当我进入命令提示符(清除可能已经存在的任何文本)并尝试加载我的预置文件时,我会回到第一个安装屏幕(第一个图像)或它继续询问我问题,即使我已经预先设置了答案。然后等待 ssh 可用的过程耗尽时间,过程失败。

==> virtualbox-iso: Waiting for SSH to become available...
==> virtualbox-iso: Timeout waiting for SSH.
==> virtualbox-iso: Step "StepConnect" failed
==> virtualbox-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step

有人声称这是 Ubuntu 的一个错误,没有移植到 16.04

目前,我看到网上有很多关于Ubuntu 服务器(不是我正在使用的)并使用不同的组合键来执行启动命令来解决问题。

我试过了:

  1. 转到第一个提示,然后添加预置文件位置 "boot_command": [ "<esc><wait>", "/install/vmlinuz <wait>", "auto=true <wait>", "priority=critical <wait>", "url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{userubuntu_name}}.cfg <wait>", "preseed/interactive=false <wait>", "<enter><wait>" ],
  2. 转到第二个提示并提供预置文件位置 "boot_command": [ "<down><down><enter><down><down><tab>", "<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><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>", "/install/vmlinuz <wait>", "auto=true <wait>", "priority=critical <wait>", "url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{userubuntu_name}}.cfg <wait>", "preseed/interactive=false <wait>", "<enter><wait>" ],
  3. 转到第一个(和第二个)提示,然后添加预置文件位置使用不同的安装关键字 "boot_command": [ "<esc><wait>", "install <wait>", "auto <wait>", "priority=critical <wait>", "url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{userubuntu_名称}}.cfg <wait>", "preseed/interactive=false <wait>", "<enter><wait>" ],
  4. 转到第一个(和第二个)提示,然后添加预置文件位置使用不同的预置 URL 关键字 "boot_command": [ "<esc><wait>", "/install/vmlinuz <wait>", "auto <wait>", "priority=critical <wait>", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{userubuntu_名称}}.cfg <wait>", "preseed/interactive=false <wait>", "<enter><wait>" ],
  5. 转到第一个(和第二个)提示,然后添加预置文件位置使用扩展关键字 "boot_command": [ "<esc><wait>", "/install/vmlinuz <wait>", "auto <wait>", "priority=critical <wait>", "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{userubuntu_名称}}.cfg <wait>", "preseed/interactive=false <wait>", "debian-installer=en_US <wait>", "locale=en_US <wait>", "kbd-chooser/method=dk <wait>", "keyboard-configuration/xkb-keymap=dk <wait>", "netcfg/get_hostname={{ .Name }} <wait>", "netcfg/get_domain=vagrantup.com <wait>", "fb=false <wait>", "debconf/frontend=noninteractive <wait>", "console-setup/ask_detect=false <wait>", "console-keymaps-at/keymap=dk <wait>", "<enter><wait>" ],
  6. 我尝试使用不同的 iso(尝试获取 ubuntu 服务器 iso)但是当我这样做时,virtuabox 进程无法为其创建硬盘。
    ==> virtualbox-iso: Downloading or copying ISO
    ==> virtualbox-iso: Downloading or copying: http://releases.ubuntu.com/16.04/ubuntu-16.04-server-i386.iso
    ==> virtualbox-iso: Starting HTTP server on port 8916
    ==> virtualbox-iso: Creating virtual machine...
    ==> virtualbox-iso: Creating hard drive...
    ==> virtualbox-iso: Error attaching ISO: VBoxManage error: VBoxManage: error: Could not get the storage format of the medium '/home/project/packer_cache/414469dcbe8946731d7d3f214d3dd31de5806cb67eabc1873b915662bd2ba4cd.iso' (VERR_NOT_SUPPORTED)
    ==> virtualbox-iso: VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component MediumWrap, interface IMedium, callee nsISupports
    ==> virtualbox-iso: VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp
    ==> virtualbox-iso: VBoxManage: error: Invalid UUID or filename "/home/project/packer_cache/414469dcbe8946731d7d3f214d3dd31de5806cb67eabc1873b915662bd2ba4cd.iso"
    ==> virtualbox-iso: Step "stepAttachISO" failed
    ==> virtualbox-iso: [c] Clean up and exit, [a] abort without cleanup, or [r] retry step (build may fail even if retry succ
    ceeds)? ==> virtualbox-iso: Unregistering and deleting virtual machine...
    ==> virtualbox-iso: Deleting output directory...
    Build 'virtualbox-iso' errored: Error attaching ISO: VBoxManage error: VBoxManage: error: Could not get the storage format of the medium '/home/project/packer_cache/414469dcbe8946731d7d3f214d3dd31de5806cb67eabc1873b915662bd2ba4cd.iso' (VERR_NOT_SUPPORTED)
    VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component MediumWrap, interface IMedium, callee nsISupports
    VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 179 of file VBoxManageDisk.cpp
    VBoxManage: error: Invalid UUID or filename "/home/project/packer_cache/414469dcbe8946731d7d3f214d3dd31de5806cb67eabc1873b915662bd2ba4cd.iso" 

我的预置文件(preseed_xenial.cfg):

### Unattended Installation
d-i auto-install/enable boolean true
d-i debconf/priority select critical

### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_DK.UTF-8

# The values can also be preseeded individually for greater flexibility.
d-i debian-installer/language string en
d-i debian-installer/country string DK
# Optionally specify additional locales to be generated.
d-i localechooser/supported-locales multiselect en_DK.UTF-8, en_US.UTF-8, da_DK.UTF-8

# Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select dk

### Network configuration
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto

# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/hostname string ur

### Mirror settings
# If you select ftp, the mirror/country string does not need to be set.
d-i mirror/protocol string ftp
d-i mirror/ftp/hostname string ftp.de.ubuntu.org
d-i mirror/ftp/directory string /ubuntu
d-i mirror/ftp/proxy string

### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean false

d-i passwd/root-password-again password vagrant
d-i passwd/user-fullname string vagrant
d-i passwd/user-uid string 900
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
d-i passwd/username string vagrant
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false

### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string EU/Copenhagen
d-i clock-setup/ntp boolean true

### Partitioning
d-i partman-auto/disk string /dev/sda
# - regular: use the usual partition types for your architecture
# - lvm:     use LVM to partition the disk
# - crypto:  use LVM within an encrypted partition
d-i partman-auto/method string regular
#d-i partman-auto/choose_recipe select atomic
d-i partman-basicfilesystems/no_swap boolean false
d-i partman-auto/expert_recipe string \
  all-in-one :: \
    50 50 50 ext3 \
      $primary{ } \
      $bootable{ } \
      method{ format } format{ } \
      use_filesystem{ } filesystem{ ext3 } \
      mountpoint{ /boot/grub } \
      . \
    250 250 250 ext3 \
      $primary{ } \
      method{ format } format{ } \
      use_filesystem{ } filesystem{ ext3 } \
      mountpoint{ /tmp } \
      . \
    2000 2000 2000 ext3 \
      $primary{ } \
      method{ format } \
      format{ } \
      use_filesystem{ } \
      filesystem{ ext3 } \
      mountpoint{ / } . \
    50 1000 -1 ext3 \
      $primary{ } \
      method{ format } format{ } \
      use_filesystem{ } filesystem{ ext3 } \
      mountpoint{ /data } \
      . \
d-i partman-auto/choose_recipe select all-in-one
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm 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/confirm_write_new_label boolean true
d-i partman/mount_style select uuid
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/bootdev  string /dev/sda


###################################
### Kernel installation
d-i base-installer/kernel/image string linux-image-686-pae
###################################

### Apt
d-i apt-setup/non-free boolean false
d-i apt-setup/contrib boolean false
d-i apt-setup/services-select multiselect security
d-i apt-setup/security_host string security.ubuntu.org

### Package selection
tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server sudo bzip2 acpid zlib1g-dev wget curl dkms make
# No language support packages.
d-i pkgsel/install-language-support boolean false
d-i pkgsel/upgrade select none
# Prevent packaged version of VirtualBox Guest Additions being installed:
d-i preseed/early_command string sed -i \
  '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \
  /usr/lib/pre-pkgsel.d/20install-hwpackages
popularity-contest popularity-contest/participate boolean false

### Other
# Allow non-free firmware
d-i hw-detect/load_firmware boolean true
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

我的打包程序模板文件(ubutntu_xenial):

    {
    "variables": {
        "ubuntu_version": "16.04",
        "ubuntu_name": "xenial"
    },
  "builders": [
    {
      "type": "virtualbox-iso",
      "boot_command": [
        "<esc><wait>",
        "/install/vmlinuz <wait>",
        "auto=true <wait>",
        "priority=critical <wait>", 
        "url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_{{user `ubuntu_name`}}.cfg <wait>",
        "preseed/interactive=false <wait>",
        "<enter><wait>"
      ],
      "boot_wait": "5s",
      "disk_size": 2700,
      "guest_os_type": "Ubuntu",
      "headless": false,
      "http_directory": "http",
      "iso_url": "http://archive.ubuntu.com/ubuntu/dists/{{user `ubuntu_name`}}-updates/main/installer-i386/current/images/netboot/mini.iso",
      "iso_checksum_type": "none",
      "ssh_username": "vagrant",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_wait_timeout": "1000s",
      "shutdown_command": "echo 'vagrant'|sudo -S /sbin/shutdown -hP now",
      "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
      "virtualbox_version_file": ".vbox_version",
      "vm_name": "ubuntu-{{user `ubuntu_version`}}-i386",
      "vboxmanage": [
        [ "modifyvm", "{{.Name}}", "--memory", "4096" ],
        [ "modifyvm", "{{.Name}}", "--cpus", "4" ],
        [ "modifyvm", "{{.Name}}", "--vram", "128"],
        [ "modifyvm", "{{.Name}}", "--usb", "off"],
        [ "modifyvm", "{{.Name}}", "--ostype", "Ubuntu"],
        [ "modifyvm", "{{.Name}}", "--acpi", "on"],
        [ "modifyvm", "{{.Name}}", "--ioapic", "on"],
        [ "modifyvm", "{{.Name}}", "--hwvirtex", "on"],
        [ "modifyvm", "{{.Name}}", "--pae", "on"],
        [ "modifyvm", "{{.Name}}", "--nestedpaging", "on"],
        [ "modifyvm", "{{.Name}}", "--rtcuseutc", "on"],
        [ "modifyvm", "{{.Name}}", "--vrde", "on"]
      ]
    }
  ],
  "post-processors": [
    {
      "type": "vagrant",
      "compression_level": "9",
      "output": "ubuntu-{{user `ubuntu_version`}}-i386_{{.Provider}}.box",
      "only": ["virtualbox-iso"]
    }
  ],
  "provisioners": [
    {
      "type": "file",
      "source": "scripts/expand-rootfs.sh",
      "destination": "/home/vagrant/expand-rootfs.sh"
    },
    {
      "type": "file",
      "source": "scripts/regen-ssh-keys.sh",
      "destination": "/home/vagrant/regen-ssh-keys.sh"
    },
    {
      "type": "file",
      "source": "scripts/on-first-boot.sh",
      "destination": "/home/vagrant/on-first-boot.sh"
    },
    {
      "type": "file",
      "source": "scripts/on-first-boot.service",
      "destination": "/home/vagrant/on-first-boot.service"
    },
    {
      "type": "shell",
      "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
      "scripts": [
        "scripts/update.sh",
        "scripts/fs.sh",
        "scripts/sshd.sh",
        "scripts/networking.sh",
        "scripts/sudoers.sh",
        "scripts/vagrant.sh",
        "scripts/vbaddguest.sh",
        "scripts/cleanup.sh"
      ],
      "only": ["virtualbox-iso"]
    }
  ]
}

我不确定为什么它不起作用,如能得到任何帮助我将非常感激。

答案1

这对我有用:

"<tab><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>",
"<wait> preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ubuntu-server.seed ",
"debian-installer=en_US auto=true locale=en_US kbd-chooser/method=us ",
"console-setup/ask_detect=false keyboard-configuration/layoutcode=us ",
"hostname=ubuntu initrd=initrd.gz --- quiet <wait><enter>"

相关内容