【问题标题】:packer is hanging here "vmware-iso: waiting for ssh to become available"打包程序挂在这里“vmware-iso:等待 ssh 可用”
【发布时间】:2017-09-14 07:03:05
【问题描述】:

我正在尝试使用 packer 在 VMware 上创建机器映像。

在构建时,它会一直等待 ssh 可用。这是我的 json:

{
    "builders": [
        {
            "type": "vmware-iso",
            "boot_command": [
                "<esc><esc><enter><wait>",
                "/install/vmlinuz noapic preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
                "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
                "hostname={{ .Name }} ",
                "fb=false debconf/frontend=noninteractive ",
                "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ",
                "initrd=/install/initrd.gz -- <enter>"
            ],
            "boot_wait": "10s",
            "disk_size": 40960,
            "guest_os_type": "Ubuntu-64",
            "http_directory": "http",
            "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-i386.iso",
            "iso_checksum": "1214cd22448338b60bb24f583dd8741a",
            "iso_checksum_type": "md5",
            "ssh_username": "ubuntu",
            "ssh_password": "root123",
            "remote_datastore": "aaa",
            "vm_name": "aaa",
            "format": "vmx",
            "ssh_pty": "true",
            "ssh_port": "22",
            "headless": false,
            "remote_type": "esx5",
            "remote_host": "aaa",
            "remote_username": "aaa",
            "remote_password": "aaa",
            "remote_port": "22",
            "ssh_wait_timeout": "10000s",
            "shutdown_command": "shutdown -P now"
        }
    ]
}

这个设置有什么问题吗?

这是我的 preceed.cfg:

d-i debian-installer/locale 字符串 en_US

d-i 控制台设置/ask_detect boolean false

d-i 控制台设置/布局代码字符串我们

d-i netcfg/get_hostname string unassigned-hostname

d-i netcfg/get_domain string unassigned-domain

d-i netcfg/choose_interface 选择自动

d-i netcfg/wireless_wep 字符串

d-i netcfg/disable_autoconfig boolean true

d-i netcfg/dhcp_failed note

d-i netcfg/dhcp_options 选择手动配置网络

d-i netcfg/get_ipaddress 字符串 172.22.1.74

d-i netcfg/get_netmask 字符串 255.255.252.0

d-i netcfg/get_gateway 字符串 172.22.64.1

d-i netcfg/get_nameservers 字符串 172.22.64.1

d-i netcfg/confirm_static boolean true

d-i base-installer/kernel/override-image string linux-server

d-i 时钟设置/utc-auto boolean true

d-i 时钟设置/UTC 布尔真

d-i 时间/时区字符串美国/太平洋

d-i 时钟设置/ntp boolean true

d-i 镜像/国家字符串 US

d-i 镜像/http/代理字符串

d-i pkgsel/install-language-support boolean false

tasksel tasksel/第一个多选标准,ubuntu-server

d-i partman-auto/方法字符串正则

d-i partman-auto/purge_lvm_from_device boolean true

d-i partman-lvm/confirm boolean true

d-i partman-auto/choose_recipe 选择原子

d-i partman/confirm_write_new_label boolean true

d-i partman/choose_partition 选择完成

d-i partman/confirm boolean true

d-i passwd/user-fullname string Ubuntu 用户

d-i 密码/用户名字符串 ubuntu

d-i passwd/user-password密码root123

d-i passwd/user-password-再次密码root123

d-i grub-installer/only_debian boolean true

d-i grub-installer/with_other_os boolean true

d-i 完成安装/reboot_in_progress 说明

【问题讨论】:

  • 提供您的preseed.cfg。
  • 您指定了"guest_os_type": "Ubuntu-64",但随后您使用了 i386 ISO,这可能不是您想要的。
  • 我需要更改 precced.cfg 中的任何内容吗?
  • #d-i passwd/root-password 密码 root123 #d-i passwd/root-password-again 密码 root123
  • d-i passwd/root-login boolean false 我应该把它设为 true 吗?

标签: ssh vmware packer


【解决方案1】:

第一个答案:您需要为 VNC 打开防火墙。

第二个答案:您要么需要配置 dhcp 服务器,要么必须使用需要在 preseed.cfg 和带有 ssh_host 的打包程序模板中配置的静态 IP 地址。

【讨论】:

  • 嘿,它再次等待 ssh 可用。我做了 headless=false ,但 GUI 没有打开。
  • 您希望 GUI 在哪里打开?您正在远程 ESXi 上运行。尝试在 vSphere 中打开控制台或使用 ESXi Embedded Host Client。
  • 我尝试使用此命令运行 json 文件 PACKER_LOG=1 packer build test1.json 这是输出-“等待 ssh 可用”-“打开新的 ssh 会话”“启动远程命令:esxcli --formatter csv network vm list" " [DEBUG] 获取 SSH 地址时出错:EOF" "等待 ssh 超时"
  • 你指的是哪个控制台?
猜你喜欢
  • 1970-01-01
  • 2017-03-16
  • 1970-01-01
  • 1970-01-01
  • 2016-09-23
  • 2015-10-04
  • 2021-07-17
  • 2018-04-28
  • 1970-01-01
相关资源
最近更新 更多