hashicorp / packer

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

Packer version: 0.8.6 : Qemu stderr: qemu-kvm: -display: invalid option #3049

Closed shamimgeek closed 8 years ago

shamimgeek commented 8 years ago

Host: RHEL 6.7 packer version : 2016/01/10 01:20:58 [INFO] Packer version: 0.8.6 f8f7b7a34c1be06058f5aca23a51247db12cdbc5+CHANGE qemu binary path : /usr/libexec/qemu-kvm

2016/01/10 01:21:07 packer-builder-qemu: 2016/01/10 01:21:07 Executing /usr/libexec/qemu-kvm: []string{"-device", "virtio-net,netdev=mynet0", "-boot", "once=d", "-name", "packer-qemu", "-vnc", "0.0.0.0:47", "-display", "sdl", "-m", "1024M", "--no-acpi", "-drive", "file=output-qemu/packer-qemu,if=virtio,cache=writeback,discard=ignore", "-cdrom", "/home/shamim/Desktop/DEVOPS/packer-templates/rhel-5.10/RHEL5.10-Server-20130910.0-x86_64-DVD.iso", "-netdev", "user,id=mynet0,hostfwd=hostip:hostport-guestip:guestport", "-machine", "type=pc,accel=kvm"} 2016/01/10 01:21:07 packer-builder-qemu: 2016/01/10 01:21:07 Started Qemu. Pid: 32406 2016/01/10 01:21:07 packer-builder-qemu: 2016/01/10 01:21:07 Qemu stderr: qemu-kvm: -display: invalid option 2016/01/10 01:21:07 ui error: ==> qemu: Error launching VM: Qemu failed to start. Please run with logs to get more info. ==> qemu: Error launching VM: Qemu failed to start. Please run with logs to get more info. 2016/01/10 01:21:07 ui: ==> qemu: Deleting output directory... ==> qemu: Deleting output directory... 2016/01/10 01:21:07 ui error: Build 'qemu' errored: Build was halted. 2016/01/10 01:21:07 Builds completed. Waiting on interrupt barrier..

rickard-von-essen commented 8 years ago

What's your qemu version?

shamimgeek commented 8 years ago

[shamim@rhel-5.10]$ /usr/libexec/qemu-kvm --version QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2-2.479.el6_7.1), Copyright (c) 2003-2008 Fabrice Bellard [shamim@oc4683017473 rhel-5.10]$

rickard-von-essen commented 8 years ago

qemu-system-x86_64 --version

rickard-von-essen commented 8 years ago

Why do you use qemu-kvm?

shamimgeek commented 8 years ago

This is company's laptop and already installed this version of qemu. and i dont see the qemu-system-x86_64 executable in my system.

shamimgeek commented 8 years ago

@rickard-von-essen : Do you think this is a bug or is there any mistake from my side?

rickard-von-essen commented 8 years ago

@vtolstov any insights? Does this work with qemu-kvmv 0.12 ?

vtolstov commented 8 years ago

Try to use packer from master, as i know, some of my pr accepted but does not get to release. packer debug log or log must contain : Qemu version xxx, in this case packer detect qemu version properly and can use needed qemu args. But as i see, this is older packer version.

altvnk commented 8 years ago

I'm seeing something similar on OS X and Qemu 2.5.0 from Homebrew:

2016/01/21 23:37:08 packer-builder-qemu: 2016/01/21 23:37:08 Started Qemu. Pid: 1633
2016/01/21 23:37:08 packer-builder-qemu: 2016/01/21 23:37:08 Qemu stderr: qemu-system-x86_64: -display sdl: SDL support is disabled

In the same time this works just fine and displays console:

qemu-system-x86_64 trusty-server-cloudimg-amd64-disk1.img
cbednarski commented 8 years ago

@altvnk I think that's a different issue. Try:

brew uninstall qemu
brew install qemu --with-sdl
cbednarski commented 8 years ago

@shamimgeek Where you able to try this with packer built from master?

tylert commented 8 years ago

The qemu stuff works perfectly for me on Debian Jessie x86_64 with the "stock" qemu/kvm 2.1.2. However, I never really got qemu stuff working on Mac before so, today, I installed it with brew on Mac OS X El Capitan 10.11.3 using the --with-sdl option as suggested by @cbednarski (this ticket helped me past the "-display sdl" problem; I also have the 2.5.0 version of qemu on OS X).

I'm currently testing with Packer v0.9.0.rc2 (1c61c06ff8a3ead60db2851a6a6114a1fdfed21b) and https://github.com/tylert/packer-build/blob/36d799a546386ac2b1d95d90a6720a6ae7d2503b/debian/jessie/base-jessie64.json

It seems to get hung up on something else for me on Mac OS X (NOTE: As stated previously, this template builds fine with stock qemu on jessie)...

2016/02/18 12:11:20 ui: ==> qemu: Overriding defaults Qemu arguments with QemuArgs...
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
2016/02/18 12:11:20 packer: 2016/02/18 12:11:20 Executing /usr/local/bin/qemu-system-x86_64: []string{"-machine", "type=pc,accel=kvm", "-netdev", "user,id=user.0,hostfwd=tcp::2558-:22", "-device", "virtio-net,netdev=user.0", "-drive", "file=build/2016-02-18-17-11/base-jessie64,if=scsi,cache=writeback,discard=ignore", "-m", "512M", "-cdrom", "/Users/zero/packer_cache/debian-8.3.0-amd64-i386-netinst.iso", "-boot", "once=d", "-name", "base-jessie64", "-smp", "1", "-vnc", "0.0.0.0:71", "-display", "sdl"}
2016/02/18 12:11:20 packer: 2016/02/18 12:11:20 Started Qemu. Pid: 10250
2016/02/18 12:11:20 packer: 2016/02/18 12:11:20 Qemu stderr: "kvm" accelerator not found.
2016/02/18 12:11:20 packer: 2016/02/18 12:11:20 Qemu stderr: No accelerator found!
2016/02/18 12:11:20 ui error: ==> qemu: Error launching VM: Qemu failed to start. Please run with logs to get more info.
==> qemu: Error launching VM: Qemu failed to start. Please run with logs to get more info.
==> qemu: Deleting output directory...
2016/02/18 12:11:20 ui: ==> qemu: Deleting output directory...
2016/02/18 12:11:20 ui error: Build 'qemu' errored: Build was halted.
2016/02/18 12:11:20 Builds completed. Waiting on interrupt barrier...
2016/02/18 12:11:20 machine readable: error-count []string{"1"}
2016/02/18 12:11:20 ui error:
==> Some builds didn't complete successfully and had errors:
2016/02/18 12:11:20 machine readable: qemu,error []string{"Build was halted."}
2016/02/18 12:11:20 ui error: --> qemu: Build was halted.
2016/02/18 12:11:20 ui:
==> Builds finished but no artifacts were created.
2016/02/18 12:11:20 waiting for all plugin processes to complete...
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.
2016/02/18 12:11:21 /Users/zero/bin/packer: plugin process exited
2016/02/18 12:11:21 /Users/zero/bin/packer: plugin process exited
2016/02/18 12:11:21 /Users/zero/bin/packer: plugin process exited
2016/02/18 12:11:21 /Users/zero/bin/packer: plugin process exited
2016/02/18 12:11:21 /Users/zero/bin/packer: plugin process exited
vtolstov commented 8 years ago

please, enable packer debug log and attach it

tylert commented 8 years ago

@vtolstov https://gist.github.com/tylert/3c9a3c941772c7b057d341015676d3bc (<-- Packer 0.10.0 on OSX 10.11.3)

Even after installing with brew uninstall qemu ; brew install qemu --with-sdl (as suggested by @cbednarski), it is still erroring out on OSX. It would seem that Qemu stderr: "kvm" accelerator not found. is the primary reason for the failure on OSX. This issue may no longer be exactly the same as the original issue (the OP was using RHEL).

However, the Packer QEMU builder works perfectly for me on Debian 8.x amd64.

Thanks again.

cbednarski commented 8 years ago

@tylert KVM is a linux kernel feature and is not supported on OS X or Windows. You will need to change accelerator to none on non-Linux systems.

cbednarski commented 8 years ago

Since the original poster has not responded in awhile I'm going to close this. @shamimgeek if you are still having a problem with the latest packer, please feel free to re-open with the debug output requested above. I suspect this is an issue with how QEMU is installed on your computer and not an issue with packer specifically.

Thanks to the rest of you folks for providing feedback and helping out here!

venekamp commented 7 years ago

Run into the same issue on OS X. qemu wasn't installed with SDL support. Doing:

brew uninstall qemu sdl
brew install qemu --with-sdl

Fixed it.

vikas027 commented 6 years ago

As on Feb 2018, it is recommended to use

brew install qemu --with-sdl2
h4ckninja commented 5 years ago

April 2019 and brew install qemu --with-sdl and brew install qemu --with-sdl2 both fail with a brew error: Error: invalid option: --with-sdl

SwampDragons commented 5 years ago

https://github.com/Homebrew/homebrew-core/issues/37340

SwampDragons commented 5 years ago

Looks like homebrew no longer maintains the -with-sdl option.

R3x commented 5 years ago

Is there any alternative for the same?

vtolstov commented 5 years ago

Why not use vnc ?

h4ckninja commented 5 years ago

Annoyingly, VNC isn't working for me. I don't know if it is my setup or there's something I'm missing, but I've tried VNC. It opens the port, I can see it, but it won't connect.

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.