* Home :: Get a random password :: Get a multi-word password :: What is my IP? (v4 | v6)
* My projects

Upstream Linux cloud images and CloudStack

Tags: cloudstack,howto,ubuntu,almalinux,oraclelinux,debian

Date: 20241023


Most distributions nowadays offer for download prepackaged images - most often in Qcow2 format - that you can use with your favourite virtualisation tool.

These images come with cloud-init and tend to work out of the box with CloudStack, but not to their full potential, for example password resets would not work on them.
Here's how to modify these images in 5 minutes and improve them:
1 - you'll need a Linux machine (can be a VM) with libguestfs-tools installed for the virt-copy-in and virt-customize commands
2 - download the upstream images
3 - patch them up

Here's the actual workflow in technical detail - I imagine that in time the download urls will have changed, perhaps some of the cloud-init configuration as well, so you may have to adjust for that:
# Step 1 - create a config file for cloud-init that is more Cloudstack friendly - do note I enable root user/login here
cat << "EOF" > 99_cloudstack.cfg
disable_root: 0
system_info:
   default_user:
     name: root
ssh_pwauth: true
datasource_list: ['CloudStack']
cloud_config_modules:
 - [set-passwords, always]
 - [ssh, always]
EOF

# Step 2 - download the required files - adjust as needed
wget https://yum.oracle.com/templates/OracleLinux/OL9/u4/x86_64/OL9U4_x86_64-kvm-b234.qcow2 \
https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 \
https://saimei.ftp.acc.umu.se/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2 \
https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img

# Step 3 - copy the cloud-init config snippet inside the images, we'll use the Alma image as an example,
# but you could use a bash loop and apply it to all
virt-copy-in -a ./AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 99_cloudstack.cfg /etc/cloud/cloud.cfg.d/

# Step 3.1 - it looks like Oracle and Alma Linux 9 (possibly other versions and other clones, too) are lacking "wget" in the image, 
# so we need to install it, otherwise the Cloudstack password feature will not work as the cloud-init CloudStack source relies on it.
virt-customize -a ./AlmaLinux-9-GenericCloud-latest.x86_64.qcow2 --install wget

Now you can register these Qcow2 images in CloudStack and they should work well.
(c)The Nux(tm) ;-)

No CSS, no Javascript, no some HTML.
No ads, no tracking, no cookies.