Proxmox debian13 template

Download the image

wget https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-amd64-daily.qcow2

Configure the image with qemu guest agent installed

Install tools needed for image configuration

With Arch:

yay guestfs-tools

With Debian:

apt libguestfs-tools

Install qemu-guest-agent

virt-customize -a debian-13-genericcloud-amd64-daily.qcow2 --install qemu-guest-agent
[   0.0] Examining the guest ...
[  21.0] Setting a random seed
virt-customize: warning: random seed could not be set for this type of
guest
[  21.0] Setting the machine ID in /etc/machine-id
[  21.0] Installing packages: qemu-guest-agent
[  36.2] SELinux relabelling
[  37.4] Finishing off

Reset the machine ID

virt-customize configure the machine ID, yet in order to use this image as a template we don't want this image to have a machine ID:

virt-customize -a debian-13-genericcloud-amd64-daily.qcow2 --run-command "echo -n > /etc/machine-id"
[   0.0] Examining the guest ...
[  10.5] Setting a random seed
virt-customize: warning: random seed could not be set for this type of
guest
[  10.5] Running: echo -n > /etc/machine-id
[  10.6] SELinux relabelling
[  10.6] Finishing off

Upload the image on the hypervisor

The hypervisor wants file extensions as .img and not .qcow2:

mv debian-13-genericcloud-amd64-daily.qcow2 debian-13-genericcloud-amd64-daily.img

Then upload the image to the good storage, the one storing the VM images.

Create the template

Create a VM with a basic config

qm create 900 --memory 2048 --net0 virtio,bridge=vmbr0 --serial0 socket --vga serial0 --name debian13-CI --ide2 local-zfs:cloudinit --agent 1 --ostype l26 --cores 1

Use the cloud-init image as a disk

qm importdisk 900 /var/lib/vz/template/iso/debian-13-genericcloud-amd64-daily.img local-zfs

Finish disks configuration

qm set 900 --scsihw virtio-scsi-single --scsi0 local-zfs:vm-900-disk-0,discard=on,ssd=1,iothread=1
qm set 900 --boot order=scsi0 --ipconfig0 ip=dhcp

Set the VM into a template

qm template 900