Skip to content

Commit 0cb16b9

Browse files
authored
Merge pull request #5 from ZacksHomeLab/dev
fix: Incorrect commands w/ creating template
2 parents 01d6a62 + e5d37d2 commit 0cb16b9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ apt-get -y install libguestfs-tools
175175

176176
```bash
177177
virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent
178+
179+
virt-customize -a jammy-server-cloudimg-amd64.img --run-command "systemctl enable qemu-guest-agent"
178180
```
179181
* (OPTIONAL): If you're **NOT** using an SSL Certificate within Cloudinit drive on said Virtual Machine, you'll need to modify SSH in said image to allow local authentication, which can be done running said command
180182

@@ -218,15 +220,20 @@ qm set $VM_ID --agent enabled=1,fstrim_cloned_disks=1
218220
```
219221

220222
The following commands will perform the following:
223+
* Create a variable to determine the location of our imported disk. This is necessary as some storage pools create the destination directory differently. A variable fixes said inconsistencies.
221224
* Add a CD-ROM to `ide0` (in case you need to reinstall the Virtual Machine at a later date)
225+
* Import the unused disk image as a `virtio0` disk. This requires scsihw `virtio-scsi-pci`
222226
* Add a Cloudinit drive to `ide2`
223227
* Set the boot order to `CD-ROM (ide0) -> Disk (virtio0) -> Network Adapter (net0)` and set the bootdisk to disk `virtio0`
224228
* Set the OS Type to `Linux: 6.x - 2.6 Kernel`
225229
* Add a serial adapter `serial0` and update our display to `serial0`
226230
* (Optional): Set CPU Type to `host`. This is necessary if you plan on running any sort of nested virtualization on said Virtual Machine (e.g., Docker, Hyper-V, etc.)
227231
```bash
232+
export DISK_LOC="$STORAGE_POOL:$(qm config $VM_ID | grep -Po "(?<=unused\d: $STORAGE_POOL:).*")"
233+
228234
qm set $VM_ID --ide0 file=none && \
229-
qm set $VM_ID --ide2 $STORAGE_POOL:Cloudinit && \
235+
qm set $VM_ID --scsihw virtio-scsi-pci --virtio0 $DISK_LOC && \
236+
qm set $VM_ID --ide2 $STORAGE_POOL:cloudinit && \
230237
qm set $VM_ID --boot "order=ide0;virtio0;net0" --bootdisk virtio0 && \
231238
qm set $VM_ID --ostype l26 && \
232239
qm set $VM_ID --serial0 socket --vga serial0

0 commit comments

Comments
 (0)