Lxd.lxc-to-lxd in snap on Ubuntu 20.04

Hi, am I doing something incorrectly with lxc-to-lxd here:

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c10 --dry-run
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c10
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$

Does --debug show anything useful?

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c09 --debug --dry-run
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c09
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo ls -l /var/lib/lxc
total 36
drwxrwx— 5 root root 4096 Nov 26 14:56 afns1
drwxr-xr-x 3 root root 4096 Nov 26 02:26 afns1-base
drwxr-xr-x 3 root root 4096 Nov 26 02:27 nsa
drwxrwx— 3 root root 4096 Nov 26 02:54 oel73c10
drwxrwx— 3 root root 4096 Nov 26 15:24 ora73c09
drwxrwx— 3 root root 4096 Nov 26 02:51 ora73c10
drwxrwx— 3 root root 4096 Nov 26 02:52 ora73c11
drwxrwx— 3 root root 4096 Nov 26 02:53 ora73c12
drwxrwx— 3 root root 4096 Nov 26 02:53 ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo ls -l /var/lib/lxc/ora73c09
total 8
-rw-r----- 1 root root 769 Nov 26 15:24 config
drwxr-xr-x 18 root root 4096 Nov 25 07:56 rootfs
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c09 --debug
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c09
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo su -
root@u20sv6:~# cd /var/lib/lxc/ora73c09
root@u20sv6:/var/lib/lxc/ora73c09# cat config

lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = x86_64
lxc.rootfs.path = dir:/var/lib/lxc/ora73c09/rootfs
lxc.uts.name = ora73c09
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:04:5e:3e

root@u20sv6:/var/lib/lxc/ora73c09#

And here is some info on lxd status just in case I have failed to configure or start something correctly.

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo snap info lxd
name: lxd
summary: System container manager and API
publisher: Canonical✓
store-url: https://snapcraft.io/lxd
contact: https://github.com/lxc/lxd/issues
license: unset
description: |
LXD is a system container manager

With LXD you can run hundreds of containers of a variety of Linux
distributions, apply resource limits, pass in directories, USB devices
or GPUs and setup any network and storage you want.

LXD containers are lightweight, secure by default and a great
alternative to running Linux virtual machines.

Run any Linux distribution you want

Pre-made images are available for Ubuntu, Alpine Linux, ArchLinux,
CentOS, Debian, Fedora, Gentoo, OpenSUSE and more.

A full list of available images can be found here: https://images.linuxcontainers.org

Can’t find the distribution you want? It’s easy to make your own images too, either using our
distrobuilder tool or by assembling your own image tarball by hand.

Containers at scale

LXD is network aware and all interactions go through a simple REST API,
making it possible to remotely interact with containers on remote
systems, copying and moving them as you wish.

Want to go big? LXD also has built-in clustering support,
letting you turn dozens of servers into one big LXD server.

Configuration options

Supported options for the LXD snap (snap set lxd KEY=VALUE):
- ceph.builtin: Use snap-specific ceph configuration [default=false]
- criu.enable: Enable experimental live-migration support [default=false]
- daemon.debug: Increases logging to debug level [default=false]
- daemon.group: Group of users that can interact with LXD [default=lxd]
- daemon.preseed: A YAML configuration to feed lxd init on initial start
- lxcfs.pidfd: Start per-container process tracking [default=false]
- lxcfs.loadavg: Start tracking per-container load average [default=false]
- lxcfs.cfs: Consider CPU shares for CPU usage [default=false]
- openvswitch.builtin: Run a snap-specific OVS daemon [default=false]
- shiftfs.enable: Enable shiftfs support [default=auto]

Documentation: https://lxd.readthedocs.io
commands:

  • lxd.benchmark
  • lxd.buginfo
  • lxd.check-kernel
  • lxd.lxc
  • lxd.lxc-to-lxd
  • lxd
  • lxd.migrate
    services:
    lxd.activate: oneshot, enabled, inactive
    lxd.daemon: simple, enabled, active
    snap-id: J60k4JY0HppjwOjW8dZdYc8obXKxujRu
    tracking: latest/stable/ubuntu-20.04
    refresh-date: today at 01:54 UTC
    channels:
    latest/stable: 4.8 2020-11-25 (18402) 73MB -
    latest/candidate: 4.8 2020-11-24 (18402) 73MB -
    latest/beta: ↑
    latest/edge: git-03e7d2b 2020-11-26 (18429) 73MB -
    4.8/stable: 4.8 2020-11-25 (18402) 73MB -
    4.8/candidate: 4.8 2020-11-24 (18402) 73MB -
    4.8/beta: ↑
    4.8/edge: ↑
    4.7/stable: 4.7 2020-11-12 (18251) 72MB -
    4.7/candidate: 4.7 2020-11-12 (18251) 72MB -
    4.7/beta: ↑
    4.7/edge: ↑
    4.0/stable: 4.0.4 2020-11-03 (18150) 71MB -
    4.0/candidate: 4.0.4 2020-11-04 (18165) 71MB -
    4.0/beta: ↑
    4.0/edge: git-7493339 2020-11-25 (18423) 71MB -
    3.0/stable: 3.0.4 2019-10-10 (11348) 55MB -
    3.0/candidate: 3.0.4 2019-10-10 (11348) 55MB -
    3.0/beta: ↑
    3.0/edge: git-81b81b9 2019-10-10 (11362) 55MB -
    2.0/stable: 2.0.12 2020-08-18 (16879) 38MB -
    2.0/candidate: 2.0.12 2020-08-17 (16879) 38MB -
    2.0/beta: ↑
    2.0/edge: git-82c7d62 2020-08-17 (16867) 39MB -
    installed: 4.8 (18402) 73MB -

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ ps -ef | grep lxd

root 82910 1 0 03:23 ? 00:00:00 /bin/sh /snap/lxd/18402/commands/daemon.start
root 83128 1 0 03:23 ? 00:00:00 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/lxcfs.pid
root 83139 82910 0 03:23 ? 00:00:11 lxd --logfile /var/snap/lxd/common/lxd/logs/lxd.log --group lxd
ubuntu 872907 837663 0 15:39 pts/0 00:00:00 grep --color=auto lxd
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$

I also tested creating a container with lxd on this box, and that worked fine no issues. But I still get the error with lxd.lxc-to-lxd:

ubuntu@u20sv6:~$ lxc launch ubuntu:18.04 mycontainer
Creating mycontainer
Starting mycontainer
ubuntu@u20sv6:~$ lxc list
±------------±--------±------------------±----------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±------------±--------±------------------±----------------------------------------------±----------±----------+
| mycontainer | RUNNING | 10.7.59.24 (eth0) | fd42:fd36:cf6d:59c7:216:3eff:fea6:1420 (eth0) | CONTAINER | 0 |
±------------±--------±------------------±----------------------------------------------±----------±----------+
ubuntu@u20sv6:~$ sudo lxc-ls -f
NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
afns1 RUNNING 0 - 10.209.53.2, 172.29.108.2 - false
afns1-base STOPPED 0 - - - false
oel73c10 RUNNING 0 - 172.29.108.10 - false
ora73c09 STOPPED 0 - - - false
ora73c10 RUNNING 0 - 10.209.53.10 - false
ora73c11 RUNNING 0 - 10.209.53.11 - false
ora73c12 RUNNING 0 - 10.209.53.12 - false
ora73c13 RUNNING 0 - 10.209.53.13 - false
ubuntu@u20sv6:~$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c09 --debug
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c09
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~$

https://github.com/lxc/lxd/pull/8196 should take care of this

I still get the same error.

Hold on let me try uninstalling the snap and reinstalling …

I tried uninstalling the snap and reinstalling thinking that perhaps I needed to do that to pick up fix #8196 but still got the same error:

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo snap remove lxd
[sudo] password for ubuntu:
lxd removed
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo snap install lxd
lxd 4.8 from Canonical✓ installed

I also tried a manual snap refresh:

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo snap refresh lxd
snap “lxd” has no updates available

ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c09 --debug
Failed to load config for afns1
Failed to load config for afns1-base
Failed to load config for oel73c10
Failed to load config for ora73c09
Failed to load config for ora73c10
Failed to load config for ora73c11
Failed to load config for ora73c12
Failed to load config for ora73c13
ubuntu@u20sv6:~/Downloads/orabuntu-lxc-master/orabuntu$

Well, you’re going to need this to hit the stable snap first :slight_smile:

We don’t do updates on Friday or over the weekend and didn’t want to rush one yesterday either due to Thanksgiving affecting a lot of our users.

The edge channel should have the fix by now though. So you can try snap refresh lxd --edge

Thanks Stéphane. All good.

ubuntu@u20sv6:~$ sudo snap refresh lxd --edge
lxd (edge) git-fc7a329 from Canonical✓ refreshed
ubuntu@u20sv6:~$ sudo lxd.lxc-to-lxd --lxcpath /var/lib/lxc --containers ora73c09 --debug
Parsing LXC configuration
Container configuration:
lxc.arch = x86_64
lxc.rootfs.path = dir:/var/lib/lxc/ora73c09/rootfs
lxc.uts.name = ora73c09
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:05:0c:7a
Checking for unsupported LXC configuration keys
Checking for existing containers
Checking whether container has already been migrated
Validating whether incomplete AppArmor support is enabled
Validating whether mounting a minimal /dev is enabled
Validating container rootfs
Processing network configuration
Processing storage configuration
Processing environment configuration
Processing container boot configuration
Processing container apparmor configuration
Processing container seccomp configuration
Processing container SELinux configuration
Processing container capabilities configuration
Processing container architecture configuration
LXD container config:
{
“architecture”: “x86_64”,
“config”: {
“security.privileged”: “true”
},
“devices”: {
“eth0”: {
“type”: “none”
},
“net0”: {
“hwaddr”: “00:16:3e:05:0c:7a”,
“nictype”: “bridged”,
“parent”: “lxcbr0”,
“type”: “nic”
}
},
“ephemeral”: false,
“profiles”: [
“default”
],
“stateful”: false,
“description”: “”,
“name”: “ora73c09”,
“source”: {
“type”: “migration”,
“certificate”: “”,
“mode”: “push”
},
“instance_type”: “”
}
Creating container
Container ‘ora73c09’ successfully created
ubuntu@u20sv6:~$ lxc start ora73c09
ubuntu@u20sv6:~$ lxc list
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| ora73c08 | RUNNING | 10.45.31.48 (eth0) | fd42:8488:6b7:f82d:216:3eff:fe71:bafa (eth0) | CONTAINER | 0 |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| ora73c09 | RUNNING | | | CONTAINER | 0 |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
ubuntu@u20sv6:~$ lxc list
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| ora73c08 | RUNNING | 10.45.31.48 (eth0) | fd42:8488:6b7:f82d:216:3eff:fe71:bafa (eth0) | CONTAINER | 0 |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
| ora73c09 | RUNNING | 10.0.3.205 (eth0) | | CONTAINER | 0 |
±---------±--------±-------------------±---------------------------------------------±----------±----------+
ubuntu@u20sv6:~$