LXD Snap on Debian Testing/Buster

I’ve installed snapd 2.29.4 (Debian ships 2.27.6-2 atm.) on Debian Testing/Buster, to install the LXD snap. See Snapd vs upstream kernel vs apparmor for details.

But i’m unable to run lxd via snap:

# /snap/bin/lxd
lxd: error while loading shared libraries: liblxc.so.1: cannot open shared object file: No such file or directory

Additional i see in the logs:

Dec 15 16:21:57 debianbox lxd.daemon[6975]: => Preparing the system
Dec 15 16:21:57 debianbox lxd.daemon[6975]: /snap/lxd/5235/wrappers/daemon.start: 16: /snap/lxd/5235/wrappers/daemon.start: LD_LIBRARY_PATH: parameter not set


set the following aliases in my .bashrc:

alias lxd="SNAP_COMMON=/snap/lxd/common SNAP=/snap/lxd/current /snap/lxd/current/command-lxd.wrapper"
alias lxc="SNAP_COMMON=/snap/lxd/common SNAP=/snap/lxd/current /snap/lxd/current/command-lxc.wrapper"

And install uidmap:

apt install uidmap

also set some sub{u|g}id’s:

echo "root:1000000:1000000000" > /etc/subuid
echo "root:1000000:1000000000" > /etc/subgid

create group lxd:

groupadd -r lxd
usermod -a -G lxd <yourusername>

then start lxd manualy.

lxd --group=lxd

then edit the default profile:

  raw.lxc: |-
    lxc.apparmor.allow_incomplete = 1


Anyone have a clue howto fix this?

I think @stgraber can help, in the future though, asking question about lxd might have faster responses if asked on https://discuss.linuxcontainers.org/c/lxd

I’m pretty sure running the Ubuntu .deb package on Debian isn’t supported.
This likely explains why snap-confine isn’t setting LD_LIBRARY_PATH as it should, which then ends up causing the rest of your issues.

There is no need to install uidmap, configure /etc/subuid or /etc/subgid or install any other package for the LXD snap to work. The fact that you’ve had to resort to such tricks hints that the snap environment is completely wrong on your system.

Debian’s snapd now works great with LXD.