Mount namespace problem

I have the following problem with lxd and standard directory backend.

After a restart system doesn’t find a mount folder (with binded mount).

I just remmaped a folder from other device.

Folder is visible in the system but I need to do this and restart the lxd to make the things work

‘’

#!/bin/sh
set -eu

/usr/bin/nsenter --mount=/run/snapd/ns/lxd.mnt – /bin/sh -eu -c ’
src=/home/containers
dst=/var/snap/lxd/common/lxd/storage-pools/default/containers

src_inode=$(/usr/bin/stat -c “%d:%i” “$src”)
dst_inode=$(/usr/bin/stat -c “%d:%i” “$dst”)

if [ “$src_inode” != “$dst_inode” ]; then
/usr/bin/mount --bind “$src” “$dst”
fi

src_inode=$(/usr/bin/stat -c “%d:%i” “$src”)
dst_inode=$(/usr/bin/stat -c “%d:%i” “$dst”)

if [ “$src_inode” != “$dst_inode” ]; then
echo “ERROR: LXD storage bind mount verification failed” >&2
exit 1
fi
’

‘’

This then works but It’s a shitty workaround. I have tried various stuff with AI help but for now no usable stuff better than this workaround.

Any suggestions?

This forum no longer supports lxd - you can attempt to get help at the Canonical forums since they are the custodians of lxd.

Alternatively, you can migrate to incus (which is straightforward unless your lxd is recent) and then get support here.