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

[1.2.5][quemu] packer build does not do anything or fails #6537

Closed lmayorga1980 closed 5 years ago

lmayorga1980 commented 6 years ago

PACKER: 1.2.5

The quemu provider does not seem to do anything.

{
    "type": "qemu",
    "output_directory": "packer-centos73-x86_64-quemu",
    "iso_url": "{{user `iso_url_prefix`}}/CentOS-7-x86_64-Minimal-1804.iso",
    "iso_checksum": "fabdc67ff3a1674a489953effa285dfd",
    "iso_checksum_type": "md5",
    "shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
    "format": "qcow2",
    "headless": true,
    "accelerator": "kvm",
    "http_directory": "http",
    "http_port_min": 10082,
    "http_port_max": 10089,
    "ssh_host_port_min": 2222,
    "ssh_host_port_max": 2229,
    "ssh_username": "{{user `ssh_username`}}",
    "ssh_password": "{{user `ssh_pass`}}",
    "ssh_port": 22,
    "ssh_timeout": "30s",
    "vm_name": "centos_7",
    "net_device": "virtio-net",
    "disk_interface": "virtio",
    "boot_wait": "5s",
    "qemuargs": [
      [ "-m", "2048"  ],
      [ "-cpu", "host"  ],
      [ "-smp", "4,sockets=1,cores=2,threads=2" ],
      [ "-chardev", "tty,id=pts,path={{user `serial`}}" ],
      [ "-device", "isa-serial,chardev=pts" ],
      [ "-device", "virtio-net,netdev=user.0" ]
    ],
    "floppy_files": [
      "http/centos/7/ami/ks.cfg"
    ],
    "boot_command": [
    "<tab> inst.text inst.ks=hd:fd0:/ks.cfg net.iframes=0<enter><wait>"
    ]
    },
PACKER_LOG=debug packer build -only=quemu centos73-                                                                                            ami.json
2018/07/25 09:15:20 [INFO] Packer version: 1.2.5
2018/07/25 09:15:20 Packer Target OS/Arch: linux amd64
2018/07/25 09:15:20 Built with Go Version: go1.10.3
2018/07/25 09:15:20 Detected home directory from env var: /home/user
2018/07/25 09:15:20 Using internal plugin for file
2018/07/25 09:15:20 Using internal plugin for triton
2018/07/25 09:15:20 Using internal plugin for vmware-vmx
2018/07/25 09:15:20 Using internal plugin for cloudstack
2018/07/25 09:15:20 Using internal plugin for hyperv-iso
2018/07/25 09:15:20 Using internal plugin for lxd
2018/07/25 09:15:20 Using internal plugin for oracle-classic
2018/07/25 09:15:20 Using internal plugin for profitbricks
2018/07/25 09:15:20 Using internal plugin for googlecompute
2018/07/25 09:15:20 Using internal plugin for oneandone
2018/07/25 09:15:20 Using internal plugin for lxc
2018/07/25 09:15:20 Using internal plugin for vmware-iso
2018/07/25 09:15:20 Using internal plugin for digitalocean
2018/07/25 09:15:20 Using internal plugin for oracle-oci
2018/07/25 09:15:20 Using internal plugin for parallels-iso
2018/07/25 09:15:20 Using internal plugin for parallels-pvm
2018/07/25 09:15:20 Using internal plugin for scaleway
2018/07/25 09:15:20 Using internal plugin for openstack
2018/07/25 09:15:20 Using internal plugin for amazon-chroot
2018/07/25 09:15:20 Using internal plugin for amazon-ebsvolume
2018/07/25 09:15:20 Using internal plugin for azure-arm
2018/07/25 09:15:20 Using internal plugin for docker
2018/07/25 09:15:20 Using internal plugin for null
2018/07/25 09:15:20 Using internal plugin for amazon-ebssurrogate
2018/07/25 09:15:20 Using internal plugin for hyperv-vmcx
2018/07/25 09:15:20 Using internal plugin for qemu
2018/07/25 09:15:20 Using internal plugin for virtualbox-ovf
2018/07/25 09:15:20 Using internal plugin for alicloud-ecs
2018/07/25 09:15:20 Using internal plugin for amazon-ebs
2018/07/25 09:15:20 Using internal plugin for amazon-instance
2018/07/25 09:15:20 Using internal plugin for ncloud
2018/07/25 09:15:20 Using internal plugin for virtualbox-iso
2018/07/25 09:15:20 Using internal plugin for chef-client
2018/07/25 09:15:20 Using internal plugin for puppet-masterless
2018/07/25 09:15:20 Using internal plugin for salt-masterless
2018/07/25 09:15:20 Using internal plugin for ansible
2018/07/25 09:15:20 Using internal plugin for ansible-local
2018/07/25 09:15:20 Using internal plugin for puppet-server
2018/07/25 09:15:20 Using internal plugin for windows-shell
2018/07/25 09:15:20 Using internal plugin for chef-solo
2018/07/25 09:15:20 Using internal plugin for converge
2018/07/25 09:15:20 Using internal plugin for shell
2018/07/25 09:15:20 Using internal plugin for file
2018/07/25 09:15:20 Using internal plugin for powershell
2018/07/25 09:15:20 Using internal plugin for shell-local
2018/07/25 09:15:20 Using internal plugin for windows-restart
2018/07/25 09:15:20 Using internal plugin for compress
2018/07/25 09:15:20 Using internal plugin for docker-import
2018/07/25 09:15:20 Using internal plugin for googlecompute-export
2018/07/25 09:15:20 Using internal plugin for manifest
2018/07/25 09:15:20 Using internal plugin for checksum
2018/07/25 09:15:20 Using internal plugin for googlecompute-import
2018/07/25 09:15:20 Using internal plugin for vagrant-cloud
2018/07/25 09:15:20 Using internal plugin for vsphere-template

2018/07/25 09:15:20 Using internal plugin for alicloud-import
2018/07/25 09:15:20 Using internal plugin for artifice
2018/07/25 09:15:20 Using internal plugin for docker-save
2018/07/25 09:15:20 Using internal plugin for shell-local
2018/07/25 09:15:20 Using internal plugin for vsphere
2018/07/25 09:15:20 Using internal plugin for amazon-import
2018/07/25 09:15:20 Using internal plugin for atlas
2018/07/25 09:15:20 Using internal plugin for docker-push
2018/07/25 09:15:20 Using internal plugin for docker-tag
2018/07/25 09:15:20 Using internal plugin for vagrant
2018/07/25 09:15:20 Detected home directory from env var: /home/user
2018/07/25 09:15:20 Attempting to open config file: /home/user/.pac                                                                                            kerconfig
2018/07/25 09:15:20 [WARN] Config file doesn't exist: /home/user/.p                                                                                            ackerconfig
2018/07/25 09:15:20 Packer config: &{DisableCheckpoint:false DisableCheckpointSi                                                                                            gnature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[lxd:/usr/loca                                                                                            l/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd amazon-chroot:/us                                                                                            r/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot d                                                                                            ocker:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker                                                                                             amazon-instance:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-bui                                                                                            lder-amazon-instance openstack:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSP                                                                                            ACE-packer-builder-openstack azure-arm:/usr/local/bin/packer-PACKERSPACE-plugin-                                                                                            PACKERSPACE-packer-builder-azure-arm qemu:/usr/local/bin/packer-PACKERSPACE-plug                                                                                            in-PACKERSPACE-packer-builder-qemu hyperv-iso:/usr/local/bin/packer-PACKERSPACE-                                                                                            plugin-PACKERSPACE-packer-builder-hyperv-iso profitbricks:/usr/local/bin/packer-                                                                                            PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks googlecompute:/usr/lo                                                                                            cal/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute lxc:/                                                                                            usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxc hyperv-vm                                                                                            cx:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-vm                                                                                            cx vmware-vmx:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builde                                                                                            r-vmware-vmx parallels-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-                                                                                            packer-builder-parallels-iso amazon-ebsvolume:/usr/local/bin/packer-PACKERSPACE-                                                                                            plugin-PACKERSPACE-packer-builder-amazon-ebsvolume cloudstack:/usr/local/bin/pac                                                                                            ker-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack oneandone:/usr/loca                                                                                            l/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone vmware-iso:                                                                                            /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso a                                                                                            mazon-ebs:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-am                                                                                            azon-ebs parallels-pvm:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-pack                                                                                            er-builder-parallels-pvm virtualbox-ovf:/usr/local/bin/packer-PACKERSPACE-plugin                                                                                            -PACKERSPACE-packer-builder-virtualbox-ovf alicloud-ecs:/usr/local/bin/packer-PA                                                                                            CKERSPACE-plugin-PACKERSPACE-packer-builder-alicloud-ecs virtualbox-iso:/usr/loc                                                                                            al/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso nclou                                                                                            d:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-ncloud fil                                                                                            e:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file trito                                                                                            n:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton dig                                                                                            italocean:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-di                                                                                            gitalocean scaleway:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-                                                                                            builder-scaleway oracle-classic:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERS                                                                                            PACE-packer-builder-oracle-classic oracle-oci:/usr/local/bin/packer-PACKERSPACE-                                                                                            plugin-PACKERSPACE-packer-builder-oracle-oci null:/usr/local/bin/packer-PACKERSP                                                                                            ACE-plugin-PACKERSPACE-packer-builder-null amazon-ebssurrogate:/usr/local/bin/pa                                                                                            cker-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate] PostProc                                                                                            essors:map[googlecompute-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERS                                                                                            PACE-packer-post-processor-googlecompute-import vsphere-template:/usr/local/bin/                                                                                            packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere-template doc                                                                                            ker-save:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-proces                                                                                            sor-docker-save vagrant:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-pac                                                                                            ker-post-processor-vagrant googlecompute-export:/usr/local/bin/packer-PACKERSPAC                                                                                            E-plugin-PACKERSPACE-packer-post-processor-googlecompute-export docker-import:/u                                                                                            sr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-                                                                                            import alicloud-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-pack                                                                                            er-post-processor-alicloud-import artifice:/usr/local/bin/packer-PACKERSPACE-plu                                                                                            gin-PACKERSPACE-packer-post-processor-artifice vsphere:/usr/local/bin/packer-PAC                                                                                            KERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere compress:/usr/local/bi                                                                                            n/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress vagrant-c                                                                                            loud:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-                                                                                            vagrant-cloud docker-push:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-p                                                                                            acker-post-processor-docker-push checksum:/usr/local/bin/packer-PACKERSPACE-plug                                                                                            in-PACKERSPACE-packer-post-processor-checksum shell-local:/usr/local/bin/packer-                                                                                            PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local amazon-import:/                                                                                            usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon                                                                                            -import atlas:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-p                                                                                            rocessor-atlas docker-tag:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-p                                                                                            acker-post-processor-docker-tag manifest:/usr/local/bin/packer-PACKERSPACE-plugi                                                                                            n-PACKERSPACE-packer-post-processor-manifest] Provisioners:map[chef-client:/usr/                                                                                            local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client s                                                                                            alt-masterless:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provi                                                                                            sioner-salt-masterless powershell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKE                                                                                            RSPACE-packer-provisioner-powershell shell-local:/usr/local/bin/packer-PACKERSPA                                                                                            CE-plugin-PACKERSPACE-packer-provisioner-shell-local puppet-masterless:/usr/loca                                                                                            l/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless                                                                                             converge:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisione                                                                                            r-converge shell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-pro                                                                                            visioner-shell file:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-                                                                                            provisioner-file ansible-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSP                                                                                            ACE-packer-provisioner-ansible-local windows-shell:/usr/local/bin/packer-PACKERS                                                                                            PACE-plugin-PACKERSPACE-packer-provisioner-windows-shell ansible:/usr/local/bin/                                                                                            packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible puppet-server:/                                                                                            usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-se                                                                                            rver chef-solo:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provi                                                                                            sioner-chef-solo windows-restart:/usr/local/bin/packer-PACKERSPACE-plugin-PACKER                                                                                            SPACE-packer-provisioner-windows-restart]}
2018/07/25 09:15:20 Detected home directory from env var: /home/user
2018/07/25 09:15:20 Setting cache directory: /home/user/repositories                                                                                            s/packer-templates-2.0/packer_cache
2018/07/25 09:15:20 Detected home directory from env var: /home/user
2018/07/25 09:15:20 Build debug mode: false
2018/07/25 09:15:20 Force build: false
2018/07/25 09:15:20 On error:
2018/07/25 09:15:20 Waiting on builds to complete...
2018/07/25 09:15:20 Builds completed. Waiting on interrupt barrier...
2018/07/25 09:15:20 ui:
==> Builds finished but no artifacts were created.
2018/07/25 09:15:20 [INFO] (telemetry) Finalizing.
==> Builds finished but no artifacts were created.
2018/07/25 09:15:20 waiting for all plugin processes to complete..
mwhooker commented 6 years ago

hmm, not able to reproduce with jakobadam/packer-qemu-templates on osx.

lmayorga1980 commented 6 years ago

Installed the suggested packages by Red Hat https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_host_configuration_and_guest_installation_guide/sect-virtualization_host_configuration_and_guest_installation_guide-host_installation-installing_kvm_packages_on_an_existing_red_hat_enterprise_linux_system

I wonder if there is another dependency missing before running the build.

https://www.packer.io/docs/builders/qemu.html Coulnd't see a list of packages required.

mwhooker commented 6 years ago

hmm, it should just depend on qemu and nothing else

mwhooker commented 6 years ago

I'll keep seeing if I can reproduce, but it would be extremely helpful if you could bisect packer and find the change that introduced the failure

mwhooker commented 6 years ago

Also, can you try to build the centos template in https://github.com/jakobadam/packer-qemu-templates ?

lmayorga1980 commented 6 years ago

Very interesting that I got this error.

Build 'centos-6.7-x86_64-server-vagrant' errored: Failed creating Qemu driver: exec: "qemu-system-x86_64": executable file not found in $PATH

lmayorga1980 commented 6 years ago

Issues with the PATH https://github.com/hashicorp/packer/issues/659

lmayorga1980 commented 6 years ago

Might be that RHEL keeps an old version?

 virsh version --daemon
Compiled against library: libvirt 3.9.0
Using library: libvirt 3.9.0
Using API: QEMU 3.9.0
Running hypervisor: QEMU 1.5.3
Running against daemon: 3.9.0
mwhooker commented 6 years ago

Interesting. Unfortunately I don't have any other theories. Let us know if you get it working!

SwampDragons commented 5 years ago

Closing this due to inactivity. I hope you ended up finding a way to get it working.

alexsaezm commented 5 years ago

For the record: The problem, at least for me, is that packer is looking for qemu-system-x86_64, which does not exist in RHEL. You need to use /usr/libexec/qemu-kvm.

You can do two things to solve this:

  1. Add /usr/libexec to your path and create a symlink named qemu-system-x86_64
  2. Use qemu_binary like the code/documentation says: https://github.com/hashicorp/packer/blob/d9156188199528fb54d47e8aa39af30e1520322a/builder/qemu/builder.go#L279-L283

It looks like there used to be more issues with this because in the issue you are linking, they try both options without success. Currently, it is working for me.

Cheers!

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.