LXD/LXC on Debian 9

I would like to use LXD on Debian 9 Stretch.

The documentation here is convoluted on confusing: https://wiki.debian.org/LXC though I did get LXC working.

This recipe is not working due to bugs in snapd: https://insights.ubuntu.com/2017/02/22/lxd-on-debian-using-snapd/

I would also prefer to have it native instead of using snapd.

p.s. I like this new forum and prefer it to the mailing list and reddit.

1 Like

Hi,

There is a Debian bug to track packaging of LXD natively here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768073

As for snapd, what error are you getting exactly?

1 Like

Hi - I ran into this: https://bugs.launchpad.net/snappy/+bug/1674193

1 Like

Someone commented on my blog that doing this fixed it for them:

snap install core
snap install lxd

But that may have been just luck/unrelated.

An alternative to all this would be to build it manually using:

go get -v -x github.com/lxc/lxd/lxc
go get -v -x github.com/lxc/lxd/lxd

But that won’t get you the init scripts and distro integration bits that are usually quite useful. Also you’d need to manually update and rebuild all of it every time we change something.

What are the plans for Debian 9? How can I help?

@zhenech looks active in the ITP but it’s too late for Debian 9 as it’s already in full freeze. So for Debian 9 the snap is more likely to work out of the box (once the snapd guys have fixed that bug) and hopefully once LXD makes it to unstable, someone can backport it so that Debian 9 users can use it.

I use this solution without problem. I use this lxd.service (taken from https://linuxcontainers.org/lxd/try-it/) :

root@server:~# cat /etc/systemd/system/lxd.service
[Unit]
Description=LXD - main daemon
After=lxcfs.service
Requires=lxcfs.service

[Service]
EnvironmentFile=-/etc/environment
ExecStartPre=/usr/lib/x86_64-linux-gnu/lxc/lxc-apparmor-load
ExecStart=/usr/local/bin/lxd --group sudo --logfile=/var/log/lxd/lxd.log
ExecStartPost=/usr/local/bin/lxd waitready --timeout=600
KillMode=process
TimeoutStartSec=600s
TimeoutStopSec=30s
Restart=on-failure
LimitNOFILE=1048576
LimitNPROC=infinity
TasksMax=infinity

[Install]
WantedBy=multi-user.target
Alias=lxd.service