18.04 setup step-by-step with cloud-localds
In short you need on the host:
sudo apt-get install cloud-image-utils
cat >user-data <<EOF
#cloud-config
password: asdfqwer
chpasswd: { expire: False }
ssh_pwauth: True
EOF
cloud-localds user-data.img user-data
# user-data.img MUST come after the rootfs.
qemu-system-x86_64 \
-drive file=ubuntu-18.04-server-cloudimg-amd64.img,format=qcow2 \
-drive file=user-data.img,format=raw \
-m 1G
...
and now you can login with:
- username:
ubuntu
- password:
asdfqwer
Here I describe a full minimal detailed working QEMU example: https://askubuntu.com/questions/281763/is-there-any-prebuilt-qemu-ubuntu-image32bit-online/1081171#1081171
Tested on an Ubuntu 18.04 host.