lueschem / edi

Embedded development infrastructure.
https://www.get-edi.io
GNU Lesser General Public License v3.0
39 stars 12 forks source link

error: Missing parent 'lxdbr0' for nic 'lxcif0' #5

Closed erickeller closed 7 years ago

erickeller commented 7 years ago

Environment:

cat /etc/os-release
NAME="Ubuntu"
VERSION="16.10 (Yakkety Yak)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.10"
VERSION_ID="16.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=yakkety
UBUNTU_CODENAME=yakkety
+ python3 --version
Python 3.5.2+
+ ansible-playbook --version
ansible-playbook 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
+ lxc --version
2.4.1
+ dpkg -l
+ grep \(lxd\|ansible\)
ii  ansible                                         2.1.1.0-1                                        all          Configuration management, deployment, and task execution system
ii  lxd                                             2.4.1-0ubuntu1.1                                 amd64        Container hypervisor based on LXC - daemon
ii  lxd-client                                      2.4.1-0ubuntu1.1                                 amd64        Container hypervisor based on LXC - client

Step to reproduce

mkdir my-first-edi-project
cd my-first-edi-project
edi config init my-project raspbian-jessie-armhf
sudo edi -v lxc configure my-first-edi-container my-project-develop.yml

The following error occurs:

Profile privileged_f2c9cc4cc9ef28d536cf created
Success: Created lxc profile privileged_f2c9cc4cc9ef28d536cf.
INFO:root:Running command: ['sudo', '-u', 'mariole', 'lxc', 'profile', 'edit', 'privileged_f2c9cc4cc9ef28d536cf']
Success: The following profiles are now available: lxcif0_0c4a88500d0670949c8f, privileged_f2c9cc4cc9ef28d536cf
Going to launch container.
INFO:root:Running command: ['sudo', '-u', 'mariole', 'lxc', 'launch', 'local:my-project-develop_edicommand_lxc_import', 'my-first-edi-container', '-p', 'lxcif0_0c4a88500d0670949c8f', '-p', 'privileged_f2c9cc4cc9ef28d536cf']
Creating my-first-edi-container
Starting my-first-edi-container
error: Missing parent 'lxdbr0' for nic 'lxcif0'
Try `lxc info --show-log local:my-first-edi-container` for more info
Error: Command '['sudo', '-u', 'mariole', 'lxc', 'launch', 'local:my-project-develop_edicommand_lxc_import', 'my-first-edi-container', '-p', 'lxcif0_0c4a88500d0670949c8f', '-p', 'privileged_f2c9cc4cc9ef28d536cf']' returned non-zero exit status 1
For more information increase the log level.

This is probably done by the default configuration of the lxd package when it's installed as a dependency.

lueschem commented 7 years ago

Thanks for reporting this issue!

From Ubuntu 16.04 to 16.10 the lxc/lxd behavior has changed with regards to networking: "lxc init" does not create lxdbr0 anymore (by default).

As a short term workaround I would suggest to create the bridge manually: lxc network create lxdbr0

edi will probably create the required bridge automatically in the future.

The new networking features of lxc 2.3+ are great: https://stgraber.org/2016/10/27/network-management-with-lxd-2-3/

lueschem commented 7 years ago

Additional findings:

The playbook lxc_networking should always check if {{ edi_lxc_network_interface_name }} was brought up successfully. (Fail early and loud - otherwise a subsequent apt call will fail.)

Given the following nested container setup Ubuntu Xenial host --> Ubuntu Yakkety container --> Debian Jessie Container we hit the "5 bad udp checksums in 5 packets" error when the Jessie container tries to get the ip address using dhcp (see also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717217, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717215). As a workaround the following command can be applied within the Yakkety container: iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill See also: https://github.com/lueschem/edi-ubuntu-yakkety/commit/a5167d3905bdeaaebe7448427db3f1388b3cdbe2

lueschem commented 7 years ago

After some additional tests with Yakkety: When installing lxd on yakkety no lxdbr0 will get created by default. The required bridge will get created by one of the following commands: lxd init or lxc network create lxdbr0

I will improve the error message.