Skip to content

Commit cc3e3be

Browse files
committed
Bring every general-purpose cloud image to the same state
Eight scripts -- archlinux, debian-vm, the five ubuntu ones and the test helper -- imported their image without touching it, so they had no console, no guest agent, a cloned machine-id and no way to use the Cloud-Init password. They now call vm_prepare_cloud_image after the download. app-deployer is not among them: it downloads through build_app_vm, and the fix for it belongs in vm-app.func rather than here. An earlier pass of mine put the call inside its select_storage, where the image does not exist yet; that is removed. Untouched on purpose: the appliance images (haos, pimox-haos, openwrt, opnsense, mikrotik, nextcloud, owncloud, umbrel) have no apt and no systemd to customise, and the ISO installers have no image at all until the guest installs itself.
1 parent 832a3ee commit cc3e3be

8 files changed

Lines changed: 32 additions & 0 deletions

‎vm/archlinux-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ echo -en "\e[1A\e[0K"
101101
FILE=$(basename $URL)
102102
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
103103

104+
# Console, guest agent, machine-id and root login -- the image was
105+
# imported untouched before, so it had none of them.
106+
vm_prepare_cloud_image "$FILE" "$HN" || true
107+
104108
STORAGE_TYPE=$(pvesm status -storage "$STORAGE" | awk 'NR>1 {print $2}')
105109
case $STORAGE_TYPE in
106110
nfs | dir | cifs)

‎vm/debian-vm-test-helper.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ if [ "${CLOUD_INIT:-no}" != "yes" ]; then
103103
vm_expand_image "$FILE" "$DISK_SIZE" || true
104104
fi
105105

106+
# Console, guest agent, machine-id and root login -- the image was
107+
# imported untouched before, so it had none of them.
108+
vm_prepare_cloud_image "$FILE" "$HN" || true
109+
106110
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
107111
case $STORAGE_TYPE in
108112
nfs | dir)

‎vm/debian-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ if [ "${CLOUD_INIT:-no}" != "yes" ]; then
126126
vm_expand_image "$FILE" "$DISK_SIZE" || true
127127
fi
128128

129+
# Console, guest agent, machine-id and root login -- the image was
130+
# imported untouched before, so it had none of them.
131+
vm_prepare_cloud_image "$FILE" "$HN" || true
132+
129133
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
130134
case $STORAGE_TYPE in
131135
nfs | dir)

‎vm/ubuntu2204-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ echo -en "\e[1A\e[0K"
101101
FILE=$(basename $URL)
102102
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
103103

104+
# Console, guest agent, machine-id and root login -- the image was
105+
# imported untouched before, so it had none of them.
106+
vm_prepare_cloud_image "$FILE" "$HN" || true
107+
104108
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
105109
case $STORAGE_TYPE in
106110
nfs | dir | cifs)

‎vm/ubuntu2404-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ echo -en "\e[1A\e[0K"
101101
FILE=$(basename $URL)
102102
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
103103

104+
# Console, guest agent, machine-id and root login -- the image was
105+
# imported untouched before, so it had none of them.
106+
vm_prepare_cloud_image "$FILE" "$HN" || true
107+
104108
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
105109
case $STORAGE_TYPE in
106110
nfs | dir | cifs)

‎vm/ubuntu2410-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ echo -en "\e[1A\e[0K"
220220
FILE=$(basename $URL)
221221
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
222222

223+
# Console, guest agent, machine-id and root login -- the image was
224+
# imported untouched before, so it had none of them.
225+
vm_prepare_cloud_image "$FILE" "$HN" || true
226+
223227
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
224228
case $STORAGE_TYPE in
225229
nfs | dir | cifs)

‎vm/ubuntu2504-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ echo -en "\e[1A\e[0K"
100100
FILE=$(basename $URL)
101101
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
102102

103+
# Console, guest agent, machine-id and root login -- the image was
104+
# imported untouched before, so it had none of them.
105+
vm_prepare_cloud_image "$FILE" "$HN" || true
106+
103107
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
104108
case $STORAGE_TYPE in
105109
nfs | dir | cifs)

‎vm/ubuntu2604-vm.sh‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ echo -en "\e[1A\e[0K"
132132
FILE="$(basename "$URL")"
133133
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
134134

135+
# Console, guest agent, machine-id and root login -- the image was
136+
# imported untouched before, so it had none of them.
137+
vm_prepare_cloud_image "$FILE" "$HN" || true
138+
135139
msg_info "Creating a Ubuntu 26.04 VM"
136140
qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \
137141
-name $HN -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci

0 commit comments

Comments
 (0)