Overlayfs on LXD


I intend to set up an overlay container for testing purpose.
Base container is setup with the name “base-lxd” with all the packages installed

Overlay container with the name “testoverlay” which is an empty image that has these 3 directories:
rootfs, overlay-work, overlay-upper

Before starting “testoverlay”, it is overlay mounted with this command:

mount -t overlay -o lowerdir=/var/lib/lxd/containers/base-lxd/rootfs,upperdir=/var/lib/lxd/containers/testoverlay/overlay-upper,workdir=/var/lib/lxd/containers/testoverlay/overlay-work overlay /var/lib/lxd/containers/testoverlay/rootfs

When I start, it remaps /var/lib/lxd/containers/testoverlay/rootfs files from 1000000:1000000 to 2000000:2000000 which probably result failure to start this overlaid container. The mount point is also somehow unmount.

Or is there a way to tell lxc start not to perform any further remapping if it has already been remapped?

Any ideas, anyone? Thanks.

You would need to manually set/alter the volatile config keys for the container, basic that off the source container.

I have tried to alter the volatile keys on the overlaid container side such that the id mapping doesn’t change when it is started. However, it still failed due to this error message:
Error: Common start logic: Extended attributes changed during retrieval

No log when execute lxc info --show-log testoverlay

I have changed the volatile keys:
volatile.idmap.current: ‘[{“Isuid”:true,“Isgid”:false,“Hostid”:1000000,“Nsid”:1000000,“Maprange”:1000000000},{“Isuid”:false,“Isgid”:true,“Hostid”:1000000,“Nsid”:1000000,“Maprange”:1000000000}]’

Now it doesn’t remap.

However when it still fails to start.
lxc start overlay-test

Error: Common start logic: saving config file for the container failed
Try lxc info --show-log overlay-test for more info

lxc info --show-log overlay-test results:

Name: overlay-test
Location: none
Remote: unix://
Architecture: x86_64
Created: 2020/03/11 13:24 UTC
Status: Stopped
Type: container
Profiles: default


results with empty log.

Would like to know what Nsid represents. I believe may be due to this issue.