4

I wanted to start experimenting with containers, so I followed this tutorial and did:

sudo apt-get install lxd lxd-client zfsutils-linux
sudo lxd init

and answered the questions as follows

Do you want to configure a new storage pool (yes/no) [default=yes]? yes
Name of the storage backend to use (dir or zfs) [default=zfs]: zfs
Create a new ZFS pool (yes/no) [default=yes]? yes
Name of the new ZFS pool [default=lxd]: lxd
Would you like to use an existing block device (yes/no) [default=no]? no
Size in GB of the new loop device (1GB minimum) [default=20]: 20
Would you like LXD to be available over the network (yes/no) [default=no]? no
Do you want to configure the LXD bridge (yes/no) [default=yes]? yes
---- following questions in a whiptail window (always accepting defaults)
Would you like to setup a network bridge for LXD containers now? yes
Bridge interface name? lxdbr0
Do you want to setup an IPv4 subnet? yes
IPv4 network address? 10.12.8.1
IPv4 CIDR mask? 24
First DHCP address? 10.12.8.2
Last DHCP address? 10.12.8.254
Max number of DHCP clients? 252
Do you want to NAT the IPv4 traffic? yes
Do you want to setup an IPv6 subnet? no

after which the command ends successfully with

Warning: Stopping lxd.service, but it can still be activated by:
  lxd.socket
LXD has been successfully configured.

Now to test the first container:

lxc launch ubuntu:x test
lxc list

of which the output is

+------+---------+------+------+------------+-----------+
| NAME |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+------+---------+------+------+------------+-----------+
| test | RUNNING |      |      | PERSISTENT | 0         |
+------+---------+------+------+------------+-----------+

and obviously the container has no network access. So I started looking for a solution: there are many reports of similar issues, like this, this or this, but none of them seem to help in my case.

System info, in case it can be useful:

matpen@ubuntu:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
matpen@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
matpen@ubuntu:~$ lxc --version
2.0.11
matpen@ubuntu:~$ lxc profile show default
config:
  environment.http_proxy: ""
  user.network_mode: dhcp
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: lxdbr0
    type: nic
name: default
used_by: []
matpen@ubuntu:~$ ifconfig
enp2s0    Link encap:Ethernet  HWaddr 00:25:22:8f:49:82  
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fd1d:9e7b:b584::da3/128 Scope:Global
          inet6 addr: fd1d:9e7b:b584:0:5d78:aa1e:1955:9bc0/64 Scope:Global
          inet6 addr: fe80::f449:e467:b182:4668/64 Scope:Link
          inet6 addr: fd1d:9e7b:b584:0:60ab:f8f4:f1dc:eb1e/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248459 errors:0 dropped:0 overruns:0 frame:0
          TX packets:167050 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:315015380 (315.0 MB)  TX bytes:34408870 (34.4 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6405 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6405 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:595013 (595.0 KB)  TX bytes:595013 (595.0 KB)

lxdbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:10.12.8.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::fc06:77ff:fe8f:f471/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25968 (25.9 KB)  TX bytes:14451 (14.4 KB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
matpen
  • 331

1 Answers1

0

After many experiments and confronting with the experts, we are still not sure what causes this misbehavior.

However, the solution was simply to upgrade to LXD 3.0 using the snap package, by following these instructions.

matpen
  • 331