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

Packer 1.6.3+ breaks qemu builder #10135

Closed
ltrager opened this issue Oct 21, 2020 · 5 comments · Fixed by #10145
Closed

Packer 1.6.3+ breaks qemu builder #10135

ltrager opened this issue Oct 21, 2020 · 5 comments · Fixed by #10145

Comments

@ltrager
Copy link
Contributor

ltrager commented Oct 21, 2020

Overview of the Issue

Since Packer 1.6.3 all qemu builds are failing. It appears output-qemu/packer-qemu is never created which causes qemu to never run the ISO. Packer for some reason doesn't detect this as an error and continues to execute post-processors.

$ sudo PACKER_LOG=1 /tmp/packer build centos8.json
[sudo] password for lee: 
2020/10/20 17:00:07 [INFO] Packer version: 1.6.4 [go1.15.2 linux amd64]
2020/10/20 17:00:07 Checking 'PACKER_CONFIG' for a config file path
2020/10/20 17:00:07 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 17:00:07 Attempting to open config file: /root/.packerconfig
2020/10/20 17:00:07 [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 17:00:07 Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 17:00:07 Creating plugin client for path: /tmp/packer
2020/10/20 17:00:07 Starting plugin: /tmp/packer []string{"/tmp/packer", "plugin", "packer-builder-qemu"}
2020/10/20 17:00:07 Waiting for RPC address for: /tmp/packer
2020/10/20 17:00:07 packer-builder-qemu plugin: [INFO] Packer version: 1.6.4 [go1.15.2 linux amd64]
2020/10/20 17:00:07 packer-builder-qemu plugin: Checking 'PACKER_CONFIG' for a config file path
2020/10/20 17:00:07 packer-builder-qemu plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 17:00:07 packer-builder-qemu plugin: Attempting to open config file: /root/.packerconfig
2020/10/20 17:00:07 packer-builder-qemu plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 17:00:07 packer-builder-qemu plugin: Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 17:00:07 packer-builder-qemu plugin: args: []string{"packer-builder-qemu"}
2020/10/20 17:00:07 packer-builder-qemu plugin: Plugin address: unix /tmp/packer-plugin815104987
2020/10/20 17:00:07 packer-builder-qemu plugin: Waiting for connection...
2020/10/20 17:00:07 Received unix RPC address for /tmp/packer: addr is /tmp/packer-plugin815104987
2020/10/20 17:00:07 packer-builder-qemu plugin: Serving a plugin connection...
2020/10/20 17:00:07 Creating plugin client for path: /tmp/packer
2020/10/20 17:00:07 Starting plugin: /tmp/packer []string{"/tmp/packer", "plugin", "packer-post-processor-shell-local"}
2020/10/20 17:00:07 Waiting for RPC address for: /tmp/packer
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: [INFO] Packer version: 1.6.4 [go1.15.2 linux amd64]
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Checking 'PACKER_CONFIG' for a config file path
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Attempting to open config file: /root/.packerconfig
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: args: []string{"packer-post-processor-shell-local"}
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Plugin address: unix /tmp/packer-plugin934643591
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Waiting for connection...
2020/10/20 17:00:07 Received unix RPC address for /tmp/packer: addr is /tmp/packer-plugin934643591
2020/10/20 17:00:07 packer-post-processor-shell-local plugin: Serving a plugin connection...
2020/10/20 17:00:07 Preparing build: qemu
2020/10/20 17:00:07 packer-builder-qemu plugin: use detected accelerator: kvm
2020/10/20 17:00:07 packer-builder-qemu plugin: CpuCount 0 too small, using default: 1
2020/10/20 17:00:08 Build debug mode: false
2020/10/20 17:00:08 Force build: false
2020/10/20 17:00:08 On error: 
2020/10/20 17:00:08 Waiting on builds to complete...
qemu: output will be in this color.
2020/10/20 17:00:08 Starting build run: qemu

2020/10/20 17:00:08 Running builder: qemu
2020/10/20 17:00:08 [INFO] (telemetry) Starting builder qemu
2020/10/20 17:00:08 packer-builder-qemu plugin: Qemu path: /usr/bin/qemu-system-x86_64, Qemu Image page: /usr/bin/qemu-img
==> qemu: Retrieving ISO
==> qemu: Trying https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso
2020/10/20 17:00:08 packer-builder-qemu plugin: Acquiring lock for: https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c (/home/lee/packer-maas/centos8/packer_cache/8d71e8377b300414b6e2ac9d20cf8724f37070f7.iso.lock)
==> qemu: Trying https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c
2020/10/20 17:00:09 packer-builder-qemu plugin: Leaving retrieve loop for ISO
2020/10/20 17:00:09 packer-builder-qemu plugin: No floppy files specified. Floppy disk will not be made.
2020/10/20 17:00:09 packer-builder-qemu plugin: No CD files specified. CD disk will not be made.
2020/10/20 17:00:09 packer-builder-qemu plugin: [INFO] Creating disk with Path: output-qemu/packer-qemu and Size: 4G
==> qemu: https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c => /home/lee/packer-maas/centos8/packer_cache/8d71e8377b300414b6e2ac9d20cf8724f37070f7.iso
2020/10/20 17:00:09 packer-builder-qemu plugin: Executing qemu-img: []string{"create", "-f", "qcow2", "output-qemu/packer-qemu", "4G"}
==> qemu: Creating required virtual machine disks
2020/10/20 17:00:09 packer-builder-qemu plugin: stdout: Formatting 'output-qemu/packer-qemu', fmt=qcow2 size=4294967296 cluster_size=65536 lazy_refcounts=off refcount_bits=16
2020/10/20 17:00:09 packer-builder-qemu plugin: stderr:
2020/10/20 17:00:09 packer-builder-qemu plugin: Found available port: 8900 on IP: 0.0.0.0
==> qemu: Starting HTTP server on port 8900
    qemu: No communicator is set; skipping port forwarding setup.
2020/10/20 17:00:09 packer-builder-qemu plugin: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
2020/10/20 17:00:09 packer-builder-qemu plugin: Found available port: 5966 on IP: 127.0.0.1
2020/10/20 17:00:09 packer-builder-qemu plugin: Found available VNC port: 5966 on IP: 127.0.0.1
==> qemu: Starting VM, booting from CD-ROM
2020/10/20 17:00:09 packer-builder-qemu plugin: Qemu --version output: QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.7)
2020/10/20 17:00:09 packer-builder-qemu plugin: Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
2020/10/20 17:00:09 packer-builder-qemu plugin: Qemu version: 4.2.1
    qemu: view the screen of the VM, connect via VNC without a password to
    qemu: vnc://127.0.0.1:5966
2020/10/20 17:00:09 packer-builder-qemu plugin: Qemu Builder has no floppy files, not attaching a floppy.
    qemu: The VM will be run headless, without a GUI. If you want to
    qemu: view the screen of the VM, connect via VNC without a password to
    qemu: vnc://127.0.0.1:5966
2020/10/20 17:00:09 packer-builder-qemu plugin: Executing /usr/bin/qemu-system-x86_64: []string{"-boot", "once=d", "-serial", "stdio", "-m", "2048M", "-vnc", "127.0.0.1:66", "-machine", "type=pc,accel=kvm", "-device", "virtio-net,netdev=user.0", "-name", "packer-qemu", "-netdev", "user,id=user.0", "-drive", "file=output-qemu/packer-qemu,if=virtio,cache=writeback,discard=ignore,format=qcow2", "-drive", "file=/home/lee/packer-maas/centos8/packer_cache/8d71e8377b300414b6e2ac9d20cf8724f37070f7.iso,index=0,media=cdrom"}
==> qemu: Overriding default Qemu arguments with QemuArgs...
2020/10/20 17:00:09 packer-builder-qemu plugin: Started Qemu. Pid: 1748010
2020/10/20 17:00:09 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
==> qemu: Waiting 3s for boot...
==> qemu: Connecting to VM via VNC (127.0.0.1:5966)
2020/10/20 17:00:14 packer-builder-qemu plugin: Connected to VNC desktop: QEMU (packer-qemu)
==> qemu: Typing the boot command over VNC...
2020/10/20 17:00:14 packer-builder-qemu plugin: Special code '<up>' found, replacing with: 0xFF52
2020/10/20 17:00:14 packer-builder-qemu plugin: Special code '<tab>' found, replacing with: 0xFF09
2020/10/20 17:00:15 packer-builder-qemu plugin: Sending char ' ', code 0x20, shift false
2020/10/20 17:00:15 packer-builder-qemu plugin: Sending char 'i', code 0x69, shift false
2020/10/20 17:00:15 packer-builder-qemu plugin: Sending char 'n', code 0x6E, shift false
2020/10/20 17:00:15 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:16 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:16 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:16 packer-builder-qemu plugin: Sending char 'k', code 0x6B, shift false
2020/10/20 17:00:16 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:16 packer-builder-qemu plugin: Sending char '=', code 0x3D, shift false
2020/10/20 17:00:17 packer-builder-qemu plugin: Sending char 'h', code 0x68, shift false
2020/10/20 17:00:17 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:17 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:17 packer-builder-qemu plugin: Sending char 'p', code 0x70, shift false
2020/10/20 17:00:17 packer-builder-qemu plugin: Sending char ':', code 0x3A, shift true
2020/10/20 17:00:18 packer-builder-qemu plugin: Sending char '/', code 0x2F, shift false
2020/10/20 17:00:18 packer-builder-qemu plugin: Sending char '/', code 0x2F, shift false
2020/10/20 17:00:18 packer-builder-qemu plugin: Sending char '1', code 0x31, shift false
2020/10/20 17:00:18 packer-builder-qemu plugin: Sending char '0', code 0x30, shift false
2020/10/20 17:00:19 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:19 packer-builder-qemu plugin: Sending char '0', code 0x30, shift false
2020/10/20 17:00:19 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:19 packer-builder-qemu plugin: Sending char '2', code 0x32, shift false
2020/10/20 17:00:19 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:20 packer-builder-qemu plugin: Sending char '2', code 0x32, shift false
2020/10/20 17:00:20 packer-builder-qemu plugin: Sending char ':', code 0x3A, shift true
2020/10/20 17:00:20 packer-builder-qemu plugin: Sending char '8', code 0x38, shift false
2020/10/20 17:00:20 packer-builder-qemu plugin: Sending char '9', code 0x39, shift false
2020/10/20 17:00:21 packer-builder-qemu plugin: Sending char '0', code 0x30, shift false
2020/10/20 17:00:21 packer-builder-qemu plugin: Sending char '0', code 0x30, shift false
2020/10/20 17:00:21 packer-builder-qemu plugin: Sending char '/', code 0x2F, shift false
2020/10/20 17:00:21 packer-builder-qemu plugin: Sending char 'c', code 0x63, shift false
2020/10/20 17:00:21 packer-builder-qemu plugin: Sending char 'e', code 0x65, shift false
2020/10/20 17:00:22 packer-builder-qemu plugin: Sending char 'n', code 0x6E, shift false
2020/10/20 17:00:22 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:22 packer-builder-qemu plugin: Sending char 'o', code 0x6F, shift false
2020/10/20 17:00:22 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:22 packer-builder-qemu plugin: Sending char '8', code 0x38, shift false
2020/10/20 17:00:23 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:23 packer-builder-qemu plugin: Sending char 'k', code 0x6B, shift false
2020/10/20 17:00:23 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:23 packer-builder-qemu plugin: Sending char ' ', code 0x20, shift false
2020/10/20 17:00:23 packer-builder-qemu plugin: Sending char 'c', code 0x63, shift false
2020/10/20 17:00:24 packer-builder-qemu plugin: Sending char 'o', code 0x6F, shift false
2020/10/20 17:00:24 packer-builder-qemu plugin: Sending char 'n', code 0x6E, shift false
2020/10/20 17:00:24 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:24 packer-builder-qemu plugin: Sending char 'o', code 0x6F, shift false
2020/10/20 17:00:24 packer-builder-qemu plugin: Sending char 'l', code 0x6C, shift false
2020/10/20 17:00:25 packer-builder-qemu plugin: Sending char 'e', code 0x65, shift false
2020/10/20 17:00:25 packer-builder-qemu plugin: Sending char '=', code 0x3D, shift false
2020/10/20 17:00:25 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:25 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:25 packer-builder-qemu plugin: Sending char 'y', code 0x79, shift false
2020/10/20 17:00:26 packer-builder-qemu plugin: Sending char 'S', code 0x53, shift true
2020/10/20 17:00:26 packer-builder-qemu plugin: Sending char '0', code 0x30, shift false
2020/10/20 17:00:26 packer-builder-qemu plugin: Sending char ' ', code 0x20, shift false
2020/10/20 17:00:26 packer-builder-qemu plugin: Sending char 'i', code 0x69, shift false
2020/10/20 17:00:27 packer-builder-qemu plugin: Sending char 'n', code 0x6E, shift false
2020/10/20 17:00:27 packer-builder-qemu plugin: Sending char 's', code 0x73, shift false
2020/10/20 17:00:27 packer-builder-qemu plugin: Sending char 't', code 0x74, shift false
2020/10/20 17:00:27 packer-builder-qemu plugin: Sending char '.', code 0x2E, shift false
2020/10/20 17:00:27 packer-builder-qemu plugin: Sending char 'c', code 0x63, shift false
2020/10/20 17:00:28 packer-builder-qemu plugin: Sending char 'm', code 0x6D, shift false
2020/10/20 17:00:28 packer-builder-qemu plugin: Sending char 'd', code 0x64, shift false
2020/10/20 17:00:28 packer-builder-qemu plugin: Sending char 'l', code 0x6C, shift false
2020/10/20 17:00:28 packer-builder-qemu plugin: Sending char 'i', code 0x69, shift false
2020/10/20 17:00:28 packer-builder-qemu plugin: Sending char 'n', code 0x6E, shift false
2020/10/20 17:00:29 packer-builder-qemu plugin: Sending char 'e', code 0x65, shift false
2020/10/20 17:00:29 packer-builder-qemu plugin: Special code '<enter>' found, replacing with: 0xFF0D
    qemu: No communicator is configured -- skipping StepWaitGuestAddress
2020/10/20 17:00:29 packer-builder-qemu plugin: [INFO] communicator disabled, will not connect
2020/10/20 17:00:29 packer-builder-qemu plugin: Unable to load communicator config from state to populate provisionHookData
2020/10/20 17:00:29 packer-builder-qemu plugin: Running the provision hook
==> qemu: Halting the virtual machine...
2020/10/20 17:00:29 packer-builder-qemu plugin: VM shut down.
==> qemu: Converting hard drive...
2020/10/20 17:00:29 packer-builder-qemu plugin: Executing qemu-img: []string{"convert", "-O", "qcow2", "output-qemu/packer-qemu", "output-qemu/packer-qemu.convert"}
2020/10/20 17:00:29 packer-builder-qemu plugin: stdout:
2020/10/20 17:00:29 packer-builder-qemu plugin: stderr: qemu-img: Could not open 'output-qemu/packer-qemu': Failed to get shared "write" lock
2020/10/20 17:00:29 packer-builder-qemu plugin: Is another process using the image [output-qemu/packer-qemu]?
==> qemu: Error getting file lock for conversion; retrying...
2020/10/20 17:00:29 packer-builder-qemu plugin: Retryable error: QemuImg error: qemu-img: Could not open 'output-qemu/packer-qemu': Failed to get shared "write" lock
2020/10/20 17:00:29 packer-builder-qemu plugin: Is another process using the image [output-qemu/packer-qemu]?
2020/10/20 17:00:30 packer-builder-qemu plugin: Executing qemu-img: []string{"convert", "-O", "qcow2", "output-qemu/packer-qemu", "output-qemu/packer-qemu.convert"}
2020/10/20 17:00:30 packer-builder-qemu plugin: stdout:
2020/10/20 17:00:30 packer-builder-qemu plugin: stderr:
2020/10/20 17:00:30 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5966: use of closed network connection
2020/10/20 17:00:30 [INFO] (telemetry) ending qemu
2020/10/20 17:00:30 [INFO] (telemetry) Starting post-processor shell-local
==> qemu: Running post-processor: shell-local
2020/10/20 17:00:30 packer-post-processor-shell-local plugin: [INFO] (shell-local): Prepending inline script with #!/bin/bash -e
2020/10/20 17:00:30 packer-post-processor-shell-local plugin: [INFO] (shell-local): starting local command: /bin/sh -c PACKER_BUILDER_TYPE='qemu' PACKER_BUILD_NAME='qemu' PACKER_HTTP_ADDR='10.0.2.2:8900' PACKER_HTTP_IP='10.0.2.2' PACKER_HTTP_PORT='8900'  /tmp/packer-shell906889018
==> qemu (shell-local): Running local shell script: /tmp/packer-shell906889018
2020/10/20 17:00:30 packer-post-processor-shell-local plugin: [INFO] (shell-local communicator): Executing local shell command [/bin/sh -c PACKER_BUILDER_TYPE='qemu' PACKER_BUILD_NAME='qemu' PACKER_HTTP_ADDR='10.0.2.2:8900' PACKER_HTTP_IP='10.0.2.2' PACKER_HTTP_PORT='8900'  /tmp/packer-shell906889018]
    qemu (shell-local): Loading nbd...
    qemu (shell-local): Using /dev/nbd10
    qemu (shell-local): Binding image to /dev/nbd10...
    qemu (shell-local): /dev/nbd10 disconnected
    qemu (shell-local): Waiting for partitions to be created...
2020/10/20 17:01:02 packer-builder-qemu plugin: Received interrupt signal (count: 1). Ignoring.
Cancelling build after receiving interrupt
2020/10/20 17:01:02 Cancelling post-processor after context cancellation context canceled
2020/10/20 17:01:02 packer-post-processor-shell-local plugin: Received interrupt signal (count: 1). Ignoring.
2020/10/20 17:01:02 [INFO] (telemetry) ending shell-local
2020/10/20 17:01:02 Deleting original artifact for build 'qemu'

* Post-processor failed: Error executing script: /tmp/packer-shell906889018

Please see output above for more information.
==> Wait completed after 54 seconds 349 milliseconds
2020/10/20 17:01:02 [INFO] (telemetry) Finalizing.
Build 'qemu' errored after 54 seconds 349 milliseconds: 1 error(s) occurred:

* Post-processor failed: Error executing script: /tmp/packer-shell906889018

Please see output above for more information.

==> Wait completed after 54 seconds 349 milliseconds
Cleanly cancelled builds after being interrupted.
2020/10/20 17:01:03 waiting for all plugin processes to complete...
2020/10/20 17:01:03 /tmp/packer: plugin process exited
2020/10/20 17:01:03 /tmp/packer: plugin process exited
$ ls -alh
total 36K
drwxr-xr-x  4 lee  lee  4.0K Oct 20 17:01 .
drwxr-xr-x 10 lee  lee  4.0K Oct 16 15:15 ..
-rw-rw-r--  1 lee  lee  1.3K Oct 20 13:52 centos8.json
-rw-r--r--  1 root root  12K Oct 20 14:18 crash.log
drwxr-xr-x  2 lee  lee  4.0K Oct 16 15:07 http
drwxr-xr-x  3 root root 4.0K Oct 20 14:25 packer_cache
-rw-r--r--  1 lee  lee  2.1K Sep 10 19:20 README.md
$ cat crash.log 
2020/10/20 14:17:26 [INFO] Packer version: 1.6.5-dev (6d4fae0f2) [go1.15.3 linux amd64]
2020/10/20 14:17:26 Checking 'PACKER_CONFIG' for a config file path
2020/10/20 14:17:26 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 14:17:26 Attempting to open config file: /root/.packerconfig
2020/10/20 14:17:26 [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 14:17:26 Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 14:17:26 Creating plugin client for path: /home/lee/go/bin/packer
2020/10/20 14:17:26 Starting plugin: /home/lee/go/bin/packer []string{"/home/lee/go/bin/packer", "plugin", "packer-builder-qemu"}
2020/10/20 14:17:26 Waiting for RPC address for: /home/lee/go/bin/packer
2020/10/20 14:17:26 packer-builder-qemu plugin: [INFO] Packer version: 1.6.5-dev (6d4fae0f2) [go1.15.3 linux amd64]
2020/10/20 14:17:26 packer-builder-qemu plugin: Checking 'PACKER_CONFIG' for a config file path
2020/10/20 14:17:26 packer-builder-qemu plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 14:17:26 packer-builder-qemu plugin: Attempting to open config file: /root/.packerconfig
2020/10/20 14:17:26 packer-builder-qemu plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 14:17:26 packer-builder-qemu plugin: Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 14:17:26 packer-builder-qemu plugin: args: []string{"packer-builder-qemu"}
2020/10/20 14:17:26 packer-builder-qemu plugin: Plugin address: unix /tmp/packer-plugin636714851
2020/10/20 14:17:26 packer-builder-qemu plugin: Waiting for connection...
2020/10/20 14:17:26 Received unix RPC address for /home/lee/go/bin/packer: addr is /tmp/packer-plugin636714851
2020/10/20 14:17:26 packer-builder-qemu plugin: Serving a plugin connection...
2020/10/20 14:17:26 Creating plugin client for path: /home/lee/go/bin/packer
2020/10/20 14:17:26 Starting plugin: /home/lee/go/bin/packer []string{"/home/lee/go/bin/packer", "plugin", "packer-post-processor-shell-local"}
2020/10/20 14:17:26 Waiting for RPC address for: /home/lee/go/bin/packer
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: [INFO] Packer version: 1.6.5-dev (6d4fae0f2) [go1.15.3 linux amd64]
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Checking 'PACKER_CONFIG' for a config file path
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Attempting to open config file: /root/.packerconfig
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Setting cache directory: /home/lee/packer-maas/centos8/packer_cache
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: args: []string{"packer-post-processor-shell-local"}
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Plugin address: unix /tmp/packer-plugin626580630
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Waiting for connection...
2020/10/20 14:17:26 Received unix RPC address for /home/lee/go/bin/packer: addr is /tmp/packer-plugin626580630
2020/10/20 14:17:26 packer-post-processor-shell-local plugin: Serving a plugin connection...
2020/10/20 14:17:26 Preparing build: qemu
2020/10/20 14:17:26 packer-builder-qemu plugin: use detected accelerator: kvm
2020/10/20 14:17:26 packer-builder-qemu plugin: CpuCount 0 too small, using default: 1
2020/10/20 14:17:27 ui: qemu: output will be in this color.
2020/10/20 14:17:27 ui: 
2020/10/20 14:17:27 Build debug mode: false
2020/10/20 14:17:27 Force build: false
2020/10/20 14:17:27 On error: 
2020/10/20 14:17:27 Waiting on builds to complete...
2020/10/20 14:17:27 Starting build run: qemu
2020/10/20 14:17:27 Running builder: qemu
2020/10/20 14:17:27 [INFO] (telemetry) Starting builder qemu
2020/10/20 14:17:27 packer-builder-qemu plugin: Qemu path: /usr/bin/qemu-system-x86_64, Qemu Image page: /usr/bin/qemu-img
2020/10/20 14:17:27 ui: ==> qemu: Retrieving ISO
2020/10/20 14:17:27 ui: ==> qemu: Trying https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso
2020/10/20 14:17:27 packer-builder-qemu plugin: Acquiring lock for: https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c (/home/lee/packer-maas/centos8/packer_cache/8d71e8377b300414b6e2ac9d20cf8724f37070f7.iso.lock)
2020/10/20 14:17:27 ui: ==> qemu: Trying https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c
2020/10/20 14:18:18 packer-builder-qemu plugin: closing
2020/10/20 14:18:20 ui: ==> qemu: https://mirrors.edge.kernel.org/centos/8.2.2004/isos/x86_64/CentOS-8.2.2004-x86_64-boot.iso?checksum=sha256%3Ac67876a5602faa17f68b40ccf2628799b87454aa67700f0f57eec15c6ccdd98c => /home/lee/packer-maas/centos8/packer_cache/8d71e8377b300414b6e2ac9d20cf8724f37070f7.iso
2020/10/20 14:18:20 packer-builder-qemu plugin: Leaving retrieve loop for ISO
2020/10/20 14:18:20 packer-builder-qemu plugin: No floppy files specified. Floppy disk will not be made.
2020/10/20 14:18:20 packer-builder-qemu plugin: No CD files specified. CD disk will not be made.
2020/10/20 14:18:20 ui: ==> qemu: Creating required virtual machine disks
2020/10/20 14:18:20 packer-builder-qemu plugin: [INFO] Creating disk with Path: output-qemu/packer-qemu and Size: 4G
2020/10/20 14:18:20 packer-builder-qemu plugin: Executing qemu-img: []string{"create", "-f", "qcow2", "output-qemu/packer-qemu", "4G"}
2020/10/20 14:18:20 packer-builder-qemu plugin: stdout: Formatting 'output-qemu/packer-qemu', fmt=qcow2 size=4294967296 cluster_size=65536 lazy_refcounts=off refcount_bits=16
2020/10/20 14:18:20 packer-builder-qemu plugin: stderr:
2020/10/20 14:18:20 packer-builder-qemu plugin: Found available port: 8186 on IP: 0.0.0.0
2020/10/20 14:18:20 ui: ==> qemu: Starting HTTP server on port 8186
2020/10/20 14:18:20 ui:     qemu: No communicator is set; skipping port forwarding setup.
2020/10/20 14:18:20 ui: ==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
2020/10/20 14:18:20 packer-builder-qemu plugin: Looking for available port between 5900 and 6000 on 127.0.0.1
2020/10/20 14:18:20 packer-builder-qemu plugin: Retryable error: port 5903 cannot be opened: listen tcp 127.0.0.1:5903: bind: address already in use
2020/10/20 14:18:20 packer-builder-qemu plugin: Found available port: 5926 on IP: 127.0.0.1
2020/10/20 14:18:20 packer-builder-qemu plugin: Found available VNC port: 5926 on IP: 127.0.0.1
2020/10/20 14:18:20 packer-builder-qemu plugin: Qemu --version output: QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.7)
2020/10/20 14:18:20 packer-builder-qemu plugin: Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
2020/10/20 14:18:20 packer-builder-qemu plugin: Qemu version: 4.2.1
2020/10/20 14:18:20 ui: ==> qemu: Starting VM, booting from CD-ROM
2020/10/20 14:18:20 ui:     qemu: The VM will be run headless, without a GUI. If you want to
    qemu: view the screen of the VM, connect via VNC without a password to
    qemu: vnc://127.0.0.1:26
2020/10/20 14:18:20 packer-builder-qemu plugin: Qemu Builder has no floppy files, not attaching a floppy.
2020/10/20 14:18:20 ui: ==> qemu: Overriding default Qemu arguments with qemuargs template option...
2020/10/20 14:18:20 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5926: use of closed network connection
2020/10/20 14:18:20 packer-builder-qemu plugin: panic: interface conversion: interface {} is nil, not int
2020/10/20 14:18:20 packer-builder-qemu plugin: 
2020/10/20 14:18:20 packer-builder-qemu plugin: goroutine 107 [running]:
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*stepRun).applyUserOverrides(0xc00021b3c0, 0xc000db69f0, 0xc000056e00, 0x52f84c0, 0xc00072e780, 0x5, 0xc000d01100, 0xc000220f00, 0xc000220ea0, 0xc000c380a0)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/builder/qemu/step_run.go:285 +0xfa9
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*stepRun).getCommandArgs(0xc00021b3c0, 0xc000056e00, 0x52f84c0, 0xc00072e780, 0x0, 0x0, 0xc00072e788, 0xc00072e7b0, 0x4cb3768)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/builder/qemu/step_run.go:367 +0x85
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*stepRun).Run(0xc00021b3c0, 0x52f7880, 0xc000c257c0, 0x52f84c0, 0xc00072e780, 0x0)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/builder/qemu/step_run.go:47 +0x37b
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc00072e7e0, 0x52f7880, 0xc000c257c0, 0x52f84c0, 0xc00072e780)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/helper/multistep/basic_runner.go:67 +0x21c
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*Builder).Run(0xc000056e00, 0x52f7880, 0xc000c257c0, 0x5312b00, 0xc00072e5d0, 0x527a920, 0xc00021b3a0, 0xc000184020, 0xc000080c38, 0xc0000b3bd0, ...)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/builder/qemu/builder.go:154 +0x1142
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/packer/rpc.(*BuilderServer).Run(0xc0000cfe80, 0x1, 0xc000048050, 0x0, 0x0)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/packer/rpc/builder.go:117 +0x1c4
2020/10/20 14:18:20 packer-builder-qemu plugin: reflect.Value.call(0xc000080c00, 0xc0006c22e0, 0x13, 0x4ca94d4, 0x4, 0xc0000b3f08, 0x3, 0x3, 0x3030303030343638, 0x616e53646c6f1452, ...)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/snap/go/6633/src/reflect/value.go:475 +0x8c7
2020/10/20 14:18:20 packer-builder-qemu plugin: reflect.Value.Call(0xc000080c00, 0xc0006c22e0, 0x13, 0xc000750708, 0x3, 0x3, 0x6e8a2a, 0xc0001c6000, 0x0)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/snap/go/6633/src/reflect/value.go:336 +0xb9
2020/10/20 14:18:20 packer-builder-qemu plugin: net/rpc.(*service).call(0xc0000cfec0, 0xc0000d8dc0, 0xc0002164d0, 0xc000216540, 0xc00021f280, 0xc00011f2e0, 0x3e45e40, 0xc00004800c, 0x18a, 0x3d53920, ...)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/snap/go/6633/src/net/rpc/server.go:377 +0x189
2020/10/20 14:18:20 packer-builder-qemu plugin: created by net/rpc.(*Server).ServeCodec
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/snap/go/6633/src/net/rpc/server.go:474 +0x445
2020/10/20 14:18:20 /home/lee/go/bin/packer: plugin process exited
2020/10/20 14:18:20 [INFO] (telemetry) ending qemu
2020/10/20 14:18:20 ui error: Build 'qemu' errored after 53 seconds 159 milliseconds: unexpected EOF
2020/10/20 14:18:20 ui: 
==> Wait completed after 53 seconds 159 milliseconds
2020/10/20 14:18:20 machine readable: error-count []string{"1"}
2020/10/20 14:18:20 ui error: 
==> Some builds didn't complete successfully and had errors:
2020/10/20 14:18:20 machine readable: qemu,error []string{"unexpected EOF"}
2020/10/20 14:18:20 ui error: --> qemu: unexpected EOF
2020/10/20 14:18:20 ui: 
==> Builds finished but no artifacts were created.
2020/10/20 14:18:20 [INFO] (telemetry) Finalizing.
2020/10/20 14:18:20 waiting for all plugin processes to complete...
2020/10/20 14:18:20 /home/lee/go/bin/packer: plugin process exited

Reproduction Steps

  1. git clone --recurse-submodules git@github.com:canonical/packer-maas.git
  2. cd packer-maas/centos8
  3. sudo PACKER_LOG=1 packer build centos8.json

Packer version

Happens in Packer 1.6.3 and above

Simplified Packer Buildfile

https://github.com/canonical/packer-maas/blob/master/centos8/centos8.json

Operating system and Environment details

OS: Ubuntu Focal 20.04 LTS
qemu: 1:4.2-3ubuntu6.7
kernel: 5.4.0-51-generic

@ltrager
Copy link
Contributor Author

ltrager commented Oct 21, 2020

This was originally reported by multiple users in canonical/packer-maas#16

@nywilken
Copy link
Contributor

Hi there thanks for reaching out, and for the detailed debug information. We will take a look at this in time for the next release.

@nywilken
Copy link
Contributor

Crash information from log below


/10/20 14:18:20 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5926: use of closed network connection
2020/10/20 14:18:20 packer-builder-qemu plugin: panic: interface conversion: interface {} is nil, not int
2020/10/20 14:18:20 packer-builder-qemu plugin: 
2020/10/20 14:18:20 packer-builder-qemu plugin: goroutine 107 [running]:
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*stepRun).applyUserOverrides(0xc00021b3c0, 0xc000db69f0, 0xc000056e00, 0x52f84c0, 0xc00072e780, 0x5, 0xc000d01100, 0xc000220f00, 0xc000220ea0, 0xc000c380a0)
2020/10/20 14:18:20 packer-builder-qemu plugin: 	/home/lee/go/src/github.com/hashicorp/packer/builder/qemu/step_run.go:285 +0xfa9
2020/10/20 14:18:20 packer-builder-qemu plugin: github.com/hashicorp/packer/builder/qemu.(*stepRun).getCommandArgs(0xc00021b3c0, 0xc000056e00, 0x52f84c0, 0xc00072e780, 0x0, 0x0, 0xc00072e788, 0xc00072e7b0, 0x4cb3768)

@SwampDragons
Copy link
Contributor

Hi, thanks for opening-- I was able to reproduce and write a patch. You can pull test builds from our CI server here: https://app.circleci.com/pipelines/github/hashicorp/packer/7656/workflows/db67bb6b-eb00-453b-a16d-7b7010386ce0/jobs/88025 or wait for the 1.6.5 release to test it out.

@ghost
Copy link

ghost commented Nov 22, 2020

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.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants