Cloud-Init fails to execute cloud user/final scripts

VirtualA

Member
Dec 7, 2018
7
0
21
44
I created a template from an Ubuntu 22.04 cloud img with Cloud-Init via the Proxmox GUI. When I try to start the new VM, Cloud-Init runs but fails at the end with "Failed execute cloud user/final scripts" resulting in me being unable to log into the VM with either a username/password or ssh.

I am using the console to view the output, but it doesn't provide much information why I'm experiencing this issue. Is there a better way for me to view the output of the error such as logs while I'm unable to log into the VM? Below is some information about my template, I realize I've overly redacted information but I don't think it's relevant to the issue anyway.

Code:
$ qm cloudinit dump 100 user
#cloud-config
hostname: ubuntu-2204-template
manage_etc_hosts: true
user: admin
password: [redacted]
ssh_authorized_keys:
  - ssh-ed25519 [redacted]
chpasswd:
  expire: False
users:
  - default
package_upgrade: true

Code:
$ qm config 100
qm config 100
agent: 1
boot: order=ide2;scsi0;net0;ide0
cipassword: **********
ciuser: admin
cores: 2
ide0: local-lvm:vm-100-cloudinit,media=cdrom
ide2: none,media=cdrom
ipconfig0: ip=dhcp,ip6=dhcp
memory: 4096
meta: creation-qemu=7.1.0,ctime=1672844707
name: ubuntu-2204-template
net0: virtio=[redacted],bridge=vmbr0,firewall=1
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-100-disk-0,discard=on,iothread=1,size=32G,ssd=1
scsihw: virtio-scsi-single
smbios1: uuid=[redacted]
sockets: 1
sshkeys: [redacted]
template: 1
vmgenid: [redacted]
 
Could you try a newer or older image of Ubuntu 22.04 instead and see if it exhibits the same issues?

You could always boot a live Ubuntu and look into the cloud-init logs under /var/log on the VM disk.
 
Thanks for the suggestion to view logs with live instance of Ubuntu. I had tried different images of Ubuntu Server (both Standard and Minimal as well as one released in December and one released yesterday after this post) including different versions of Ubuntu server (20.04 and 22.04) and the problem persisted on all of these.

I think the issue is with the User field in the Cloud Init config. If the Default user is edited the script fails but if I do not touch the username or password field the VM successfully starts up and I'm able to log in via SSH and my key (using the default ubuntu username). I came across a video on YouTube from Learn Linux TV which mentions a similar behavior when renaming the default user vs just commenting it out https://youtu.be/exeuvgPxd-E?t=515.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!