I want to access files in a container from the host using the ‘lxc file mount’ command. I’m using the lxd 5.0 snap package.
There are a few problems:
- I cannot access the user’s home directory at all because the lxd snap provides no plug for home:
$ snap connections lxd
Interface Plug Slot Notes
lxd - lxd:lxd -
lxd-support lxd:lxd-support :lxd-support -
network lxd:network :network -
network-bind lxd:network-bind :network-bind -
system-observe lxd:system-observe :system-observe -
- If I try to do this with a path in the snap, it doesn’t work either:
23298.pts-0.vm-121 user@vm-121 2023-12-28 14:33:47 ~/certs $ lxc file mount container/etc/repo /certs/source
Error: stat /var/lib/snapd/hostfs/certs/source: no such file or directory
23298.pts-0.vm-121 user@vm-121 2023-12-28 14:35:17 ~/certs $ sudo lxc file mount container/etc/repo /certs/source
[sudo] password for user:
Error: stat /var/lib/snapd/hostfs/certs/source: no such file or directory
23298.pts-0.vm-121 user@vm-121 2023-12-28 14:35:40 ~/certs $ ls -liah /var/lib/snapd/hostfs/certs/
total 16K
393221 drwxr-xr-x 4 user user 4.0K Dec 28 14:16 .
23434 drwxr-xr-x 3 root root 4.0K Dec 28 14:15 ..
393386 drwxrwxr-x 2 user user 4.0K Dec 28 14:16 source
393587 drwxrwxr-x 2 user user 4.0K Dec 28 14:16 target
23298.pts-0.vm-121 user@vm-121 2023-12-28 14:36:01 ~/certs $ ls -liah /var/lib/snapd/hostfs/certs/source
total 8.0K
393386 drwxrwxr-x 2 user user 4.0K Dec 28 14:16 .
393221 drwxr-xr-x 4 user user 4.0K Dec 28 14:16 ..
This is probably because I am misunderstanding how snap namespaces work. Can you help me get this to work?