I cannot get qemu-guest-agent installed on the debian-12-generic-amd64.qcow2 image. I'm trying to follow the instructions from this tutorial and code.
Here are the steps I'm following and the outcome:
First, I get the image using this script:
Next, since that Debian cloud image does not have qemu-guest-agent, I do this:
Here's the output:
Then, after making sure Packer will be using a privileged token on the Proxmox node, I execute this from this documentation:
It successfully creates a VM, but it hangs on:
That times out. Before it times out, I can use the SSH key provided in the variables to SSH into the VM from my client, but I get this output:
I do have cloud init enabled on the guest, as you can see with these input variables in the packer build:
Also, I confirmed in the Proxmox WebUI after the VM is created that "QEMU Guest Agent" is Enabled.
What am I missing? And how did kencx get proxmox-clone to work with the code he provided here? The only thing that makes sense is that he wasn't using Debian, considering that the Debian cloud-init image does not have qemu-guest-agent installed. But still...why does virt-customize say it is installed and yet it is not?
The whole idea eventually is to automatic this process in my self-hosted GitLab CE instance with a GitLab CI/CD runner. Does anyone have another solution that may work in order to automate the following?
1. Download the latest Debian qcow2 image.
2. Create a VM template from it.
3. Use Packer's proxmox-clone to create a new custom VM template from that default template but with my own shell provisioners.
4. Proceed to then automate the deployment of a new VM from that template using Terraform or whatever (I'm very familiar with Terraform/Packer since I use them at work as an SRE engineer to build AWS AMIs for EC2 launch templates).
Here are the steps I'm following and the outcome:
First, I get the image using this script:
./bin/import-cloud-image https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 debian-12-generic-amd64.qcow2
Next, since that Debian cloud image does not have qemu-guest-agent, I do this:
virt-customize -a /var/lib/vz/images/debian-12-generic-amd64.qcow2 --install qemu-guest-agent
Here's the output:
Bash:
root@hoth:~# virt-customize -a /var/lib/vz/images/debian-12-generic-amd64.qcow2 --install qemu-guest-agent
[ 0.0] Examining the guest ...
[ 2.1] Setting a random seed
virt-customize: warning: random seed could not be set for this type of
guest
[ 2.1] Installing packages: qemu-guest-agent
[ 5.2] Finishing off
Then, after making sure Packer will be using a privileged token on the Proxmox node, I execute this from this documentation:
Bash:
packer init main.pkr.hcl &&\
packer validate -var-file="auto.pkrvars.hcl" . &&\
packer build -var-file="auto.pkrvars.hcl" .
It successfully creates a VM, but it hangs on:
Code:
➜ packer init main.pkr.hcl &&\
packer validate -var-file="auto.pkrvars.hcl" . &&\
PACKER_LOG=1 packer build -var-file="auto.pkrvars.hcl" .
The configuration is valid.
proxmox-clone.base: output will be in this color.
==> proxmox-clone.base: Using existing SSH private key for the communicator...
==> proxmox-clone.base: Creating VM
==> proxmox-clone.base: Starting VM
...
2025/05/11 11:06:07 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:07 using token auth
2025/05/11 11:06:07 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:07 disk discovered on source vm at scsi0
2025/05/11 11:06:21 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:21 No boot command given, skipping
2025/05/11 11:06:24 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:24 [DEBUG] Unable to get address during connection step: 500 QEMU guest agent is not running
2025/05/11 11:06:24 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:24 [INFO] Waiting for SSH, up to timeout: 10m0s
2025/05/11 11:06:27 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:27 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2025/05/11 11:06:35 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:35 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2025/05/11 11:06:43 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:43 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
2025/05/11 11:06:52 packer-plugin-proxmox_v1.2.2_x5.0_darwin_arm64 plugin: 2025/05/11 11:06:52 [DEBUG] Error getting SSH address: 500 QEMU guest agent is not running
That times out. Before it times out, I can use the SSH key provided in the variables to SSH into the VM from my client, but I get this output:
Bash:
debian@nomad-base-debian12-2025-05-11:~$ sudo systemctl status qemu-guest-agent
Unit qemu-guest-agent.service could not be found.
debian@nomad-base-debian12-2025-05-11:~$ sudo systemctl list-units --type=service --all | grep qemu
debian@nomad-base-debian12-2025-05-11:~$
I do have cloud init enabled on the guest, as you can see with these input variables in the packer build:
Code:
# Properties of the new VM
vm_id = var.vm_id
vm_name = local.vm_name
template_description = local.template_desc
qemu_agent = true
cloud_init = true
cloud_init_storage_pool = var.cloud_init_storage_pool
Also, I confirmed in the Proxmox WebUI after the VM is created that "QEMU Guest Agent" is Enabled.
What am I missing? And how did kencx get proxmox-clone to work with the code he provided here? The only thing that makes sense is that he wasn't using Debian, considering that the Debian cloud-init image does not have qemu-guest-agent installed. But still...why does virt-customize say it is installed and yet it is not?
The whole idea eventually is to automatic this process in my self-hosted GitLab CE instance with a GitLab CI/CD runner. Does anyone have another solution that may work in order to automate the following?
1. Download the latest Debian qcow2 image.
2. Create a VM template from it.
3. Use Packer's proxmox-clone to create a new custom VM template from that default template but with my own shell provisioners.
4. Proceed to then automate the deployment of a new VM from that template using Terraform or whatever (I'm very familiar with Terraform/Packer since I use them at work as an SRE engineer to build AWS AMIs for EC2 launch templates).
Last edited: