Мой QEMU не работает, но я не могу найти причину из подробного журнала - PullRequest
0 голосов
/ 13 января 2020

Я пытаюсь собрать виртуальную машину с помощью упаковщика, используя следующий файл конфигурации:

{
"provisioners": [
    {
        "source": "system/etc/apt/sources.list_bionic",
        "type": "file",
        "destination": "/etc/apt/sources.list"
    },
    {
        "source": "system/etc/environment",
        "type": "file",
        "destination": "/etc/environment"
    }
],
"builders": [
    {
        "accelerator": "kvm",
        "ssh_wait_timeout": "60m",
        "ssh_password": "blabla",
        "iso_url": "http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso",
        "disk_size": "40000",
        "iso_checksum_url": "http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/SHA256SUMS",
        "qemuargs": [
            [
                "-m",
                "4096"
            ],
            [
                "-smp",
                "2"
            ]
        ],
        "boot_command": [
            "<tab> ",
            "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed-base-ill.cfg ",
            "auto-install/enable=true ",
            "net.ifnames=0 ",
            "netcfg/get_hostname=base-ill ",
            "netcfg/get_gateway=192.168.180.254 ",
            "netcfg/get_nameservers=195.83.126.2 195.83.126.11 ",
            "netcfg/hostname=base-ill ",
            "mirror/http/proxy=http://proxy.ill.fr:8888 ",
            "clock-setup/ntp-server= ",
            "passwd/user-fullname=si-admin ",
            "passwd/username=si-admin ",
            "passwd/user-password=blabla  ",
            "passwd/user-password-again=blabla  ",
            "passwd/root-password=blabla ",
            "passwd/root-password-again=blabla ",
            "no_proxy={{ .HTTPIP }},localhost,127.0.0.1,apt.ill.fr,*.ill.eu,*.ill.fr ",
            "<enter>"
        ],
        "name": "qemu",
        "http_directory": "http",
        "type": "qemu",
        "headless": "false",
        "shutdown_command": "shutdown -P now",
        "output_directory": "builds/base-ill-qemu-base",
        "vm_name": "base-ill",
        "format": "qcow2",
        "iso_checksum_type": "sha256",
        "boot_wait": "5s",
        "ssh_username": "root"
    }
],
"description": "Base template for ILL",
"post-processors": [],
"variables": {}

}

Это дает мне ошибку QEMU. Используя PACKER_LOG=1, чтобы получить больше многословия, я все еще не могу найти, о чем говорит ошибка QEMU. Вот мой журнал QEMU:

    pellegrini@pellegrini-port:~/git/packer$ 2020/01/13 17:00:53 [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/01/13 17:00:53 Attempting to open config file: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 [WARN] Config file doesn't exist: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 Setting cache directory: /home/pellegrini/git/packer/templates/base-ill/packer_cache
Running in background, not using a TTY
2020/01/13 17:00:53 Plugin could not be found at /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu (exec: "/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu": stat /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu: no such file or directory). Checking same directory as executable.
2020/01/13 17:00:53 Current exe path: /usr/local/bin/packer
2020/01/13 17:00:53 Creating plugin client for path: /usr/local/bin/packer
2020/01/13 17:00:53 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-qemu"}
2020/01/13 17:00:53 Waiting for RPC address for: /usr/local/bin/packer
2020/01/13 17:00:53 packer-builder-qemu plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/01/13 17:00:53 packer-builder-qemu plugin: Attempting to open config file: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-builder-qemu plugin: [WARN] Config file doesn't exist: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-builder-qemu plugin: Setting cache directory: /home/pellegrini/git/packer/templates/base-ill/packer_cache
2020/01/13 17:00:53 packer-builder-qemu plugin: args: []string{"packer-builder-qemu"}
2020/01/13 17:00:53 Received unix RPC address for /usr/local/bin/packer: addr is /tmp/packer-plugin588734228
2020/01/13 17:00:53 packer-builder-qemu plugin: Plugin address: unix /tmp/packer-plugin588734228
2020/01/13 17:00:53 packer-builder-qemu plugin: Waiting for connection...
2020/01/13 17:00:53 packer-builder-qemu plugin: Serving a plugin connection...
2020/01/13 17:00:53 Plugin could not be found at /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file (exec: "/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file": stat /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file: no such file or directory). Checking same directory as executable.
2020/01/13 17:00:53 Current exe path: /usr/local/bin/packer
2020/01/13 17:00:53 Creating plugin client for path: /usr/local/bin/packer
2020/01/13 17:00:53 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-file"}
2020/01/13 17:00:53 Waiting for RPC address for: /usr/local/bin/packer
2020/01/13 17:00:53 Received unix RPC address for /usr/local/bin/packer: addr is /tmp/packer-plugin160930985
2020/01/13 17:00:53 packer-provisioner-file plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/01/13 17:00:53 packer-provisioner-file plugin: Attempting to open config file: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-provisioner-file plugin: Setting cache directory: /home/pellegrini/git/packer/templates/base-ill/packer_cache
2020/01/13 17:00:53 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2020/01/13 17:00:53 packer-provisioner-file plugin: Plugin address: unix /tmp/packer-plugin160930985
2020/01/13 17:00:53 packer-provisioner-file plugin: Waiting for connection...
2020/01/13 17:00:53 packer-provisioner-file plugin: Serving a plugin connection...
2020/01/13 17:00:53 Plugin could not be found at /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file (exec: "/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file": stat /usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file: no such file or directory). Checking same directory as executable.
2020/01/13 17:00:53 Current exe path: /usr/local/bin/packer
2020/01/13 17:00:53 Creating plugin client for path: /usr/local/bin/packer
2020/01/13 17:00:53 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-file"}
2020/01/13 17:00:53 Waiting for RPC address for: /usr/local/bin/packer
2020/01/13 17:00:53 packer-provisioner-file plugin: [INFO] Packer version: 1.5.1 [go1.13.5 linux amd64]
2020/01/13 17:00:53 packer-provisioner-file plugin: Attempting to open config file: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-provisioner-file plugin: [WARN] Config file doesn't exist: /home/pellegrini/.packerconfig
2020/01/13 17:00:53 packer-provisioner-file plugin: Setting cache directory: /home/pellegrini/git/packer/templates/base-ill/packer_cache
2020/01/13 17:00:53 packer-provisioner-file plugin: args: []string{"packer-provisioner-file"}
2020/01/13 17:00:53 packer-provisioner-file plugin: Plugin address: unix /tmp/packer-plugin087699253
2020/01/13 17:00:53 packer-provisioner-file plugin: Waiting for connection...
2020/01/13 17:00:53 Received unix RPC address for /usr/local/bin/packer: addr is /tmp/packer-plugin087699253
2020/01/13 17:00:53 packer-provisioner-file plugin: Serving a plugin connection...
2020/01/13 17:00:53 Build debug mode: false
2020/01/13 17:00:53 Force build: false
2020/01/13 17:00:53 On error: 
2020/01/13 17:00:53 Preparing build: qemu
qemu: output will be in this color.

2020/01/13 17:00:53 packer-builder-qemu plugin: use specified accelerator: kvm
2020/01/13 17:00:53 packer-builder-qemu plugin: MemorySize 0 is too small, using default: 512
2020/01/13 17:00:53 packer-builder-qemu plugin: CpuCount 0 too small, using default: 1
2020/01/13 17:00:53 Waiting on builds to complete...
2020/01/13 17:00:53 Starting build run: qemu
2020/01/13 17:00:53 Running builder: qemu
2020/01/13 17:00:53 [INFO] (telemetry) Starting builder qemu
2020/01/13 17:00:53 packer-builder-qemu plugin: Qemu path: /usr/bin/qemu-system-x86_64, Qemu Image page: /usr/bin/qemu-img
==> qemu: Retrieving ISO
==> qemu: Trying http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso
2020/01/13 17:00:53 packer-builder-qemu plugin: Acquiring lock for: http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso?checksum=sha256%3A11396d3cbb23cd93ef2c37d791c7f6a8dc99dbf51e27fe18b1d569e8e433f69b (/home/pellegrini/git/packer/templates/base-ill/packer_cache/a8939310ed40d139edf3866818fd78e82793ce0f.iso.lock)
==> qemu: Trying http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso?checksum=sha256%3A11396d3cbb23cd93ef2c37d791c7f6a8dc99dbf51e27fe18b1d569e8e433f69b
==> qemu: http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso?checksum=sha256%3A11396d3cbb23cd93ef2c37d791c7f6a8dc99dbf51e27fe18b1d569e8e433f69b => /home/pellegrini/git/packer/templates/base-ill/packer_cache/a8939310ed40d139edf3866818fd78e82793ce0f.iso
2020/01/13 17:00:54 packer-builder-qemu plugin: Leaving retrieve loop for ISO
2020/01/13 17:00:54 packer-builder-qemu plugin: No floppy files specified. Floppy disk will not be made.
2020/01/13 17:00:54 packer-builder-qemu plugin: [INFO] Creating disk with Path: builds/base-ill-qemu-base/base-ill and Size: 40000M
2020/01/13 17:00:54 packer-builder-qemu plugin: Executing qemu-img: []string{"create", "-f", "qcow2", "builds/base-ill-qemu-base/base-ill", "40000M"}
==> qemu: Creating required virtual machine disks
2020/01/13 17:00:54 packer-builder-qemu plugin: stdout: Formatting 'builds/base-ill-qemu-base/base-ill', fmt=qcow2 size=41943040000 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
2020/01/13 17:00:54 packer-builder-qemu plugin: stderr:
2020/01/13 17:00:54 packer-builder-qemu plugin: Found available port: 8312 on IP: 0.0.0.0
==> qemu: Starting HTTP server on port 8312
2020/01/13 17:00:54 packer-builder-qemu plugin: Looking for available communicator (SSH, WinRM, etc) port between 2222 and 4444
2020/01/13 17:00:54 packer-builder-qemu plugin: Found available port: 3181 on IP: 127.0.0.1
==> qemu: Found port for communicator (SSH, WinRM, etc): 3181.
==> qemu: Looking for available port between 5900 and 6000 on 127.0.0.1
2020/01/13 17:00:54 packer-builder-qemu plugin: Looking for available port between 5900 and 6000 on 127.0.0.1
2020/01/13 17:00:54 packer-builder-qemu plugin: Found available port: 5963 on IP: 127.0.0.1
2020/01/13 17:00:54 packer-builder-qemu plugin: Found available VNC port: 5963 on IP: 127.0.0.1
==> qemu: Starting VM, booting from CD-ROM
2020/01/13 17:00:54 packer-builder-qemu plugin: Qemu --version output: QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.42), Copyright (c) 2003-2008 Fabrice Bellard
2020/01/13 17:00:54 packer-builder-qemu plugin: Qemu version: 2.5.0
2020/01/13 17:00:54 packer-builder-qemu plugin: Qemu Builder has no floppy files, not attaching a floppy.
==> qemu: Overriding defaults Qemu arguments with QemuArgs...
2020/01/13 17:00:54 packer-builder-qemu plugin: Executing /usr/bin/qemu-system-x86_64: []string{"-drive", "file=builds/base-ill-qemu-base/base-ill,if=virtio,cache=writeback,discard=ignore,format=qcow2", "-boot", "once=d", "-machine", "type=pc,accel=kvm", "-display", "gtk", "-m", "4096", "-name", "base-ill", "-netdev", "user,id=user.0,hostfwd=tcp::3181-:22", "-vnc", "127.0.0.1:63", "-smp", "2", "-device", "virtio-net,netdev=user.0", "-cdrom", "/home/pellegrini/git/packer/templates/base-ill/packer_cache/a8939310ed40d139edf3866818fd78e82793ce0f.iso"}
2020/01/13 17:00:54 packer-builder-qemu plugin: Started Qemu. Pid: 18887
2020/01/13 17:00:54 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: -display gtk: GTK support is disabled
2020/01/13 17:00:54 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:5963: use of closed network connection
==> qemu: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.
2020/01/13 17:00:54 packer-builder-qemu plugin: failed to unlock port lockfile: close tcp 127.0.0.1:3181: use of closed network connection
==> qemu: Deleting output directory...
2020/01/13 17:00:54 [INFO] (telemetry) ending qemu
2020/01/13 17:00:54 machine readable: error-count []string{"1"}
Build 'qemu' errored: Build was halted.

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

==> Some builds didn't complete successfully and had errors:
2020/01/13 17:00:54 machine readable: qemu,error []string{"Build was halted."}
==> Builds finished but no artifacts were created.
2020/01/13 17:00:54 [INFO] (telemetry) Finalizing.
==> Builds finished but no artifacts were created.
2020/01/13 17:00:55 waiting for all plugin processes to complete...
2020/01/13 17:00:55 /usr/local/bin/packer: plugin process exited
2020/01/13 17:00:55 /usr/local/bin/packer: plugin process exited
2020/01/13 17:00:55 /usr/local/bin/packer: plugin process exited

Глядя на подробный журнал, я не вижу четкой причины моей ошибки. Знаете ли вы, что является фактической ошибкой, на которую жалуется QEMU?

1 Ответ

1 голос
/ 13 января 2020

Соответствующая строка:

2020/01/13 17:00:54 packer-builder-qemu plugin: Qemu stderr: qemu-system-x86_64: -display gtk: GTK support is disabled

Упаковщик запустил QEMU, передав ему '-display gtk', чтобы запросить графическое устройство через интерфейс GTK GUI; но этот QEMU не был создан с поддержкой GTK, поэтому он выходит с ошибкой.

...