I can do the following to configure networking in a new container:
lxc init ubuntu:18.04 test-cloud-init
lxc config set test-cloud-init user.network-config "$(cat test-ci.yml)"
lxc start
This works fine. Now I want to re-run cloud-init in the same container.
I modify test-ci.yml
, use it to reset user.network-config
, and use cloud-init clean
to force cloud-init to run again on next boot:
lxc config set test-cloud-init user.network-config "$(cat test-ci.yml)"
lxc exec test-cloud-init cloud-init clean
lxc restart test-cloud-init
Unfortunately, the old configuration is re-applied. This is because the initial value of user.network-config
was written to /var/lib/cloud/seed/nocloud-net/network-config
inside the container, and it has not been updated with the new value of the user.network-config
property.
If I do cloud-init clean --seed
then the whole /var/lib/cloud/seed/
subtree is deleted, but it’s not recreated when the container restarts.
Is there a way to get lxd to refresh the contents of /var/lib/cloud/seed/nocloud-net/
on an existing container from the user.*
properties?