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.05k stars 3.32k forks source link

qemu builder fails to build your example template (still) #6857

Closed cipy closed 5 years ago

cipy commented 5 years ago

Anybody interested in actually troubleshooting and fixing this? Thanks!

I'm trying to build an simple CentOS image with

Packer version from 1.3.1
Host platform CentOS 7.5.1804

And so far after the CentOS installs and restarts the VM, the QEMU stops too.

I'm using your example from https://www.packer.io/docs/builders/qemu.html and the kickstart you link from https://gist.github.com/mitchellh/7328271/#file-centos6-ks-cfg

2018/10/16 12:59:03 packer: 2018/10/16 12:59:03 [INFO] Attempting SSH connection...
2018/10/16 12:59:03 packer: 2018/10/16 12:59:03 [DEBUG] reconnecting to TCP connection for SSH
2018/10/16 12:59:03 packer: 2018/10/16 12:59:03 [DEBUG] handshaking with SSH
2018/10/16 12:59:03 packer: 2018/10/16 12:59:03 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:39806->127.0.0.1:2224: read: connection reset by peer
2018/10/16 12:59:10 packer: 2018/10/16 12:59:10 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2224: connect: connection refused
...
2018/10/16 13:03:20 packer: 2018/10/16 13:03:20 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 127.0.0.1:2224: connect: connection refused
==> qemu: Timeout waiting for SSH.
2018/10/16 13:03:22 ui error: ==> qemu: Timeout waiting for SSH.
2018/10/16 13:03:22 packer: 2018/10/16 13:03:22 [DEBUG] SSH wait cancelled. Exiting loop.
==> qemu: Deleting output directory...
Build 'qemu' errored: Timeout waiting for SSH.

==> Some builds didn't complete successfully and had errors:
--> qemu: Timeout waiting for SSH.

==> Builds finished but no artifacts were created.
2018/10/16 13:03:22 [INFO] (telemetry) ending qemu
2018/10/16 13:03:22 ui error: Build 'qemu' errored: Timeout waiting for SSH.
2018/10/16 13:03:22 Builds completed. Waiting on interrupt barrier...
2018/10/16 13:03:22 machine readable: error-count []string{"1"}
2018/10/16 13:03:22 ui error: 
==> Some builds didn't complete successfully and had errors:
2018/10/16 13:03:22 machine readable: qemu,error []string{"Timeout waiting for SSH."}
2018/10/16 13:03:22 ui error: --> qemu: Timeout waiting for SSH.
==> Builds finished but no artifacts were created.
2018/10/16 13:03:22 [INFO] (telemetry) Finalizing.
2018/10/16 13:03:24 waiting for all plugin processes to complete...
2018/10/16 13:03:24 /opt/packer/bin/packer: plugin process exited
cipy commented 5 years ago

and the virtualbox-iso builder does the same:

after the CentOS installs and restarts the VM, the VirtualBox (v5.2) stops too.

virtualbox-iso output will be in this color.

==> virtualbox-iso: Retrieving Guest additions
    virtualbox-iso: Using file in-place: file:///usr/share/virtualbox/VBoxGuestAdditions.iso
==> virtualbox-iso: Retrieving ISO
    virtualbox-iso: Found already downloaded, initial checksum matched, no download needed: http://10.110.10.10/iso/CentOS-7-x86_64-Minimal-1804.iso
==> virtualbox-iso: Starting HTTP server on port 10088
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 2227)
==> virtualbox-iso: Starting the virtual machine...
==> virtualbox-iso: Waiting 5s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Using ssh communicator to connect: 127.0.0.1
==> virtualbox-iso: Waiting for SSH to become available...
==> virtualbox-iso: Timeout waiting for SSH.
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Timeout waiting for SSH.

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso: Timeout waiting for SSH.

==> Builds finished but no artifacts were created.
rickard-von-essen commented 5 years ago

You seems to have skipped this part of the virtualbox-iso docs:

Here is a basic example. This example is not functional. It will start the OS installer but then fail because we don't provide the preseed file for Ubuntu to self-install.

rickard-von-essen commented 5 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.

cipy commented 5 years ago

Hi there,

I adapted your example to CentOS 7, but outcome is the same as for Qemu

On Tue, 16 Oct 2018 at 15.35, Rickard von Essen notifications@github.com wrote:

Closed #6857 https://github.com/hashicorp/packer/issues/6857.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hashicorp/packer/issues/6857#event-1906670603, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFCklV1QUMlQTENnqVwpApZRMrc1E3Hks5uldKDgaJpZM4XeCMk .

rickard-von-essen commented 5 years ago

Just tested the centos-6.10-x86_64 template from bento, and it worked as expected for me, the only change I did was setting accelerator: hvf since I'm on macOS. If you drop a mail to the mailing list you will get help to get started.

cipy commented 5 years ago

Hi there,

If you could quote / paste here the link to this bento template you used, that would be great!

Thanks! :+1:

rickard-von-essen commented 5 years ago

mailing list