Missing lxc-to-lxd in snap lxd (ubuntu 20.04)

Hi

I have installed snap lxd instead of the lxd deb package. Because of that the lxd-tools package that contains “lxc-to-lxd” is not installed (or I cannot find it)

I can install the lxd-tool package, but then it will install the lxd deb package, which may conflict/duplicate the lxd snap package.

So where is the lxc-to-lxd package or how can I install it.

We have an issue open to add it to the snap, though it’s always a bit tricky because of some of the confinement.

Until then, you’ll want:

Thanks, but unfortunately the compilation failed:

WORK=/tmp/go-build240292368
gopkg.in/lxc/go-lxc.v2
mkdir -p $WORK/b235/
cd /home/dror/go/src/gopkg.in/lxc/go-lxc.v2
pkg-config --cflags – lxc

pkg-config --cflags – lxc

Package lxc was not found in the pkg-config search path.
Perhaps you should add the directory containing `lxc.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘lxc’ found
pkg-config: exit status 1
github.com/canonical/go-dqlite/internal/bindings
mkdir -p $WORK/b220/
cd /home/dror/go/src/github.com/canonical/go-dqlite/internal/bindings
CGO_LDFLAGS=’"-g" “-O2” “-lsqlite3” “-lraft” “-lco” “-ldqlite”’ /snap/go/5646/pkg/tool/linux_amd64/cgo -objdir $WORK/b220/ -importpath github.com/canonical/go-dqlite/internal/bindings – -I $WORK/b220/ -g -O2 ./build.go ./server.go
github.com/lxc/lxd/shared/idmap
mkdir -p $WORK/b226/
cd /home/dror/go/src/github.com/lxc/lxd/shared/idmap
CGO_LDFLAGS=’"-g" “-O2” “-lacl”’ /snap/go/5646/pkg/tool/linux_amd64/cgo -objdir $WORK/b226/ -importpath github.com/lxc/lxd/shared/idmap – -I $WORK/b226/ -g -O2 -std=gnu11 -Wvla -Werror -fvisibility=hidden -Winit-self -Wformat=2 -Wshadow -Wendif-labels -fasynchronous-unwind-tables -pipe --param=ssp-buffer-size=4 -g -Wunused -Werror=implicit-function-declaration -Werror=return-type -Wendif-labels -Werror=overflow -Wnested-externs -fexceptions ./cgo.go ./shift_linux.go

github.com/canonical/go-dqlite/internal/bindings

go/src/github.com/canonical/go-dqlite/internal/bindings/server.go:11:10: fatal error: dqlite.h: No such file or directory
11 | #include <dqlite.h>
| ^~~~~~~~~~
compilation terminated.

github.com/lxc/lxd/shared/idmap

go/src/github.com/lxc/lxd/shared/idmap/shift_linux.go:30:10: fatal error: sys/capability.h: No such file or directory
30 | #include <sys/capability.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.

Also:

go install -v -x github.com/canonical/go-dqlite

mkdir -p $WORK/b108/
cd /home/dror/go/src/github.com/canonical/go-dqlite/internal/bindings
CGO_LDFLAGS=’"-g" “-O2” “-lsqlite3” “-lraft” “-lco” “-ldqlite”’ /snap/go/5646/pkg/tool/linux_amd64/cgo -objdir $WORK/b108/ -importpath github.com/canonical/go-dqlite/internal/bindings – -I $WORK/b108/ -g -O2 ./build.go ./server.go

github.com/canonical/go-dqlite/internal/bindings

…/…/go/src/github.com/canonical/go-dqlite/internal/bindings/server.go:11:10: fatal error: dqlite.h: No such file or directory
11 | #include <dqlite.h>
| ^~~~~~~~~~
compilation terminated.

lxd.lxc-to-lxd is now available in the snap

1 Like

Thanks. The conversion was done, but the following entries in the lxc config items did not show up in the new lxd config. Do I need to add them manually?
non of the cgroup entries showed up and the lxc.mount.auto did not who up.

lxc.mount.auto=proc:rw sys:ro cgroup:ro
lxc.cgroup.devices.allow =
lxc.cgroup.devices.deny =
lxc.cgroup.devices.allow = c 254:0 rm
lxc.cgroup.devices.allow = c 10:200 rwm
lxc.cgroup.devices.allow = c 10:228 rwm
lxc.cgroup.devices.allow = c 10:232 rwm
lxc.cgroup.devices.allow = c 116:* rwm
lxc.cgroup.devices.allow = c 226:* rwm
lxc.cgroup.devices.allow = c 29:0 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
lxc.cgroup.devices.allow = c 4:2 rwm
lxc.cgroup.devices.allow = c 4:3 rwm
lxc.cgroup.devices.allow = c 4:4 rwm
lxc.cgroup.devices.allow = c 4:5 rwm
lxc.cgroup.devices.allow = c 4:6 rwm
lxc.cgroup.devices.allow = c 4:7 rwm
lxc.cgroup.devices.allow = c 4:8 rwm
lxc.cgroup.devices.allow = c 4:9 rwm
lxc.cgroup.devices.allow = c 4:10 rwm
lxc.cgroup.devices.allow = c 13:* rwm
lxc.cgroup.devices.allow = c 44:226 rwm
lxc.cgroup.devices.allow = c 195:* rwm
lxc.cgroup.devices.allow = c 195:254 rwm
lxc.cgroup.devices.allow = c 195:255 rwm
lxc.cgroup.devices.allow = c 246:0 rwm
lxc.cgroup.devices.allow = c 241:0 rwm

my raw.lxc has the following only

config:
boot.autostart.delay: “14”
boot.autostart.priority: “7”
raw.lxc: |
lxc.apparmor.profile=unconfined
lxc.tty.max=2
lxc.pty.max=1024
security.privileged: “true”

Ah yeah, you should copy those across.

You could likely replace a bunch of those by unix-char devices instead though.