Lxd natively on debian


As I am running debian I have been trying to follow the development process that would enable the native installment of lxd.
To me this means that I would be able to eliminate one more source for problems (snapd) and I think it would also now allow the nesting of containers, presently not possible on Debian.
It would appear that the last remaining issue (according to the bug files) has been resolved and accepted into debian (likely means that at best its in testing and in experimental and most definitely NOT in stable - - - that will be a while - - -:slight_smile: ! ).

So, and this is likely going to land in Monsier Stephane’s lap, any guide to a direct install of lxd on debian for those wanting to try? (Please.)

(Stéphane Graber) #2

As far as upstream is concerned, we’ll keep recommending the use of the snap. That’s much easier for us to build and test and as everyone has the exact same binaries running regardless of distro, makes support very easy for us.

There is indeed an ongoing effort to package LXD natively in Debian which will surely be welcome by those trying to stay away from snaps for a reason or another. My recommendation to the Debian community has been to stick to the LXD LTS releases rather than our monthly feature releases which would be very painful to keep track of.

I believe the current packaging effort is therefore centered around LXD 2.0.x (LTS branch), meaning that you’d be able to get LXD 2.0.10 (or whatever the latest stable release is) natively through Debian but would then need to use the snap for something more recent.


But snapd doesn’t really work on Debian 9. It installs an lxd that cannot start up due to dependency issues around libdqlite and libsqlite3 …

Mind you, I am using a standard kernel … so, this problem will affect all Debian Stretch users

(Stéphane Graber) #4

Hmm, we have automated CI for all snap releases on Debian Stretch and haven’t seen any such problem.


(Bruce) #5

This worked for me in virtualbox and on a KVM server…

# https://docs.snapcraft.io/core/install-debian
# https://linuxcontainers.org/lxd/getting-started-cli/
sudo apt install snapd
sudo apt update
sudo snap install lxd

# add your user to the lxd group
sudo usermod --append --groups lxd [my-user-name]

# add your user to the lxd group
sudo usermod --append --groups lxd [my-user-name]

# then logout and login again to set the changes

# install zfs before running lxd init

# setup lxd
lxd init


Thanks for your suggestions. But, what version of lxd have you successfully installed ?

I have tried all version 3.x available in snapcraft and they all fail. It’s related to libdqlite and lxd’s own customization of libsqlite3. Even using ldd to check dependent libraries, and then symlinking as required did not work.

I suspect that messing around with LD_LIBRARY_PATH would work, but that does not fit my use case …

In the end I went down to --channel=2.0/stable … and that is all I could get to work.

It’s really not practical to use a snap package that expects one to set LD_LIBRARY_PATH for all users … so, I will forget lxd 3.x for this server, until the situation is resolved.


Just seen this … thanks.

I have seen the same issues on at least 2 Debian Stretch servers now, and I am far from a n00b.

Is it possible you have installed the right dependencies before the lxd snap packages, or your CI is setting LD_LIBRARY_PATH before running tests ?

(Stéphane Graber) #8

The snap doesn’t need you to do anything with LD_LIBRARY_PATH and there are no dependencies for the snap to work, the steps that @bruce78 showed above are all that’s needed and that seemed to work fine for him.

(Stéphane Graber) #9

Can you show snap info lxd? One thing that could explain your symptoms is if you somehow passed --classic to snap install as this does a lot of bad things and is why we never instruct people do that.


I never passed classic to it … I am on kernel: Debian 4.9.110-3+deb9u6
‘snap info lxd’ output follows

# snap info lxd
name:      lxd
summary:   System container manager and API
publisher: Canonical✓
contact:   https://github.com/lxc/lxd/issues
license:   unset
description: |
  LXD is a container manager for system containers.

  It offers a REST API to remotely manage containers over the network, using an image based workflow
  and with support for live migration.

  Images are available for all Ubuntu releases and architectures as well as for a wide number of
  other Linux distributions.

  LXD containers are lightweight, secure by default and a great alternative to virtual machines.
  - lxd.benchmark
  - lxd.buginfo
  - lxd.check-kernel
  - lxd.database
  - lxd.lxc
  - lxd
  - lxd.migrate
  lxd.daemon: simple, enabled, active
snap-id:      J60k4JY0HppjwOjW8dZdYc8obXKxujRu
tracking:     2.0/stable
refresh-date: 2 days ago, at 21:36 BST
  stable:        3.6         (9239) 69MB -
  candidate:     3.6         (9239) 69MB -
  beta:          ↑
  edge:          git-9fbdafc (9250) 69MB -
  3.0/stable:    3.0.2       (8715) 65MB -
  3.0/candidate: 3.0.2       (9043) 68MB -
  3.0/beta:      ↑
  3.0/edge:      git-4be2099 (9199) 68MB -
  2.0/stable:    2.0.11      (8023) 28MB -
  2.0/candidate: 2.0.11      (8023) 28MB -
  2.0/beta:      ↑
  2.0/edge:      git-f3e2b11 (9148) 26MB -