Snap kills my pool mount idea

I have a BTRFS pool file which was automatically mounted on LXD before migration to snapd. On this very pool I have a user’ subvolume, I previously mounted at container’s rootfs/home/user/ folder. This user-folder was bind-mounted on my Documents so I could edit the files in the container’s homedir. The idea doesn’t work anymore. It’s still possible to mount everything the old way, BUT nothing gets visible in the container’s user folder. Any ideas?

I’m not sure I follow exactly what’s the problem you’re trying to fix.

But one thing that may help you is to look at /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/ which will show the mounts that are normally invisible due to the snap mount namespace.

Hello Stéphane

root@malix:~# lxc list
| a1-edge | RUNNING | (eth0) | fd42:d1da:7a85:db01:216:3eff:feff:ed27 (eth0) | PERSISTENT | |
root@malix:~# lxc storage list
| pool1 | | btrfs | /var/snap/lxd/common/lxd/disks/pool1.img | 2 |

Thing is I can’t find any docs, all I get now is man snap, which doesn’t tell me about LXD. What you mentioned shows me:
root@malix:~# lh /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/pool1/
total 0
drwx–x--x 1 root root 14 mar 17 2018 containers
drwx–x--x 1 root root 0 mar 17 2018 custom
drwx------ 1 root root 0 mar 28 2018 images
drwxr-xr-x 1 marko marko 16 wrz 23 14:03 @marko
drwx------ 1 root root 0 mar 17 2018 snapshots

@marko is the subvolume mentioned in the previous post which I want to mount in /var/snap/lxd/…/containers/a1-edge/rootfs/home/marko/ and this mount is not visible.
root@malix:~# lh /var/snap/lxd/common/lxd/containers/a1-edge/rootfs/home/marko/
total 0
drwxrwxr-x 1 marko marko 426 paź 5 01:23 main-www
root@malix:~# lxc shell a1-edge
a1-edge:~# ls -l /home/marko/
total 0

Ii tried to mount this subvolume in /var/snap/lxd/common/mntns/home/marko/ but it was mounted in my homedir (same username) instead of the container’s! I simply don’t know where this rootfs gets mounted now as I updated my container after migration and these changes don’t reflect the rootfs in the pool1.

The easiest may be to do:

lxc config device add a1-edge marko disk source=/var/snap/lxd/common/lxd/storage-pools/pool1/@marko path=/home/marko

Which will then have LXD handle mounting this on container startup.

Thank you, it works, but not as I would expected. The difference now is the container does not start by default (as it did before) due to pool1 not being mounted on startup. I still lack the docs!

root@malix:~# lxc start a1-edge
root@malix:~# lxc config get a1-edge

root@malix:~# lxc shell a1-edge
a1-edge:~# ls -l /home/marko/
total 0
drwxrwxr-x 1 nobody nobody 426 Oct 4 23:23 main-www

lxc config get a1-edge gives me nothing and the IP has changed!

What on earth is the key responsible for this? W/o docs I tried several potential ones and still got only ‘not found’ error message!
I’m sitting on Ubuntu, are they responsible for ‘man lxc’ being missing?

lxc config show a1-edge and lxc config show --expanded a1-edge will show you the container config.

Snap packages can’t currently ship manpages, though even if they could, LXD’s manpages are just auto-generated from the CLI help, so you’ll get the same information by running --help for the various level of CLI commands with the rest (config keys and such) covered at

I’m not sure we understand one another as lxc config show doesn’t show what I expected :slight_smile: or it shows very little.
As I said before IP of the container changed while adding the subvol (disk). Cannot understand why is this even related :wink: and yes I can set up a fixed IP but don’t like such solution. So the question remains: how can I set IP of a container to a value I like. This address is known on my network and some other machines need it. Needless to say it’s more convenient to change the container instead of having to reconfigure those PCs.

Finally I ditched everything. Don’t like the snap idea, adding this extra disk regenerated everything, that’s why IP was changed - it just added another ‘layer’ of the container, /dev/loop devices doubled, eating the resources. NO, thanks, it’s really bad idea.

1 Like