LXD 3.6 recursive: “true” doesn't work :(

Hello

I have the recursive: “true” issue with LXD 3.6.
I need to mount from host to container /srv/shared and /srv/shared/video points

Before LXD 3.6 I have been using following config:
devices:
shared:
path: srv/shared
source: /srv/shared
recursive: “true”
type: disk

Now in LXD 3.6 I have to mount it manually:
devices:
video:
path: srv/shared/video
source: /srv/shared/video
type: disk
shared:
path: srv/shared
source: /srv/shared
type: disk

Do you know how to avoid it?

Thanks in advance

I’m unable to reproduce this here:

# Check live normal
stgraber@castiana:~$ lxc config device add c1 cgroups disk source=/sys/fs/cgroup path=/mnt/cgroup
Device cgroups added to c1
stgraber@castiana:~$ lxc exec c1 -- grep mnt/cgroup /proc/mounts
tmpfs /mnt/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
stgraber@castiana:~$ lxc config device remove c1 cgroups
Device cgroups removed from c1

# Check live recursive
stgraber@castiana:~$ lxc config device add c1 cgroups disk source=/sys/fs/cgroup path=/mnt/cgroup recursive=true
Device cgroups added to c1
stgraber@castiana:~$ lxc exec c1 -- grep mnt/cgroup /proc/mounts
tmpfs /mnt/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /mnt/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
cgroup /mnt/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
cgroup /mnt/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /mnt/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /mnt/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /mnt/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /mnt/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset,clone_children 0 0
cgroup /mnt/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /mnt/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /mnt/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /mnt/cgroup/rdma cgroup rw,nosuid,nodev,noexec,relatime,rdma 0 0
cgroup /mnt/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /mnt/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
stgraber@castiana:~$ lxc config device remove c1 cgroups
Device cgroups removed from c1

# Check normal on boot
stgraber@castiana:~$ lxc config device add c1 cgroups disk source=/sys/fs/cgroup path=/mnt/cgroup
Device cgroups added to c1
stgraber@castiana:~$ lxc restart c1
stgraber@castiana:~$ lxc exec c1 -- grep mnt/cgroup /proc/mounts
tmpfs /mnt/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
stgraber@castiana:~$ lxc config device remove c1 cgroups
Device cgroups removed from c1

# Check recursive on boot
stgraber@castiana:~$ lxc config device add c1 cgroups disk source=/sys/fs/cgroup path=/mnt/cgroup recursive=true
Device cgroups added to c1
stgraber@castiana:~$ lxc restart c1
stgraber@castiana:~$ lxc exec c1 -- grep mnt/cgroup /proc/mounts
tmpfs /mnt/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /mnt/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime 0 0
cgroup /mnt/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
cgroup /mnt/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /mnt/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0
cgroup /mnt/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /mnt/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /mnt/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset,clone_children 0 0
cgroup /mnt/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /mnt/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /mnt/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /mnt/cgroup/rdma cgroup rw,nosuid,nodev,noexec,relatime,rdma 0 0
cgroup /mnt/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
cgroup /mnt/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
stgraber@castiana:~$ 

Hello Stephane,

Thank you for feedback but I still have the issue please see below:
maxim@ubuntu:~$ lxc config device add nas shared disk source=/srv/shared path=srv/shared recursive=true
Error: Invalid devices: The recursive option is only supported for additional bind-mounted paths

I forgot to say that /srv/shared & /srv/shared/video are zfs volumes

Hmm, that error would be caused by LXD thinking that the source path isn’t a directory, odd.

https://github.com/lxc/lxd/pull/5204 should fix the particular error

Thanks a lot!