Installing & Configuring Cloud-Init on ISO-Built Ubuntu 22.04 VMs Rumi, May 27, 2026May 27, 2026 Target OS : Ubuntu 22.04 LTS (installed from ISO) should also works on 20.x release Hypervisor : Proxmox VE Cloud-Init Ver : 25.3-0ubuntu1~22.04.1 (or later) ================================================================================ 1. PREREQUISITES ================================================================================ - Ubuntu 22.04 VM running on Proxmox VE - Root/sudo access inside the VM - VM must have internet connectivity - All commands are run INSIDE the VM (not on the Proxmox host) ================================================================================ 2. INSTALL CLOUD-INIT ================================================================================ sudo apt update sudo apt install cloud-init -y ================================================================================ 3. ENABLE CLOUD-INIT SERVICES ================================================================================ sudo systemctl enable cloud-init sudo systemctl enable cloud-init-local sudo systemctl enable cloud-config sudo systemctl enable cloud-final ================================================================================ 4. CONFIGURE CLOUD-INIT FOR PROXMOX (NoCloud DATASOURCE) ================================================================================ 4a. Create the Proxmox datasource config: sudo nano /etc/cloud/cloud.cfg.d/99_proxmox.cfg Paste the following: --- START OF FILE --- datasource_list: [NoCloud, None] disable_root: false ssh_pwauth: true --- END OF FILE --- 4b. Create the network renderer config: sudo nano /etc/cloud/cloud.cfg.d/99_network.cfg Paste the following: --- START OF FILE --- system_info: network: renderers: ['netplan'] --- END OF FILE --- !! CRITICAL WARNING !! The renderer config MUST be under ‘system_info:’ and NOT under the top-level ‘network:’ key. Putting ‘renderers’ or ‘version’ under the top-level ‘network:’ key will cause cloud-init to treat them as actual network config, resulting in this error: RuntimeError: Unknown network config version: None WRONG: network: renderers: ['netplan'] version: 2 CORRECT: system_info: network: renderers: ['netplan'] ================================================================================ 5. REMOVE INSTALLER OVERRIDE FILES ================================================================================ Ubuntu ISO installs leave files that BLOCK cloud-init from working. Remove them: sudo rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg sudo rm -f /etc/cloud/cloud.cfg.d/99-installer.cfg Explanation of what each file does: subiquity-disable-cloudinit-networking.cfg – Contains: network: {config: disabled} – Effect: Completely disables cloud-init network configuration 99-installer.cfg – Contains: datasource_list: [None] plus hardcoded instance-id – Effect: Overrides our NoCloud datasource, prevents cloud-init from reading the Proxmox CloudInit drive – Also sets: preserve_hostname: true, resize_rootfs: false, growpart: mode: ‘off’ — all of which block cloud-init The following files are SAFE to keep: – 05_logging.cfg – 90_dpkg.cfg – curtin-preserve-sources.cfg – README ================================================================================ 6. REMOVE OLD STATIC NETPLAN CONFIG ================================================================================ !! CRITICAL STEP !! The file /etc/netplan/00-installer-config.yaml is generated by the Ubuntu installer (subiquity) and contains hardcoded network settings. It takes priority over cloud-init’s generated config (50-cloud-init.yaml) because ’00-‘ sorts before ’50-‘. If NOT removed, cloud-init’s network config will NEVER take effect. BACKUP FIRST (so you can restore network if something goes wrong): sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml.bak Then remove it: sudo rm -f /etc/netplan/00-installer-config.yaml ================================================================================ 7. CLEAN MACHINE-UNIQUE IDENTIFIERS ================================================================================ These must be reset so future clones get unique identities: sudo truncate -s 0 /etc/machine-id sudo rm -f /var/lib/dbus/machine-id sudo ln -sf /etc/machine-id /var/lib/dbus/machine-id sudo rm -f /etc/ssh/ssh_host_* sudo rm -rf /var/lib/cloud/ ================================================================================ 8. REGENERATE SSH HOST KEYS (FOR CURRENT VM) ================================================================================ sudo ssh-keygen -A sudo systemctl restart ssh Verify keys exist: ls -la /etc/ssh/ssh_host_* You should see at least 3 key pairs (rsa, ecdsa, ed25519). ================================================================================ 9. DISABLE CLOUD-INIT ON CURRENT VM (PROTECT EXISTING CONFIG) ================================================================================ sudo touch /etc/cloud/cloud-init.disabled This prevents cloud-init from running on the CURRENT VM, preserving your existing configuration. Cloud-init remains installed and enabled for future use — it simply skips execution when this file exists. When you later clone/template this VM, REMOVE this file so clones run cloud-init on first boot. ================================================================================ 10. ADD CLOUDINIT DRIVE IN PROXMOX ================================================================================ On the Proxmox host web UI: 1. Select the VM in the left panel 2. Go to Hardware tab 3. Click Add → CloudInit Drive 4. Select storage (e.g., local-lvm or local) 5. Click Add After adding, the Cloud-Init tab in the VM's menu will become active (no longer grayed out). You can configure: - User - Password - SSH public key - DNS domain and servers - Network (IP, gateway, netmask) ================================================================================ 11. REBOOT AND VERIFY (CURRENT VM) ================================================================================ sudo reboot After reboot, verify: cloud-init status Expected: status: disabled systemctl status ssh Expected: active (running) systemctl is-enabled cloud-init Expected: enabled ls /etc/cloud/cloud-init.disabled Expected: file exists ================================================================================ 12. TEST CLOUD-INIT (REMOVE DISABLED FILE) ================================================================================ When ready to test that cloud-init works with Proxmox: 12a. Configure cloud-init settings in Proxmox GUI: – Go to Cloud-Init tab – Set: User, Password, SSH Key, IP, Gateway, DNS – Click “Regenerate Image” button at the top 12b. Inside the VM, enable cloud-init: sudo rm /etc/cloud/cloud-init.disabled sudo cloud-init clean --logs sudo rm -rf /var/lib/cloud/ sudo reboot 12c. After reboot, verify: cloud-init status Expected: status: done ip addr show Expected: IP matches what was set in Proxmox Cloud-Init tab cat /etc/netplan/50-cloud-init.yaml Expected: Contains proper netplan config with Proxmox IP, gateway, and DNS 12d. Verify the cloud-init drive was read: sudo mkdir -p /mnt/ci sudo mount /dev/sr0 /mnt/ci cat /mnt/ci/network-config cat /mnt/ci/user-data cat /mnt/ci/meta-data sudo umount /mnt/ci ================================================================================ 13. CREATING A PROXMOX TEMPLATE (FOR FUTURE USE) ================================================================================ To convert this VM into a cloneable template: 13a. Inside the VM: sudo rm -f /etc/cloud/cloud-init.disabled sudo cloud-init clean --logs sudo rm -rf /var/lib/cloud/ sudo rm -f /etc/ssh/ssh_host_* sudo truncate -s 0 /etc/machine-id sudo shutdown -h now 13b. On the Proxmox host web UI: – Right-click VM → Convert to template – Select template → Hardware → Add → CloudInit Drive (if needed) – Go to Cloud-Init tab → Configure user, password, SSH key, network – Click “Regenerate Image” 13c. To deploy a new VM from the template: – Right-click template → Clone – Choose: Linked Clone or Full Clone – Go to Cloud-Init tab → Set unique IP and hostname – Click “Regenerate Image” – Start the clone – Cloud-init runs on first boot automatically ================================================================================ 14. TROUBLESHOOTING ================================================================================ +————————————-+———————————–+ | SYMPTOM | CAUSE & FIX | +————————————-+———————————–+ | cloud-init status: disabled | Normal — cloud-init.disabled file | | | is present. Not an error. | +————————————-+———————————–+ | RuntimeError: Unknown network | 99_network.cfg has renderers | | config version: None | under top-level ‘network:’ key | | | instead of ‘system_info:’. | | | FIX: Use system_info: > network: | | | > renderers: [‘netplan’] | +————————————-+———————————–+ | IP not changing despite Proxmox | Old 00-installer-config.yaml is | | cloud-init config | still present and overriding. | | | FIX: rm /etc/netplan/00-installer- | | | config.yaml | +————————————-+———————————–+ | cloud-init status: error | Check logs: | | | cat /var/log/cloud-init.log | | | cat /var/log/cloud-init-output.log| | | cloud-init status –long | +————————————-+———————————–+ | SSH host keys missing after reboot | Regenerate: | | | sudo ssh-keygen -A | | | sudo systemctl restart ssh | +————————————-+———————————–+ | NoCloud datasource not found | CloudInit Drive not attached in | | | Proxmox. FIX: Hardware > Add > | | | CloudInit Drive | +————————————-+———————————–+ | datasource_list: [None] overriding | 99-installer.cfg still present. | | NoCloud | FIX: rm /etc/cloud/cloud.cfg.d/ | | | 99-installer.cfg | +————————————-+———————————–+ | Network lost after reboot | Restore from backup: | | | sudo cp /etc/netplan/00-installer- | | | config.yaml.bak /etc/netplan/ | | | 00-installer-config.yaml | | | sudo netplan apply | +————————————-+———————————–+ | “No CloudInit Drive found” grayed | CloudInit Drive not yet added. | | out in Proxmox GUI | FIX: Hardware > Add > CloudInit | | | Drive | +————————————-+———————————–+ Administrations Configurations (Linux) Proxmox Cloud-initProxmoxUbuntuUbuntu 20Ubuntu 22