Packer QEMU on CentOS 6.6 Waiting for SSH timeout

2,127 views
Skip to first unread message

Eric Brose

unread,
Jun 17, 2015, 6:32:10 PM6/17/15
to packe...@googlegroups.com
Hey All.
Seen a few other posts like this but i haven't been able to come to a resolution..
Running Packer 0.7.5 on CentOS (6.6) server (no UI)

Here is the basic log
packer build packer.centos65.json
qemu output will be in this color.

==> qemu: Downloading or copying ISO
    qemu: Downloading or copying: http://mirror.beyondhosting.net/CentOS/6/isos/x86_64/CentOS-6.6-x86_64-netinstall.iso
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 10088
==> qemu: Found port for SSH: 2224.
==> qemu: Looking for available port between 5900 and 6000
==> qemu: Found available VNC port: 5947
==> qemu: Starting VM, booting from CD-ROM
    qemu: WARNING: The VM will be started in headless mode, as configured.
    qemu: In headless mode, errors during the boot sequence or OS setup
    qemu: won't be easily visible. Use at your own discretion.
==> qemu: Waiting 5s for boot...
==> qemu: Connecting to VM via VNC
==> qemu: Typing the boot command over VNC...
==> qemu: Waiting for SSH to become available...

here it times out eventually.

Detailed Log looks something like this, i've stripped a bunch of stuff out obviously...

14:04:17 Reading template: packer.centos65.json
14:04:17 Creating build: qemu
14:04:17 Loading builder: qemu
14:04:17 Creating plugin client for path: /usr/local/packer/packer-builder-qemu
14:04:17 Starting plugin: /usr/local/packer/packer-builder-qemu []string{"/usr/local/packer/packer-builder-qemu"}
14:04:17 Waiting for RPC address for: /usr/local/packer/packer-builder-qemu
14:04:17 packer-builder-qemu: 14:04:17 Plugin minimum port: 10000
14:04:17 packer-builder-qemu: 14:04:17 Plugin maximum port: 25000
14:04:17 packer-builder-qemu: 14:04:17 Waiting for connection...
14:04:17 packer-builder-qemu: 14:04:17 Serving a plugin connection...
14:04:17 Starting build run: qemu
14:04:17 Running builder: qemu
14:04:17 packer-builder-qemu: 14:04:17 Qemu path: /usr/libexec/qemu-kvm, Qemu Image page: /usr/bin/qemu-img
14:04:18 packer-builder-qemu: 14:04:18 No floppy files specified. Floppy disk will not be made.
14:04:18 ui: ^[[1;32m==> qemu: Creating hard drive...
14:04:18 packer-builder-qemu: 14:04:18 Executing qemu-img: []string{"create", "-f", "qcow2", "output_centos_tdhtest/centost65test.qcow2", "5000M"}
14:04:18 packer-builder-qemu: 14:04:18 stdout: Formatting 'output_centos_tdhtest/centost65test.qcow2', fmt=qcow2 size=5242880000 encryption=off cluster_size=65536
14:04:18 ui: ^[[1;32m==> qemu: Starting HTTP server on port 10088
14:04:18 ui: ^[[1;32m==> qemu: Found port for SSH: 2224.
14:04:18 ui: ^[[1;32m==> qemu: Found available VNC port: 5947
14:04:18 ui: ^[[1;32m==> qemu: Starting VM, booting from CD-ROM
14:04:18 ui: ^[[0;32m    qemu: WARNING: The VM will be started in headless mode, as configured.
    qemu: In headless mode, errors during the boot sequence or OS setup
    qemu: won't be easily visible. Use at your own discretion.
14:04:18 packer-builder-qemu: 14:04:18 Executing /usr/libexec/qemu-kvm: []string{"-device", "virtio-net-pci,netdev=user.0", "-cdrom", "/usr/local/packer/packer_cache/85d0fa70ad41185d3af8db1d3fdf32ed585fda7b9c258c2f792a040c4b2dccc3.iso", "-netdev", "user,id=user.0,hostfwd=tcp::2224-:22", "-vnc", "0.0.0.0:47", "-machine", "type=pc,accel=kvm", "-drive", "file=output_centos_tdhtest/centost65test.qcow2,if=virtio,cache=writeback", "-boot", "once=d", "-m", "512M", "-name", "centost65test"}
14:04:18 packer-builder-qemu: 14:04:18 Started Qemu. Pid: 6391
14:04:20 ui: ^[[1;32m==> qemu: Waiting 5s for boot...
14:04:25 ui: ^[[1;32m==> qemu: Connecting to VM via VNC
14:04:25 packer-builder-qemu: 14:04:25 Connected to VNC desktop: QEMU (centost65test)
14:04:25 ui: ^[[1;32m==> qemu: Typing the boot command over VNC...
14:04:33 packer-builder-qemu: 14:04:33 Waiting for SSH, up to timeout: 1h30m0s
14:04:33 ui: ^[[1;32m==> qemu: Waiting for SSH to become available...^[[0m
14:04:33 packer-builder-qemu: 14:04:33 Attempting SSH connection...
14:04:33 packer-builder-qemu: 14:04:33 reconnecting to TCP connection for SSH
14:04:33 packer-builder-qemu: 14:04:33 handshaking with SSH
14:05:04 packer-builder-qemu: 14:05:04 handshake error: ssh: handshake failed: read tcp 127.0.0.1:2224: connection reset by peer
14:05:04 packer-builder-qemu: 14:05:04 SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:2224: connection reset by peer

over and over again...


My packer.centos65.json looks like this.

{
  "builders":
  [
    {
      "type": "qemu",
      "iso_url": "http://mirror.beyondhosting.net/CentOS/6/isos/x86_64/CentOS-6.6-x86_64-netinstall.iso",
      "iso_checksum": "2342bc5ea72fc028972aa0f21cee28b4",
      "iso_checksum_type": "md5",
      "output_directory": "output_centos_tdhtest",
      "ssh_wait_timeout": "30s",
      "qemu_binary": "qemu-kvm",     
      "shutdown_command": "shutdown -P now",
      "disk_size": 5000,
      "format": "qcow2",
      "headless": true,
      "accelerator": "kvm",
      "http_directory": "httpdir",
      "http_port_min": 10082,
      "http_port_max": 10089,
      "ssh_host_port_min": 2222,
      "ssh_host_port_max": 2229,
      "ssh_username": "root",
      "ssh_password": "password",
      "ssh_port": 22,
      "ssh_wait_timeout": "90m",
      "vm_name": "centost65test",
      "net_device": "virtio-net-pci",
      "disk_interface": "virtio",
      "boot_wait": "5s",
      "boot_command":
      [
        "<tab><wait>",
    " ks=http://<a local url i can view in a browser>packer.ks<enter>"
      ]
    }
  ]
}


my kickstart looks something like this..

#version=DEVEL
install
text

url --url http://local.repo/yum/centos/6/os/x86_64
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp
rootpw --iscrypted <root password>
reboot
firewall --disabled  --service=ssh
authconfig --useshadow --enablemd5
selinux --disabled
skipx
timezone --utc America/Los_Angeles
services --disabled atd,autofs,avahi-daemon,bluetooth,cups,fcoe,haldaemon,ip6tables,iptables,iscsi,iscsid,jexec,livesys-late,lldapd,messagebus,netfs,nfslock,openct,pcscd,rpcbind,rpcidmapd

bootloader --location=mbr --driveorder=sda --append="panic=10"
zerombr
clearpart --drives=sda --all --initlabel
part /boot --fstype=ext4 --size=500 --asprimary --ondisk=sda
part / --fstype=ext4 --grow --size=3000 --asprimary --ondisk=sda
part swap --grow --maxsize=2016 --size=2016 --asprimary --ondisk=sda

%pre
$SNIPPET('pre_anamon')
$SNIPPET('kickstart_start')
%end

%packages --nobase
@Core
binutils
bind-utils
gcc
git
jwhois
kernel-devel
lsof
make
man
nc
nmap
ntp
patch
python
rsync
screen
sudo
sysstat
strace
system-config-network-tui
system-config-firewall
unzip
vconfig
vim-minimal
vim-enhanced
wget
which
zip

-indexhtml
%end

%post

### Install packer SSH key
cd /root
mkdir --mode=700 .ssh
cat >> .ssh/authorized_keys << "PUBLIC_KEY"
ssh-rsa myKey...
PUBLIC_KEY
chmod 600 .ssh/authorized_keys

$SNIPPET('kickstart_done')
%end

Any help debugging would be truly appreciated...
Cheers
Eric

Eric Brose

unread,
Jun 17, 2015, 6:43:49 PM6/17/15
to packe...@googlegroups.com
I have tested building the same iso with the same ks on ESX and it works fine.
I also verified that i could passwordless ssh into the VM just fine from my packer host..

Alvaro Miranda Aguilera

unread,
Jun 17, 2015, 7:40:43 PM6/17/15
to packe...@googlegroups.com
On Thu, Jun 18, 2015 at 10:32 AM, Eric Brose <isis...@gmail.com> wrote:
> clearpart --drives=sda --all --initlabel

Hello

Quick question

it's sda on qemu too?

since on some providers the name will be different

hda
sda
xvda
vda <--- this is what I have seen in kvm

Eric Brose

unread,
Jun 18, 2015, 11:08:18 AM6/18/15
to packe...@googlegroups.com
Thanks Alvaro..
I've tried
clearpart --drives=vda --all --initlabel
in the kickstart and still seeing the same issue.

Im fairly new to this, is there another sort of UI i can use to try and get into the VM while packer is running to see if there is something with the boot that is happening?

if i netstat -tulpn | grep 5947 < the VNC port >
it says its up and listening...





--
You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/H70IGeIxWWA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Patrick Murray

unread,
Jun 18, 2015, 2:13:51 PM6/18/15
to packe...@googlegroups.com
I'm having the same issue on Packer 0.7.5 with Mac OS 10.10.3, so it's not specific to Linux.

Eric Brose

unread,
Jun 18, 2015, 9:11:35 PM6/18/15
to packe...@googlegroups.com
Hey Patrick
Ive got a yosemite box with vmfusion. I was able to get packer to make an VM. Will see if i can install the kvm bits on osx and see if i also see what you are seeing
Eric


On Thursday, June 18, 2015, Patrick Murray <pdmu...@gmail.com> wrote:
I'm having the same issue on Packer 0.7.5 with Mac OS 10.10.3, so it's not specific to Linux.

--

Patrick Murray

unread,
Jun 18, 2015, 11:51:02 PM6/18/15
to packe...@googlegroups.com

I installed qemu with homebrew.  It doesn't seem to have kvm support, so I had to disable the accelerator in packer.  That's probably aside from the ssh handshake loop though.

Ramzi Abdoch

unread,
Jun 24, 2015, 4:54:03 PM6/24/15
to packe...@googlegroups.com
Hey Eric,

How did you get your Yosemite box put together? I tried using the tools here, but it didn't seem to work (and there's an outstanding issue about it).

Any help would be greatly appreciated!
- Ramzi


On Thursday, June 18, 2015 at 9:11:35 PM UTC-4, Eric Brose wrote:
Hey Patrick
Ive got a yosemite box with vmfusion. I was able to get packer to make an VM. Will see if i can install the kvm bits on osx and see if i also see what you are seeing
Eric

On Thursday, June 18, 2015, Patrick Murray <pdmu...@gmail.com> wrote:
I'm having the same issue on Packer 0.7.5 with Mac OS 10.10.3, so it's not specific to Linux.

--
You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/H70IGeIxWWA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.

Eric Brose

unread,
Jul 1, 2015, 10:24:33 AM7/1/15
to packe...@googlegroups.com
Hey Ramzi.
I have not progressed any on yosemite... still working on linux. did finally sort out how to VNC into the build as its being created. The only remote VNC client i can get to work for some reason is TightVNC. (i tried 3 other clients, assuming some sort of security setting)
My issue turned out to be my kickstart and the /dev/sda/ part. i changed to /dev/vda and its progressed further than i've gotten before. Still won't complete and trying to work my way through it, at least i now know that its at least progressing without a error in the boot ;)


Eric
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/H70IGeIxWWA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/3a06a761-8e1a-41f2-8f58-9acb389650dd%40googlegroups.com.

Alvaro Miranda Aguilera

unread,
Jul 1, 2015, 5:14:33 PM7/1/15
to packe...@googlegroups.com
Hello,

If you can share the errors you are getting, I am sure someone here
can help, as will be linux stuff now that the installer is running.

Thanks
Alvaro
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CAA8pRVEGNLE3ER34jaDFaTKzvyxqxWBjgFp_ANG3L9PvcskbWg%40mail.gmail.com.

Eric Brose

unread,
Jul 1, 2015, 7:16:49 PM7/1/15
to packe...@googlegroups.com
Hey Alvaro. I am all good now!!!! first the kickstart was the issue, then it turns out the mount i was trying to build the image on was full... wooops ;)
Packer is great! built a couple centos images today and now working on provisioning!
Cheers and thanks for the help earlier!
Still don't know why TightVNC was the only client i could use to VNC into image as it was being built. but hopefully others will see this and try it.
Cheers and thanks again!
Eric

Reply all
Reply to author
Forward
0 new messages