# create a 'seed.img' for cloud-init local datasource
cloud-localds seed.img user-data
# create a 'disk1.img' backed by the downloaded disk
qemu-img create -f qcow2 -b $dimg.dist disk1.img
# patch it with 'my-logger.conf'
sudo mount-image-callback -v disk1.img -- \
sh -c 'cp my-logger.conf $MOUNTPOINT/etc/init/my-logger.conf'
# boot in kvm with log to 'serial.log'
kvm -net nic -net user,hostfwd=tcp::2222-:22 \
-drive file=disk1.img,if=virtio -drive file=seed.img,if=virtio \
-serial file:serial.log -curses
# after the system boots, you can ssh to localhost on port 2222 and
# log in with 'ubuntu' and 'passw0rd'
# you'll see that /run/my.log has output in it.
Heres a simple reproduce that shows the issue.
it seems racy condition like.
rel="saucy" rel-server- cloudimg- amd64-disk1. img" cloud-images. ubuntu. com/$rel/ current/"
dimg="$
dbase_url="http://
mylogger_url="https:/ /launchpadlibra rian.net/ 152522734/ my-logger. conf"
## get files and prereqs
sudo apt-get install cloud-image-utils
wget "${dbase_url}$dimg" -O $dimg.dist
wget "$mylogger_url" -O my-logger.conf
cat > user-data <<EOF
#cloud-config
password: passw0rd
chpasswd: { expire: False }
ssh_pwauth: True
EOF
# create a 'seed.img' for cloud-init local datasource
cloud-localds seed.img user-data
# create a 'disk1.img' backed by the downloaded disk
qemu-img create -f qcow2 -b $dimg.dist disk1.img
# patch it with 'my-logger.conf' callback -v disk1.img -- \ etc/init/ my-logger. conf'
sudo mount-image-
sh -c 'cp my-logger.conf $MOUNTPOINT/
# boot in kvm with log to 'serial.log' tcp::2222- :22 \ img,if= virtio -drive file=seed. img,if= virtio \
kvm -net nic -net user,hostfwd=
-drive file=disk1.
-serial file:serial.log -curses
# after the system boots, you can ssh to localhost on port 2222 and
# log in with 'ubuntu' and 'passw0rd'
# you'll see that /run/my.log has output in it.