In my lab I'm running a three node cluster with a shared DAS storage solution. I have no issues manually installing virtual machines, but as soon as I create a template with the script below and clone a machine from the template it is unable to boot. When booting the template I end up at the "UEFI Interactive Shell v2.2" and I'm dropped into the shell. It would appear that the virtual machine fails to find its boot drive. However if I use the same script, but use local-lvm instead of shared_storage it works flawlessly to clone from the template. What could be the cause of this? My PVE environment is running on version 8.1.4.
Bash:
#! /bin/bash
# https://github.com/UntouchedWagons/Ubuntu-CloudInit-Docs/tree/main
VMID=9000
STORAGE=shared_storage
USER=ansible
set -x
rm -f noble-server-cloudimg-amd64.img
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
qemu-img resize noble-server-cloudimg-amd64.img 8G
qm destroy $VMID
qm create $VMID --name "ubuntu-noble-template" --ostype l26 \
--memory 1024 --balloon 0 \
--agent 1 \
--bios ovmf --machine q35 --efidisk0 $STORAGE:0,pre-enrolled-keys=0 \
--cpu host --cores 1 --numa 1 \
--vga serial0 --serial0 socket \
--net0 virtio,bridge=vmbr0,mtu=1
qm importdisk $VMID noble-server-cloudimg-amd64.img $STORAGE
qm set $VMID --scsihw virtio-scsi-single --virtio0 $STORAGE:vm-$VMID-disk-1,iothread=1
qm set $VMID --boot order=virtio0
qm set $VMID --ide2 $STORAGE:cloudinit
cat << EOF | tee /var/lib/vz/snippets/ubuntu.yaml
#cloud-config
runcmd:
- apt-get update
- apt-get install -y qemu-guest-agent
- systemctl enable ssh
- reboot
# Taken from https://forum.proxmox.com/threads/combining-custom-cloud-init-with-auto-generated.59008/page-3#post-428772
EOF
qm set $VMID --cicustom "vendor=local:snippets/ubuntu.yaml"
qm set $VMID --tags ubuntu,noble,terraform
qm set $VMID --ciuser $USER
qm set $VMID --sshkeys ~/.ssh/ansible.pub
qm set $VMID --ipconfig0 ip=dhcp
qm template $VMID