rancher / k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
https://k3os.io
Apache License 2.0
3.5k stars 397 forks source link

Proxmox packer config does not work #602

Closed Ramblurr closed 3 years ago

Ramblurr commented 3 years ago

Version (k3OS / kernel)

k3os master

Describe the bug

The proxmox cloud config provided does not work on Proxmox VE 6.2-4

The build fails because it cannot connect via SSH to the vm.

It cannot connect to the VM because it doesn't know the ip address, because the qemu guest agent is not properly connected.

To Reproduce

packer  build  -var-file=vars.json template.json
proxmox: output will be in this color.

==> proxmox: Retrieving ISO
==> proxmox: Trying https://github.com/rancher/k3os/releases/download/v0.19.2-dev.4/k3os-amd64.iso
==> proxmox: Trying https://github.com/rancher/k3os/releases/download/v0.19.2-dev.4/k3os-amd64.iso?checksum=sha256%3A18a348a307a91fe9d22e3b72abb63ab14d79b2525d15705f5c02d58d713d7e76
==> proxmox: https://github.com/rancher/k3os/releases/download/v0.19.2-dev.4/k3os-amd64.iso?checksum=sha256%3A18a348a307a91fe9d22e3b72abb63ab14d79b2525d15705f5c02d58d713d7e76 => /var/home/ramblurr/src/homelab-infra/packer/k3os/packer_cache/b48dfe283f6e2898f8dfb24aa7f351ee3c14e10d.iso
==> proxmox: Creating VM
==> proxmox: No VM ID given, getting next free from Proxmox
==> proxmox: Starting VM
==> proxmox: Starting HTTP server on port 8946
==> proxmox: Waiting 50s for boot
==> proxmox: Typing the boot command
==> proxmox: Waiting for SSH to become available...
==> proxmox: Timeout waiting for SSH.
==> proxmox: Stopping VM
==> proxmox: Deleting VM
Build 'proxmox' errored after 6 minutes 4 seconds: Timeout waiting for SSH.
packer  build  -var-file=vars.json template.json
proxmox: output will be in this color.

Expected behavior One expects the qemu guest agent to properly connect and the packer build to succeed.

Actual behavior

The qmeu guest agent does not connect.

k3os-30391 [~]$ sudo tail /var/log/qemu-ga.log 
1603452801.428718: critical: failed to create guest agent channel
1603452801.428722: critical: failed to initialize guest agent channel
1603452803.642404: critical: error opening channel: No such file or directory
1603452803.642420: critical: error opening channel
1603452803.642425: critical: failed to create guest agent channel
1603452803.642428: critical: failed to initialize guest agent channel
1603452807.462033: critical: error opening channel: No such file or directory
1603452807.462044: critical: error opening channel
1603452807.462048: critical: failed to create guest agent channel
1603452807.462052: critical: failed to initialize guest agent channel

Additional context

This can be fixed by adding the following to write_files in the config.yml

  - path: /etc/conf.d/qemu-guest-agent
    content: |-
      GA_PATH=/dev/vport1p1
    owner: root
    permissions: '0644'
jdmarble commented 3 years ago

This worked for me, but I also had to add "boot": "order=virtio0;ide2", to template.json because of the default boot order changing in a recent version of Proxmox. That property is only available in Packer v1.6.6 or later.