Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qemu builder in 0.8.1 fails to create disk image #2449

Closed
tylert opened this issue Jul 14, 2015 · 13 comments
Closed

Qemu builder in 0.8.1 fails to create disk image #2449

tylert opened this issue Jul 14, 2015 · 13 comments

Comments

@tylert
Copy link
Contributor

tylert commented Jul 14, 2015

With the template found at...
https://github.com/tylert/packer-build/blob/a81f4a22331f968b33c85eb8b3667a6034fdafa7/debian/jessie/base-64.json
... the qemu builder fails with the following output:

packer-build$ CHECKPOINT_DISABLE=1 PACKER_LOG=1 PACKER_LOG_PATH=./qemu.log packer build -only=qemu debian/jessie/base-64.json 
qemu output will be in this color.

==> qemu: Downloading or copying ISO
    qemu: Downloading or copying: http://cdimage.debian.org/cdimage/release/8.1.0/multi-arch/iso-cd/debian-8.1.0-amd64-i386-netinst.iso
==> qemu: Creating hard drive...
==> qemu: Starting HTTP server on port 8081
==> qemu: Found port for SSH: 6887.
==> qemu: Looking for available port between 5900 and 6000
==> qemu: Found available VNC port: 5947
==> qemu: Starting VM, booting from CD-ROM
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Error launching VM: Qemu failed to start. Please run with logs to get more info.
==> qemu: Deleting output directory...
Build 'qemu' errored: Build was halted.

==> Some builds didn't complete successfully and had errors:
--> qemu: Build was halted.

==> Builds finished but no artifacts were created.

The pertinent lines would appear to be:

2015/07/14 17:42:34 packer-builder-qemu: 2015/07/14 17:42:34 Executing /usr/bin/qemu-system-x86_64: []string{"-display", "sdl", "-hda", "build/2015-07-14-21-42/base-jessie-64.raw", "-boot", "once=d", "-cdrom", "/home/horrible/packer-build/packer_cache/e42f8a2b9a6c7d0a1d06f8e097721676ef69c9919404745d51c228e59e9e8183.iso", "-vnc", "0.0.0.0:47", "-machine", "type=pc,accel=kvm", "-name", "base-jessie-64", "-drive", "file=build/2015-07-14-21-42/base-jessie-64,if=virtio,cache=writethrough,discard=ignore", "-m", "512M", "-smp", "1", "-netdev", "user,id=user.0,hostfwd=tcp::6887-:22", "-device", "virtio-net,netdev=user.0"}
2015/07/14 17:42:34 packer-builder-qemu: 2015/07/14 17:42:34 Started Qemu. Pid: 31203
2015/07/14 17:42:34 packer-builder-qemu: 2015/07/14 17:42:34 Qemu stderr: qemu-system-x86_64: -hda build/2015-07-14-21-42/base-jessie-64.raw: could not open disk image build/2015-07-14-21-42/base-jessie-64.raw: Could not open 'build/2015-07-14-21-42/base-jessie-64.raw': No such file or directory

Full capture of failure output:
https://gist.github.com/tylert/16bbbc74c28dda5abc21

The template linked above works fine with Packer 0.7.5 (on Debian 8.1.0 amd64) if you strip out the "communicator", "ssh_pty" and "ssh_timeout" lines. I can't test it with Packer 0.8.0 since that one crashes (#2311).

Please let me know if you would like me to attempt to provide a more minimal template that reproduces the problem.

@tylert
Copy link
Contributor Author

tylert commented Jul 14, 2015

Actually, err... I forgot that I can probably lop off the compress post-processor lines and try it with 0.8.0.

@cbednarski
Copy link
Contributor

@tylert The post-processor crash should be fixed in 0.8.1.

@tylert
Copy link
Contributor Author

tylert commented Jul 14, 2015

The post-processor compress crash is most definitely fixed in 0.8.1, however, I encountered a different failure in 0.8.1. Hence this ticket.

@tylert
Copy link
Contributor Author

tylert commented Jul 14, 2015

Confirmed. The same failure occurs in 0.8.0 with the template linked above after you remove the compress post-processor. In 0.8.1, the template may be used as-is to reproduce the failure.

@cbednarski
Copy link
Contributor

@tylert Thanks for the repro and thorough testing!

@tylert
Copy link
Contributor Author

tylert commented Jul 14, 2015

Please let me know if you require me to try anything else. Also, thanks for the great tool and prompt feedback.

@vtolstov
Copy link
Contributor

You have error in you template, latest packer does not contains disk format in file name, so change you template and remove from qemuargs hda .raw portion.

@vtolstov
Copy link
Contributor

Or best - remove hda completely

@tylert
Copy link
Contributor Author

tylert commented Jul 16, 2015

@vtolstov Thank you for pointing out the problem in my template (running test now).

Was this something that should have been flagged as an error by "packer validate" or "packer fix"?

@vtolstov
Copy link
Contributor

This is custom variable and can't checked automatic. Simply not specify by
hands that can be easy bring up by packer automatic.
16 июля 2015 г. 15:42 пользователь "Tyler Tidman" notifications@github.com
написал:

@vtolstov https://github.com/vtolstov Thank you for pointing out the
problem in my template (running test now).

Was this something that should have been flagged as an error by "packer
validate" or "packer fix"?


Reply to this email directly or view it on GitHub
#2449 (comment).

@tylert
Copy link
Contributor Author

tylert commented Jul 16, 2015

@vtolstov спасибо. понимать.

Is this the diff that you are suggesting?...

diff --git a/debian/jessie/base-64.json b/debian/jessie/base-64.json
index 7756822..32f6b87 100644
--- a/debian/jessie/base-64.json
+++ b/debian/jessie/base-64.json
@@ -100,10 +100,6 @@
         [
           "-smp",
           "1"
-        ],
-        [
-          "-hda",
-          "{{user `output_directory`}}/{{user `vm_name`}}.raw"
         ]
       ],
       "shutdown_command": "echo '{{user `sudo_password`}}' | sudo -E -S poweroff",

I normally do all my qemu Packer work on Linux and I don't have such a machine handy right now. I tried, for the first time, a "brew install qemu" on my Mac (10.10.4) to do a quick test of the changes you suggested but it seems to fail complaining about SDL support being disabled. Oh well.

I shall have to attempt this test again (sometime within the next 96 hours) when I'm near my Linux machine again.

@vtolstov
Copy link
Contributor

@tylert yes, this is looks good.

@tylert
Copy link
Contributor Author

tylert commented Jul 17, 2015

Confirmed. The fixes recommended by @vtolstov corrected the problem. Closing.

@tylert tylert closed this as completed Jul 17, 2015
@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants