I made a lxd profile for cloud-init:
config:
user.user-data: |
#cloud-config
hostname: foo
users:
- default
- name: user
ssh_pwauth: false
disable_root: false
chpasswd:
list: |
ubuntu:linux
user:password
expire: false
description: Default LXD profile
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: default
type: disk
name: cloud-init
used_by: []
Then:
lxc launch images:ubuntu/focal/cloud uvm1 --vm --profile=cloud-init
lxc console uvm1 --type=vga
IIRC I had trouble setting crypted pass as well. This is not secure way, but I just wanted to tryout cloud-init. Althou this is not what you asked for, it might suit you depending on your needs, or until someone else answer your exact question…