hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.12k stars 3.33k forks source link

qemu: Timeout waiting for SSH #4988

Closed GavinYin closed 7 years ago

GavinYin commented 7 years ago

qemu: Timeout waiting for SSH Build 'qemu' errored: Timeout waiting for SSH. linux:CentOS Linux release 7.3.1611 Packer version: 1.0.0 qemu version : 1.5.3 cvm.json

    "builders":
    [
        {
            "type": "qemu",
            "qemu_binary" : "/usr/libexec/qemu-kvm",
            "iso_url": "/usr/local/bin/CentOS-7-x86_64-DVD-1511.iso",
            "iso_checksum": "c875b0f1dabda14f00a3e261d241f63e",
            "iso_checksum_type": "md5",
            "output_directory": "/root/cvm",
            "shutdown_command": "shutdown -P now",
            "disk_size": 500000,
            "format": "qcow2",
            "headless": false,
            "accelerator": "kvm",
            "http_directory": "/var/www/html",
            "http_port_min": 10082,
            "http_port_max": 10089,
            "ssh_host_port_min": 2222,
            "ssh_host_port_max": 2229,
            "ssh_username": "root",
            "ssh_password": "s0m3password",
            "ssh_port": 22,
            "ssh_wait_timeout": "2m",
            "vm_name": "cvm_test",
            "net_device": "virtio-net",
            "disk_interface": "virtio",
            "boot_wait": "5s",
            "boot_command": [
               "<tab> text ks=http://172.16.21.86/ks.cfg<enter><wait>"
      ]
        }
    ]
}

ks.cfg

install
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
reboot

timezone Asia/Shanghai --isUtc

#url --url="http://172.16.21.86/centos"
rootpw s0m3password
# Firewall configuration
firewall --disabled
# Network information
#network  --bootproto=dhcp --onboot=yes --noipv6 --hostname=localhost
network --onboot yes --device eth0 --bootproto dhcp
# System authorization information
auth  --useshadow  --passalgo=sha512
# SELinux configuration
selinux --disabled

# System bootloader configuration
bootloader --location=mbr --boot-drive=sdb
# Clear the Master Boot Record
zerombr

autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel 
# Disk partitioning information
ignoredisk --only-use=sdb
#part /boot --fstype=ext4 --size=1024 --ondisk=sda
#part swap  --fstype=swap --size=1024 --ondisk=sda
#part /home  --fstype=ext4 --size=204800 --ondisk=sda
#part /  --fstype=ext4 --size=204800 --ondisk=sda

%packages
@core
openssh-clients
libvirt
vim
ntp
java-1.8.0-openjdk.x86_64
%end

%post --interpreter=/bin/bash

sed -i "s/#PermitRootLogin yes/PermitRootLogin yes/g" /etc/ssh/sshd_config
%end

the output of packer

[root@localhost bin]# export PACKER_LOG=1 && packer build cvm.json 
2017/06/07 18:51:18 [INFO] Packer version: 1.0.0
2017/06/07 18:51:18 Packer Target OS/Arch: linux amd64
2017/06/07 18:51:18 Built with Go Version: go1.8
2017/06/07 18:51:18 Detected home directory from env var: /root
2017/06/07 18:51:18 Using internal plugin for virtualbox-ovf
2017/06/07 18:51:18 Using internal plugin for amazon-chroot
2017/06/07 18:51:18 Using internal plugin for amazon-ebsvolume
2017/06/07 18:51:18 Using internal plugin for hyperv-iso
2017/06/07 18:51:18 Using internal plugin for profitbricks
2017/06/07 18:51:18 Using internal plugin for qemu
2017/06/07 18:51:18 Using internal plugin for vmware-iso
2017/06/07 18:51:18 Using internal plugin for amazon-instance
2017/06/07 18:51:18 Using internal plugin for cloudstack
2017/06/07 18:51:18 Using internal plugin for file
2017/06/07 18:51:18 Using internal plugin for googlecompute
2017/06/07 18:51:18 Using internal plugin for openstack
2017/06/07 18:51:18 Using internal plugin for amazon-ebs
2017/06/07 18:51:18 Using internal plugin for azure-arm
2017/06/07 18:51:18 Using internal plugin for null
2017/06/07 18:51:18 Using internal plugin for parallels-iso
2017/06/07 18:51:18 Using internal plugin for triton
2017/06/07 18:51:18 Using internal plugin for virtualbox-iso
2017/06/07 18:51:18 Using internal plugin for vmware-vmx
2017/06/07 18:51:18 Using internal plugin for amazon-ebssurrogate
2017/06/07 18:51:18 Using internal plugin for digitalocean
2017/06/07 18:51:18 Using internal plugin for docker
2017/06/07 18:51:18 Using internal plugin for oneandone
2017/06/07 18:51:18 Using internal plugin for parallels-pvm
2017/06/07 18:51:18 Using internal plugin for powershell
2017/06/07 18:51:18 Using internal plugin for ansible
2017/06/07 18:51:18 Using internal plugin for converge
2017/06/07 18:51:18 Using internal plugin for file
2017/06/07 18:51:18 Using internal plugin for chef-client
2017/06/07 18:51:18 Using internal plugin for salt-masterless
2017/06/07 18:51:18 Using internal plugin for shell-local
2017/06/07 18:51:18 Using internal plugin for ansible-local
2017/06/07 18:51:18 Using internal plugin for shell
2017/06/07 18:51:18 Using internal plugin for windows-restart
2017/06/07 18:51:18 Using internal plugin for windows-shell
2017/06/07 18:51:18 Using internal plugin for chef-solo
2017/06/07 18:51:18 Using internal plugin for puppet-masterless
2017/06/07 18:51:18 Using internal plugin for puppet-server
2017/06/07 18:51:18 Using internal plugin for amazon-import
2017/06/07 18:51:18 Using internal plugin for artifice
2017/06/07 18:51:18 Using internal plugin for atlas
2017/06/07 18:51:18 Using internal plugin for docker-push
2017/06/07 18:51:18 Using internal plugin for vagrant
2017/06/07 18:51:18 Using internal plugin for vagrant-cloud
2017/06/07 18:51:18 Using internal plugin for checksum
2017/06/07 18:51:18 Using internal plugin for docker-import
2017/06/07 18:51:18 Using internal plugin for docker-tag
2017/06/07 18:51:18 Using internal plugin for googlecompute-export
2017/06/07 18:51:18 Using internal plugin for compress
2017/06/07 18:51:18 Using internal plugin for docker-save
2017/06/07 18:51:18 Using internal plugin for manifest
2017/06/07 18:51:18 Using internal plugin for shell-local
2017/06/07 18:51:18 Using internal plugin for vsphere
2017/06/07 18:51:18 Detected home directory from env var: /root
2017/06/07 18:51:18 Attempting to open config file: /root/.packerconfig
2017/06/07 18:51:18 [WARN] Config file doesn't exist: /root/.packerconfig
2017/06/07 18:51:18 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[amazon-ebsvolume:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume file:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file amazon-ebs:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs azure-arm:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-azure-arm null:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null triton:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton amazon-ebssurrogate:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate parallels-pvm:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm vmware-vmx:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx digitalocean:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean amazon-chroot:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot hyperv-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso profitbricks:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks qemu:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu cloudstack:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack googlecompute:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute docker:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker oneandone:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone virtualbox-ovf:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf vmware-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso amazon-instance:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance openstack:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack parallels-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso virtualbox-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso] PostProcessors:map[docker-tag:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag googlecompute-export:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export compress:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress manifest:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest docker-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import docker-save:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save vsphere:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere artifice:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice checksum:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum amazon-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import atlas:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-atlas docker-push:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push vagrant:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant vagrant-cloud:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud shell-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local] Provisioners:map[chef-solo:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo puppet-masterless:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless file:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file chef-client:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client shell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell windows-restart:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart ansible:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible shell-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local windows-shell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell converge:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge salt-masterless:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless puppet-server:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server powershell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell ansible-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local]}
2017/06/07 18:51:18 Setting cache directory: /usr/local/bin/packer_cache
2017/06/07 18:51:18 Loading builder: qemu
2017/06/07 18:51:18 Plugin could not be found. Checking same directory as executable.
2017/06/07 18:51:18 Current exe path: /usr/local/bin/packer
2017/06/07 18:51:18 Creating plugin client for path: /usr/local/bin/packer
2017/06/07 18:51:18 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-qemu"}
2017/06/07 18:51:18 Waiting for RPC address for: /usr/local/bin/packer
2017/06/07 18:51:18 Detected home directory from env var: /root
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 [INFO] Packer version: 1.0.0
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Packer Target OS/Arch: linux amd64
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Built with Go Version: go1.8
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Detected home directory from env var: /root
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Attempting to open config file: /root/.packerconfig
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 [WARN] Config file doesn't exist: /root/.packerconfig
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Setting cache directory: /usr/local/bin/packer_cache
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 args: []string{"packer-builder-qemu"}
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Plugin minimum port: 10000
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Plugin maximum port: 25000
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Detected home directory from env var: /root
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Plugin address: unix /tmp/packer-plugin018796200
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Waiting for connection...
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Serving a plugin connection...
2017/06/07 18:51:18 ui: qemu output will be in this color.
2017/06/07 18:51:18 ui: 
2017/06/07 18:51:18 Build debug mode: false
2017/06/07 18:51:18 Force build: false
2017/06/07 18:51:18 On error: 
2017/06/07 18:51:18 Preparing build: qemu
qemu output will be in this color.

2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 use specified accelerator: kvm
2017/06/07 18:51:18 Waiting on builds to complete...
2017/06/07 18:51:18 Starting build run: qemu
2017/06/07 18:51:18 Running builder: qemu
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Qemu path: /usr/libexec/qemu-kvm, Qemu Image page: /usr/bin/qemu-img
2017/06/07 18:51:18 ui: ==> qemu: Downloading or copying ISO
==> qemu: Downloading or copying ISO
2017/06/07 18:51:18 ui:     qemu: Downloading or copying: file:///usr/local/bin/CentOS-7-x86_64-DVD-1511.iso
    qemu: Downloading or copying: file:///usr/local/bin/CentOS-7-x86_64-DVD-1511.iso
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Acquiring lock to download: file:///usr/local/bin/CentOS-7-x86_64-DVD-1511.iso
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Parsed URL: &url.URL{Scheme:"file", Opaque:"", User:(*url.Userinfo)(nil), Host:"", Path:"/usr/local/bin/CentOS-7-x86_64-DVD-1511.iso", RawPath:"", ForceQuery:false, RawQuery:"", Fragment:""}
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 [DEBUG] Using local file: /usr/local/bin/CentOS-7-x86_64-DVD-1511.iso
2017/06/07 18:51:18 packer: 2017/06/07 18:51:18 Verifying checksum of /usr/local/bin/CentOS-7-x86_64-DVD-1511.iso
2017/06/07 18:52:17 packer: 2017/06/07 18:52:17 No floppy files specified. Floppy disk will not be made.
2017/06/07 18:52:17 ui: ==> qemu: Creating hard drive...
==> qemu: Creating hard drive...
2017/06/07 18:52:17 packer: 2017/06/07 18:52:17 Executing qemu-img: []string{"create", "-f", "qcow2", "/root/cvm/cvm_test", "500000M"}
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 stdout: Formatting '/root/cvm/cvm_test', fmt=qcow2 size=524288000000 encryption=off cluster_size=65536 lazy_refcounts=off
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 stderr:
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Trying port: 10087
==> qemu: Starting HTTP server on port 10087
2017/06/07 18:52:19 ui: ==> qemu: Starting HTTP server on port 10087
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Looking for available communicator (SSH, WinRM, etc) port between 2222 and 2229
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Trying port: 2223
2017/06/07 18:52:19 ui: ==> qemu: Found port for communicator (SSH, WinRM, etc): 2223.
==> qemu: Found port for communicator (SSH, WinRM, etc): 2223.
2017/06/07 18:52:19 ui: ==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Looking for available port between 5900 and 6000 on 127.0.0.1
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Trying port: 5987
2017/06/07 18:52:19 packer: 2017/06/07 18:52:19 Found available VNC port: 5987 on IP: 127.0.0.1
2017/06/07 18:52:19 ui: ==> qemu: Starting VM, booting from CD-ROM
==> qemu: Starting VM, booting from CD-ROM
2017/06/07 18:52:21 packer: 2017/06/07 18:52:21 Qemu --version output: QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-126.el7_3.6), Copyright (c) 2003-2008 Fabrice Bellard
2017/06/07 18:52:21 packer: 2017/06/07 18:52:21 Qemu version: 1.5.3
    qemu: WARNING: The version of qemu  on your host doesn't support display mode.
2017/06/07 18:52:21 ui:     qemu: WARNING: The version of qemu  on your host doesn't support display mode.
    qemu: The display parameter will be ignored.
2017/06/07 18:52:21 packer: 2017/06/07 18:52:21 Qemu Builder has no floppy files, not attaching a floppy.
2017/06/07 18:52:21 packer: 2017/06/07 18:52:21 Executing /usr/libexec/qemu-kvm: []string{"-name", "cvm_test", "-boot", "once=d", "-netdev", "user,id=user.0,hostfwd=tcp::2223-:22", "-drive", "file=/root/cvm/cvm_test,if=virtio,cache=writeback,format=qcow2", "-cdrom", "/usr/local/bin/CentOS-7-x86_64-DVD-1511.iso", "-m", "512M", "-vnc", "127.0.0.1:87", "-machine", "type=pc,accel=kvm", "-device", "virtio-net,netdev=user.0"}
    qemu: The display parameter will be ignored.
2017/06/07 18:52:21 packer: 2017/06/07 18:52:21 Started Qemu. Pid: 3663
==> qemu: Waiting 5s for boot...
2017/06/07 18:52:23 ui: ==> qemu: Waiting 5s for boot...
2017/06/07 18:52:28 ui: ==> qemu: Connecting to VM via VNC
==> qemu: Connecting to VM via VNC
2017/06/07 18:52:28 packer: 2017/06/07 18:52:28 Connected to VNC desktop: QEMU (cvm_test)
2017/06/07 18:52:28 ui: ==> qemu: Typing the boot command over VNC...
==> qemu: Typing the boot command over VNC...
2017/06/07 18:52:28 packer: 2017/06/07 18:52:28 Special code '<tab>' found, replacing with: 65289
2017/06/07 18:52:28 packer: 2017/06/07 18:52:28 Sending char ' ', code 32, shift false
2017/06/07 18:52:28 packer: 2017/06/07 18:52:28 Sending char 't', code 116, shift false
2017/06/07 18:52:29 packer: 2017/06/07 18:52:29 Sending char 'e', code 101, shift false
2017/06/07 18:52:29 packer: 2017/06/07 18:52:29 Sending char 'x', code 120, shift false
2017/06/07 18:52:29 packer: 2017/06/07 18:52:29 Sending char 't', code 116, shift false
2017/06/07 18:52:30 packer: 2017/06/07 18:52:30 Sending char ' ', code 32, shift false
2017/06/07 18:52:30 packer: 2017/06/07 18:52:30 Sending char 'k', code 107, shift false
2017/06/07 18:52:30 packer: 2017/06/07 18:52:30 Sending char 's', code 115, shift false
2017/06/07 18:52:30 packer: 2017/06/07 18:52:30 Sending char '=', code 61, shift false
2017/06/07 18:52:31 packer: 2017/06/07 18:52:31 Sending char 'h', code 104, shift false
2017/06/07 18:52:31 packer: 2017/06/07 18:52:31 Sending char 't', code 116, shift false
2017/06/07 18:52:31 packer: 2017/06/07 18:52:31 Sending char 't', code 116, shift false
2017/06/07 18:52:32 packer: 2017/06/07 18:52:32 Sending char 'p', code 112, shift false
2017/06/07 18:52:32 packer: 2017/06/07 18:52:32 Sending char ':', code 58, shift true
2017/06/07 18:52:32 packer: 2017/06/07 18:52:32 Sending char '/', code 47, shift false
2017/06/07 18:52:33 packer: 2017/06/07 18:52:33 Sending char '/', code 47, shift false
2017/06/07 18:52:33 packer: 2017/06/07 18:52:33 Sending char '1', code 49, shift false
2017/06/07 18:52:33 packer: 2017/06/07 18:52:33 Sending char '7', code 55, shift false
2017/06/07 18:52:33 packer: 2017/06/07 18:52:33 Sending char '2', code 50, shift false
2017/06/07 18:52:34 packer: 2017/06/07 18:52:34 Sending char '.', code 46, shift false
2017/06/07 18:52:34 packer: 2017/06/07 18:52:34 Sending char '1', code 49, shift false
2017/06/07 18:52:34 packer: 2017/06/07 18:52:34 Sending char '6', code 54, shift false
2017/06/07 18:52:35 packer: 2017/06/07 18:52:35 Sending char '.', code 46, shift false
2017/06/07 18:52:35 packer: 2017/06/07 18:52:35 Sending char '2', code 50, shift false
2017/06/07 18:52:35 packer: 2017/06/07 18:52:35 Sending char '1', code 49, shift false
2017/06/07 18:52:36 packer: 2017/06/07 18:52:36 Sending char '.', code 46, shift false
2017/06/07 18:52:36 packer: 2017/06/07 18:52:36 Sending char '8', code 56, shift false
2017/06/07 18:52:36 packer: 2017/06/07 18:52:36 Sending char '6', code 54, shift false
2017/06/07 18:52:36 packer: 2017/06/07 18:52:36 Sending char '/', code 47, shift false
2017/06/07 18:52:37 packer: 2017/06/07 18:52:37 Sending char 'k', code 107, shift false
2017/06/07 18:52:37 packer: 2017/06/07 18:52:37 Sending char 's', code 115, shift false
2017/06/07 18:52:37 packer: 2017/06/07 18:52:37 Sending char '.', code 46, shift false
2017/06/07 18:52:38 packer: 2017/06/07 18:52:38 Sending char 'c', code 99, shift false
2017/06/07 18:52:38 packer: 2017/06/07 18:52:38 Sending char 'f', code 102, shift false
2017/06/07 18:52:38 packer: 2017/06/07 18:52:38 Sending char 'g', code 103, shift false
2017/06/07 18:52:39 packer: 2017/06/07 18:52:39 Special code '<enter>' found, replacing with: 65293
2017/06/07 18:52:39 packer: 2017/06/07 18:52:39 Special code '<wait>' found, sleeping one second
2017/06/07 18:52:40 ui: ==> qemu: Waiting for SSH to become available...
2017/06/07 18:52:40 packer: 2017/06/07 18:52:40 [INFO] Waiting for SSH, up to timeout: 2m0s
==> qemu: Waiting for SSH to become available...
2017/06/07 18:52:40 packer: 2017/06/07 18:52:40 [INFO] Attempting SSH connection...
2017/06/07 18:52:40 packer: 2017/06/07 18:52:40 reconnecting to TCP connection for SSH
2017/06/07 18:52:40 packer: 2017/06/07 18:52:40 handshaking with SSH
2017/06/07 18:53:03 packer: 2017/06/07 18:53:03 handshake error: ssh: handshake failed: read tcp 127.0.0.1:53978->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:03 packer: 2017/06/07 18:53:03 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:53978->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:10 packer: 2017/06/07 18:53:10 [INFO] Attempting SSH connection...
2017/06/07 18:53:10 packer: 2017/06/07 18:53:10 reconnecting to TCP connection for SSH
2017/06/07 18:53:10 packer: 2017/06/07 18:53:10 handshaking with SSH
2017/06/07 18:53:10 packer: 2017/06/07 18:53:10 handshake error: ssh: handshake failed: read tcp 127.0.0.1:53982->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:10 packer: 2017/06/07 18:53:10 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:53982->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:17 packer: 2017/06/07 18:53:17 [INFO] Attempting SSH connection...
2017/06/07 18:53:17 packer: 2017/06/07 18:53:17 reconnecting to TCP connection for SSH
2017/06/07 18:53:17 packer: 2017/06/07 18:53:17 handshaking with SSH
2017/06/07 18:53:17 packer: 2017/06/07 18:53:17 handshake error: ssh: handshake failed: EOF
2017/06/07 18:53:17 packer: 2017/06/07 18:53:17 [DEBUG] SSH handshake err: ssh: handshake failed: EOF
2017/06/07 18:53:24 packer: 2017/06/07 18:53:24 [INFO] Attempting SSH connection...
2017/06/07 18:53:24 packer: 2017/06/07 18:53:24 reconnecting to TCP connection for SSH
2017/06/07 18:53:24 packer: 2017/06/07 18:53:24 handshaking with SSH
2017/06/07 18:53:24 packer: 2017/06/07 18:53:24 handshake error: ssh: handshake failed: read tcp 127.0.0.1:53990->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:24 packer: 2017/06/07 18:53:24 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:53990->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:31 packer: 2017/06/07 18:53:31 [INFO] Attempting SSH connection...
2017/06/07 18:53:31 packer: 2017/06/07 18:53:31 reconnecting to TCP connection for SSH
2017/06/07 18:53:31 packer: 2017/06/07 18:53:31 handshaking with SSH
2017/06/07 18:53:31 packer: 2017/06/07 18:53:31 handshake error: ssh: handshake failed: read tcp 127.0.0.1:53994->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:31 packer: 2017/06/07 18:53:31 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:53994->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:38 packer: 2017/06/07 18:53:38 [INFO] Attempting SSH connection...
2017/06/07 18:53:38 packer: 2017/06/07 18:53:38 reconnecting to TCP connection for SSH
2017/06/07 18:53:38 packer: 2017/06/07 18:53:38 handshaking with SSH
2017/06/07 18:53:38 packer: 2017/06/07 18:53:38 handshake error: ssh: handshake failed: read tcp 127.0.0.1:53998->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:38 packer: 2017/06/07 18:53:38 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:53998->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:45 packer: 2017/06/07 18:53:45 [INFO] Attempting SSH connection...
2017/06/07 18:53:45 packer: 2017/06/07 18:53:45 reconnecting to TCP connection for SSH
2017/06/07 18:53:45 packer: 2017/06/07 18:53:45 handshaking with SSH
2017/06/07 18:53:45 packer: 2017/06/07 18:53:45 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54002->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:45 packer: 2017/06/07 18:53:45 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54002->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:52 packer: 2017/06/07 18:53:52 [INFO] Attempting SSH connection...
2017/06/07 18:53:52 packer: 2017/06/07 18:53:52 reconnecting to TCP connection for SSH
2017/06/07 18:53:52 packer: 2017/06/07 18:53:52 handshaking with SSH
2017/06/07 18:53:52 packer: 2017/06/07 18:53:52 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54006->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:52 packer: 2017/06/07 18:53:52 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54006->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:59 packer: 2017/06/07 18:53:59 [INFO] Attempting SSH connection...
2017/06/07 18:53:59 packer: 2017/06/07 18:53:59 reconnecting to TCP connection for SSH
2017/06/07 18:53:59 packer: 2017/06/07 18:53:59 handshaking with SSH
2017/06/07 18:53:59 packer: 2017/06/07 18:53:59 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54010->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:53:59 packer: 2017/06/07 18:53:59 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54010->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:07 packer: 2017/06/07 18:54:07 [INFO] Attempting SSH connection...
2017/06/07 18:54:07 packer: 2017/06/07 18:54:07 reconnecting to TCP connection for SSH
2017/06/07 18:54:07 packer: 2017/06/07 18:54:07 handshaking with SSH
2017/06/07 18:54:07 packer: 2017/06/07 18:54:07 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54016->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:07 packer: 2017/06/07 18:54:07 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54016->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:14 packer: 2017/06/07 18:54:14 [INFO] Attempting SSH connection...
2017/06/07 18:54:14 packer: 2017/06/07 18:54:14 reconnecting to TCP connection for SSH
2017/06/07 18:54:14 packer: 2017/06/07 18:54:14 handshaking with SSH
2017/06/07 18:54:14 packer: 2017/06/07 18:54:14 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54020->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:14 packer: 2017/06/07 18:54:14 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54020->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:21 packer: 2017/06/07 18:54:21 [INFO] Attempting SSH connection...
2017/06/07 18:54:21 packer: 2017/06/07 18:54:21 reconnecting to TCP connection for SSH
2017/06/07 18:54:21 packer: 2017/06/07 18:54:21 handshaking with SSH
2017/06/07 18:54:21 packer: 2017/06/07 18:54:21 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54024->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:21 packer: 2017/06/07 18:54:21 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54024->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:28 packer: 2017/06/07 18:54:28 [INFO] Attempting SSH connection...
2017/06/07 18:54:28 packer: 2017/06/07 18:54:28 reconnecting to TCP connection for SSH
2017/06/07 18:54:28 packer: 2017/06/07 18:54:28 handshaking with SSH
2017/06/07 18:54:28 packer: 2017/06/07 18:54:28 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54028->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:28 packer: 2017/06/07 18:54:28 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54028->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:35 packer: 2017/06/07 18:54:35 [INFO] Attempting SSH connection...
2017/06/07 18:54:35 packer: 2017/06/07 18:54:35 reconnecting to TCP connection for SSH
2017/06/07 18:54:35 packer: 2017/06/07 18:54:35 handshaking with SSH
2017/06/07 18:54:35 packer: 2017/06/07 18:54:35 handshake error: ssh: handshake failed: read tcp 127.0.0.1:54032->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:35 packer: 2017/06/07 18:54:35 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:54032->127.0.0.1:2223: read: connection reset by peer
2017/06/07 18:54:40 ui error: ==> qemu: Timeout waiting for SSH.
==> qemu: Timeout waiting for SSH.
2017/06/07 18:54:40 packer: 2017/06/07 18:54:40 [DEBUG] SSH wait cancelled. Exiting loop.
2017/06/07 18:54:40 ui: ==> qemu: Deleting output directory...
==> qemu: Deleting output directory...
2017/06/07 18:54:40 ui error: Build 'qemu' errored: Timeout waiting for SSH.
2017/06/07 18:54:40 Builds completed. Waiting on interrupt barrier...
2017/06/07 18:54:40 machine readable: error-count []string{"1"}
2017/06/07 18:54:40 ui error: 
==> Some builds didn't complete successfully and had errors:
2017/06/07 18:54:40 machine readable: qemu,error []string{"Timeout waiting for SSH."}
2017/06/07 18:54:40 ui error: --> qemu: Timeout waiting for SSH.
Build 'qemu' errored: Timeout waiting for SSH.

==> Some builds didn't complete successfully and had errors:
--> qemu: Timeout waiting for SSH.
2017/06/07 18:54:40 ui: 
==> Builds finished but no artifacts were created.
2017/06/07 18:54:40 waiting for all plugin processes to complete...

==> Builds finished but no artifacts were created.
2017/06/07 18:54:40 /usr/local/bin/packer: plugin process exited

i can not find any method to modify this problem. please help me. thanks

rickard-von-essen commented 7 years ago

Please only use GitHub Issues for reporting bugs and feature requests. Do not ask for general help here. Use IRC #packer-tool on Freenode or the mailing list for that.

See https://www.packer.io/community/

If you are describing a bug or a feature request please reopen and try to add some more details to make it clearer.

jcrben commented 7 years ago

Experiencing the same thing. Definitely seems to be a UX issue.

wangxf1987 commented 5 years ago

You can try login vm with vnc, and check the net device in the /etc/sysconfig/network-scripts/ifcfg-xxx Ensure that: BOOTPROTO=dhcp AND ONBOOT=yes then, restart the network systemctl restart network

mikepietruszka commented 5 years ago

Make sure that your SSH configuration allows either password or publickey auth (AuthenticationMethods setting). Packer will only use one or the other. See https://www.packer.io/docs/templates/communicator.html for more details.

Packer will only use one authentication method, either publickey or if ssh_password is used packer will offer password and keyboard-interactive both sending the password. In other words Packer will not work with sshd configured with more than one configured authentication method using AuthenticationMethods.

This means that you may have to create a shell provisioner to configure sshd_config to enable the proper authentication method.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.