Proxmox VE – How to build an Ubuntu 22.04 Template (Updated Method)

Proxmox Virtual Environment is a powerful and easy to use virtualization platform with many features. Virtual machine templates help to minimize the amount of time spent building new instances, and in this video we’ll take a look at how you can utilize Ubuntu’s cloud images to automate the process of deploying new Linux instances.

Subscribe to LearnLinuxTV

Video-specific Links

Commands used in this video

Add a serial console to the reference VM

qm set <VM ID> --serial0 socket --vga serial0

Change the file extension of the image to .qcow2

mv ubuntu-22.04-minimal-cloudimg-amd64.img ubuntu-22.04.qcow2

Resize the downloaded cloud image

qemu-img resize ubuntu-22.04.qcow2 32G

Import the cloud image into Proxmox

qm importdisk 900 ubuntu-22.04.qcow2 local-lvm

Notable Replies

  1. Avatar for Biky Biky says:

    One small issue. .img files are raw FS formats. .qcow2 file are different formats and you need your file to be formatted as such. If you run a file ubuntu-22.04.qcow2 you will most likely see that the file type is not actually qcow. The only way to fix that is to create the proxmox VM and add the ubuntu image as a raw file instead of qcow2, then under proxmox to “convert to qcow2.” That’s how it works when you are working with files on a NFS share, however, at the end you import the file to local-lvm. That means you are creating a logical volume and importing the partition data in LVM. So it’s not even qcow2 anyway, it is a raw fs image…

    Personally I never liked the proxmox LVM(-thin) option, I always deleted that and created a path or new volume under the same VG and mounted it locally, then sent the images there. Way easier to work with.

  2. Avatar for Biky Biky says:

    I got around to watching the tutorial, just because I can always learn something, even when I am guessing I already know what’s being done there.

    The reason why the import fails with the .img file name is because KVM only supports .raw and .qcow2 disk image formats. So instead of renaming it .qcow2, try renaming it to .raw. This should allow you to import it and then if needed, convert it to qcow2 later. Funnily enough, when using either local ZFS or local LVM, I cannot select anything other than .raw files when creating a virtual disk. This is most likely because the FS takes care of the snapshot capabilities (both ZFS and LVM have built-in snapshot capabilities). If using a NFS share, I think the .qcow2 option gets enabled. Back at my old workplace, we were using NFS and converted all images from .raw to .qcow2. Funnily enough, the operation can be done live while the VM is running! And you can do it in both directions (from raw to qcow2 and from qcow2 to raw).

Continue the discussion at