tar -cf - -C "$sdir" . | sudo mount-image-callback cloudimg.raw -- tar -C _MOUNTPOINT_ -xvf -
That way you dont have to be root for anything other than the mount-image-callback or know about the offset of the partition.
the resize issue is actually fixed under bug 1587971. Your stacktrace above showed a bug that I'm fixing now that occurred on reboot of a DataSourceNoCloud. I opened that as bug 1592505.
your recreate steps have a bit of an issue above, in that you 'echo' and then <<EOF. which just doesn't do anything but create empty user-data.
I might suggest using mount-image- callback as it makes a bit nicer.
sdir=$PWD/sdir lib/cloud/ seed/nocloud var/lib/ cloud/seed/ nocloud/ meta-data lib/cloud/ seed/nocloud/ user-data <<EOF
echo "Mounting cloudimg.raw into $sdir"
mkdir -p $sdir/var/
printf "dsmode: local\n" > $mnt_dir/
cat > $sdir/var/
#cloud-config
chpasswd:
expire: False
list: |
root:passw0rd
EOF
tar -cf - -C "$sdir" . | sudo mount-image- callback cloudimg.raw -- tar -C _MOUNTPOINT_ -xvf -
That way you dont have to be root for anything other than the mount-image- callback or know about the offset of the partition.
the resize issue is actually fixed under bug 1587971. Your stacktrace above showed a bug that I'm fixing now that occurred on reboot of a DataSourceNoCloud. I opened that as bug 1592505.