How to move btrfs mounting point of default storage pool?

Hi,
Running lxd 3.17, my default storage pool is a btrfs drive mounted as /var/snap/lxd/common/lxd/storage-pools/default . For specific reasons, I would need to change this mount point to something else, say /srv/abcd. Pitifully, I cannot simply create a simlink from /srv/abcd to /var/snap/lxd/common/lxd/storage-pools/default , I really need to change the mount.
But if I try to edit the storage pool, lxc tells me that properties source and volatile.initial_source cannot be changed, the message being ‘Config parsing error: The [source] properties cannot be changed for “btrfs” storage pools’

What can I do ? Any help appreciated!
(and Happy New Year of course!)

Indeed, this cannot be safely changed in some cases so is generally disallowed by LXD.

One way around the problem is to mount the pool wherever you want and then setup a bind mount of that over to /var/snap/lxd/common/lxd/storage-pools/default so that LXD keeps working as it is today.

Another way around this is to perform a bit of database surgery to edit the source key.
This can be done using lxd sql global "UPDATE storage_pools_config SET value='/some/path' WHERE key=sourceAND pool_id='ID';"

The pool IDs can be found with lxd sql global "SELECT * FROM storage_pools;"

Hope that helps!

Triple thanks, Stéphane, for the so-quick answser.

I tried on another volume (a dir-based, not a btrfs), and I get this even when using the bind mount solution:

lxc testcontainer 20200102210428.653 ERROR start - start.c:start:2124 - Permission denied - Failed to exec “/sbin/init”
lxc testcontainer 20200102210428.653 ERROR sync - sync.c:__sync_wait:62 - An error occurred in another process (expected sequence number 7)
lxc testcontainer 20200102210428.653 WARN network - network.c:lxc_delete_network_priv:3377 - Failed to rename interface with index 39 from “eth0” to its initial name “veth742b4356”
lxc testcontainer 20200102210428.653 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:873 - Received container state “ABORTING” instead of “RUNNING”
lxc testcontainer 20200102210428.654 ERROR start - start.c:__lxc_start:2039 - Failed to spawn container “testcontainer”
lxc 20200102210428.743 WARN commands - commands.c:lxc_cmd_rsp_recv:135 - Connection reset by peer - Failed to receive response for command “get_state”

To achieve this, I simply stopped the container (lxc stop testcontainer), moved /var/snap/lxd/common/lxd/storage-pools/default to /var/snap/lxd/common/lxd/storage-pools/newlocation and bind mounted the latter to /var/snap/lxd/common/lxd/storage-pools/default, and then restarted the container. I didn’t restart lxd itself (should have I?).

The container is an unprivileged one, which was running fine before that attempt (and which re-runs fine if I undo the move+bind mount). LXD is installed via snap on Debian 10.

Any idea?

Suggests that some intermediate directory permissions broke, preventing root in the container from reaching /sbin/init.

What are the permissions on /var/snap/lxd/common/lxd/storage-pools/default?

This error most often shows up when you have some intermediate directory between / and /var/snap/lxd/common/lxd/storage-pools/default/containers/testcontainers/rootfs/` be 0700 rather than at least 0711.

It could also happen if your filesystem was somehow mounted with noexec.

Indeed, there is one folder level which looks different (0100) which is the container level- but that one was created by lxc. So, what should it be? Is 0100 the normal/expected permission, or should it be 0711 or ‘more’ (during normal operation? or for the time of the shift?).

I changed it to 711 but, as soon as I try to start the container, lxc reverts it to 0100, and the container still fails to start with the same denied permission on /sbin/init.

Also, the permissions on /var/snap/lxd/common/lxd/storage-pools are slightly different from the other levels, that folder was created by lxc. Are these perms the right ones?

Here are the perms on the various folders:
drwxr-xr-x 1 1000000 1000000 122 /var/snap/lxd/common/lxd/storage-pools/default/containers/testcontainer/rootfs/
d–x------ 1 1000000 root 78 /var/snap/lxd/common/lxd/storage-pools/default/containers/testcontainer/
drwxr-xr-x 1 root root 44 /var/snap/lxd/common/lxd/storage-pools/default/containers/
drwxr-xr-x 1 root root 116 /var/snap/lxd/common/lxd/storage-pools/default
drwx–x--x 5 root root 4096 /var/snap/lxd/common/lxd/storage-pools
drwxr-xr-x 15 root root 4096 /var/snap/lxd/common/lxd
drwxr-xr-x 7 root root 4096 /var/snap/lxd/common
drwxr-xr-x 4 root root 4096 /var/snap/lxd
drwxr-xr-x 4 root root 4096 /var/snap
drwxr-xr-x 14 root root 4096 /var
drwxr-xr-x 26 root root 4096 /

That looks correct, the 0100 one has the owner set such that access is allowed.