Trying to run ovn inside lxd containers using either microovn or the lxd samble setup. The steps I’ve tried are below.
First I’ll show the default profile I’m running.
$ lxc profile show default
config:
cloud-init.vendor-data: |-
#cloud-config
package_update: true
package_upgrade: true
timezone: America/Fortaleza
limits.cpu.allowance: 100%
limits.memory: 2GiB
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: br0
type: nic
root:
path: /
pool: local
size: 20GiB
type: disk
name: default
I’ll make 4 attempts at running ovn. All fail in one way or another. It seems to fail due to some security measure, so the attempts I’ll reproduce are all with security.nesting=true. Attempts 2 and 4 go a step further and set security.privileged=true.
- On attempts 1 and 2, I try to install microovn and run
microovn cluster bootstrap
. This fails on attempt 1. - On attempt 2, microovn doen’t even install.
- On attempts 3 and 4 I try to install ovn-host and ovn-central through apt. They fail similarly not being able to start the openvswitch service.
Is there some security feature I can allow so ovn can be run from a container?
The 4 attempts are shown below:
Attempt 1
$ lxc delete -f ovn && lxc launch ubuntu:22.04 ovn -c security.nesting=true && lxc exec ovn -- cloud-init status --wait && lxc exec ovn snap install microovn && lxc exec ovn microovn cluster bootstrap
Creating ovn
Starting ovn
............................................................................................
status: done
microovn 0+git.f8a4497 from Canonical✓ installed
Error: Post "http://control.socket/cluster/control": context deadline exceeded
Attempt 2
$ lxc delete -f ovn && lxc launch ubuntu:22.04 ovn -c security.nesting=true -c security.privileged=true && lxc exec ovn -- cloud-init status --wait && lxc exec ovn snap install microovn
Creating ovn
Starting ovn
..............................................................................................................
status: done
error: cannot perform the following tasks:
- Setup snap "microovn" (91) security profiles (cannot setup udev for snap "microovn": cannot reload udev rules: exit status 1
udev output:
Failed to send reload request: No such file or directory
)
- Setup snap "microovn" (91) security profiles (cannot reload udev rules: exit status 1
udev output:
Failed to send reload request: No such file or directory
)
- Setup snap "microovn" (91) security profiles for auto-connections (cannot reload udev rules: exit status 1
udev output:
Failed to send reload request: No such file or directory
)
Attempt 3
$ lxc delete -f ovn && lxc launch images:ubuntu/22.04/cloud ovn -c security.nesting=true && lxc exec ovn -- cloud-init status --wait && lxc exec ovn -- apt install ovn-host ovn-central -y
Creating ovn
Starting ovn
.........................
status: done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libevent-2.1-7 libunbound8 openvswitch-common openvswitch-switch ovn-common python3-openvswitch python3-sortedcontainers uuid-runtime
Suggested packages:
ethtool openvswitch-doc python-sortedcontainers-doc
The following NEW packages will be installed:
libevent-2.1-7 libunbound8 openvswitch-common openvswitch-switch ovn-central ovn-common ovn-host python3-openvswitch python3-sortedcontainers uuid-runtime
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 5107 kB of archives.
After this operation, 16.7 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 uuid-runtime amd64 2.37.2-4ubuntu3 [32.2 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-2.1-7 amd64 2.1.12-stable-1build3 [148 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libunbound8 amd64 1.13.1-1ubuntu5.3 [395 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-sortedcontainers all 2.1.0-2 [27.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openvswitch-common amd64 2.17.7-0ubuntu0.22.04.1 [933 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-openvswitch all 2.17.7-0ubuntu0.22.04.1 [100 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openvswitch-switch amd64 2.17.7-0ubuntu0.22.04.1 [1536 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-common amd64 22.03.2-0ubuntu0.22.04.1 [880 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-central amd64 22.03.2-0ubuntu0.22.04.1 [341 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-host amd64 22.03.2-0ubuntu0.22.04.1 [713 kB]
Fetched 5107 kB in 2s (3399 kB/s)
Selecting previously unselected package uuid-runtime.
(Reading database ... 19751 files and directories currently installed.)
Preparing to unpack .../0-uuid-runtime_2.37.2-4ubuntu3_amd64.deb ...
Unpacking uuid-runtime (2.37.2-4ubuntu3) ...
Selecting previously unselected package libevent-2.1-7:amd64.
Preparing to unpack .../1-libevent-2.1-7_2.1.12-stable-1build3_amd64.deb ...
Unpacking libevent-2.1-7:amd64 (2.1.12-stable-1build3) ...
Selecting previously unselected package libunbound8:amd64.
Preparing to unpack .../2-libunbound8_1.13.1-1ubuntu5.3_amd64.deb ...
Unpacking libunbound8:amd64 (1.13.1-1ubuntu5.3) ...
Selecting previously unselected package python3-sortedcontainers.
Preparing to unpack .../3-python3-sortedcontainers_2.1.0-2_all.deb ...
Unpacking python3-sortedcontainers (2.1.0-2) ...
Selecting previously unselected package openvswitch-common.
Preparing to unpack .../4-openvswitch-common_2.17.7-0ubuntu0.22.04.1_amd64.deb ...
Unpacking openvswitch-common (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package python3-openvswitch.
Preparing to unpack .../5-python3-openvswitch_2.17.7-0ubuntu0.22.04.1_all.deb ...
Unpacking python3-openvswitch (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package openvswitch-switch.
Preparing to unpack .../6-openvswitch-switch_2.17.7-0ubuntu0.22.04.1_amd64.deb ...
Unpacking openvswitch-switch (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-common.
Preparing to unpack .../7-ovn-common_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-common (22.03.2-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-central.
Preparing to unpack .../8-ovn-central_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-central (22.03.2-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-host.
Preparing to unpack .../9-ovn-host_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-host (22.03.2-0ubuntu0.22.04.1) ...
Setting up python3-sortedcontainers (2.1.0-2) ...
Setting up python3-openvswitch (2.17.7-0ubuntu0.22.04.1) ...
Setting up libevent-2.1-7:amd64 (2.1.12-stable-1build3) ...
Setting up uuid-runtime (2.37.2-4ubuntu3) ...
Adding group `uuidd' (GID 113) ...
Done.
Warning: The home dir /run/uuidd you specified can't be accessed: No such file or directory
Adding system user `uuidd' (UID 106) ...
Adding new user `uuidd' (UID 106) with group `uuidd' ...
Not creating home directory `/run/uuidd'.
Created symlink /etc/systemd/system/sockets.target.wants/uuidd.socket → /lib/systemd/system/uuidd.socket.
uuidd.service is a disabled or a static unit, not starting it.
Setting up libunbound8:amd64 (1.13.1-1ubuntu5.3) ...
Setting up ovn-common (22.03.2-0ubuntu0.22.04.1) ...
Setting up openvswitch-common (2.17.7-0ubuntu0.22.04.1) ...
Setting up openvswitch-switch (2.17.7-0ubuntu0.22.04.1) ...
update-alternatives: using /usr/lib/openvswitch-switch/ovs-vswitchd to provide /usr/sbin/ovs-vswitchd (ovs-vswitchd) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/openvswitch-switch.service → /lib/systemd/system/openvswitch-switch.service.
Created symlink /etc/systemd/system/openvswitch-switch.service.requires/ovs-record-hostname.service → /lib/systemd/system/ovs-record-hostname.service.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
A dependency job for openvswitch-switch.service failed. See 'journalctl -xe' for details.
invoke-rc.d: initscript openvswitch-switch, action "start" failed.
○ openvswitch-switch.service - Open vSwitch
Loaded: loaded (/lib/systemd/system/openvswitch-switch.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Jul 11 16:32:34 ovn systemd[1]: Dependency failed for Open vSwitch.
Jul 11 16:32:34 ovn systemd[1]: openvswitch-switch.service: Job openvswitch-switch.service/start failed with result 'dependency'.
dpkg: error processing package openvswitch-switch (--configure):
installed openvswitch-switch package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of ovn-host:
ovn-host depends on openvswitch-switch (>= 2.17.0~); however:
Package openvswitch-switch is not configured yet.
dpkg: error processing package ovn-host (--configure):
dependency problems - leaving unconfigured
Setting up ovn-central (22.03.2-0ubuntu0.22.04.1) ...
Created symlink /etc/systemd/system/ovn-sb-ovsdb.service → /lib/systemd/system/ovn-ovsdb-server-sb.service.
Created symlink /etc/systemd/system/ovn-nb-ovsdb.service → /lib/systemd/system/ovn-ovsdb-server-nb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ovn-central.service → /lib/systemd/system/ovn-central.service.
ovn-northd.service is a disabled or a static unit, not starting it.
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Errors were encountered while processing:
openvswitch-switch
ovn-host
E: Sub-process /usr/bin/dpkg returned an error code (1)
Attempt 4
$ lxc delete -f ovn && lxc launch images:ubuntu/22.04/cloud ovn -c security.nesting=true -c security.privileged=true && lxc exec ovn -- cloud-init status --wait && lxc exec ovn -- apt install ovn-host ovn-central -y
Creating ovn
Starting ovn
......................
status: done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libevent-2.1-7 libunbound8 openvswitch-common openvswitch-switch ovn-common python3-openvswitch python3-sortedcontainers uuid-runtime
Suggested packages:
ethtool openvswitch-doc python-sortedcontainers-doc
The following NEW packages will be installed:
libevent-2.1-7 libunbound8 openvswitch-common openvswitch-switch ovn-central ovn-common ovn-host python3-openvswitch python3-sortedcontainers uuid-runtime
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 5107 kB of archives.
After this operation, 16.7 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 uuid-runtime amd64 2.37.2-4ubuntu3 [32.2 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libevent-2.1-7 amd64 2.1.12-stable-1build3 [148 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libunbound8 amd64 1.13.1-1ubuntu5.3 [395 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 python3-sortedcontainers all 2.1.0-2 [27.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openvswitch-common amd64 2.17.7-0ubuntu0.22.04.1 [933 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-openvswitch all 2.17.7-0ubuntu0.22.04.1 [100 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 openvswitch-switch amd64 2.17.7-0ubuntu0.22.04.1 [1536 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-common amd64 22.03.2-0ubuntu0.22.04.1 [880 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-central amd64 22.03.2-0ubuntu0.22.04.1 [341 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ovn-host amd64 22.03.2-0ubuntu0.22.04.1 [713 kB]
Fetched 5107 kB in 2s (3056 kB/s)
Selecting previously unselected package uuid-runtime.
(Reading database ... 19751 files and directories currently installed.)
Preparing to unpack .../0-uuid-runtime_2.37.2-4ubuntu3_amd64.deb ...
Unpacking uuid-runtime (2.37.2-4ubuntu3) ...
Selecting previously unselected package libevent-2.1-7:amd64.
Preparing to unpack .../1-libevent-2.1-7_2.1.12-stable-1build3_amd64.deb ...
Unpacking libevent-2.1-7:amd64 (2.1.12-stable-1build3) ...
Selecting previously unselected package libunbound8:amd64.
Preparing to unpack .../2-libunbound8_1.13.1-1ubuntu5.3_amd64.deb ...
Unpacking libunbound8:amd64 (1.13.1-1ubuntu5.3) ...
Selecting previously unselected package python3-sortedcontainers.
Preparing to unpack .../3-python3-sortedcontainers_2.1.0-2_all.deb ...
Unpacking python3-sortedcontainers (2.1.0-2) ...
Selecting previously unselected package openvswitch-common.
Preparing to unpack .../4-openvswitch-common_2.17.7-0ubuntu0.22.04.1_amd64.deb ...
Unpacking openvswitch-common (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package python3-openvswitch.
Preparing to unpack .../5-python3-openvswitch_2.17.7-0ubuntu0.22.04.1_all.deb ...
Unpacking python3-openvswitch (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package openvswitch-switch.
Preparing to unpack .../6-openvswitch-switch_2.17.7-0ubuntu0.22.04.1_amd64.deb ...
Unpacking openvswitch-switch (2.17.7-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-common.
Preparing to unpack .../7-ovn-common_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-common (22.03.2-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-central.
Preparing to unpack .../8-ovn-central_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-central (22.03.2-0ubuntu0.22.04.1) ...
Selecting previously unselected package ovn-host.
Preparing to unpack .../9-ovn-host_22.03.2-0ubuntu0.22.04.1_amd64.deb ...
Unpacking ovn-host (22.03.2-0ubuntu0.22.04.1) ...
Setting up python3-sortedcontainers (2.1.0-2) ...
Setting up python3-openvswitch (2.17.7-0ubuntu0.22.04.1) ...
Setting up libevent-2.1-7:amd64 (2.1.12-stable-1build3) ...
Setting up uuid-runtime (2.37.2-4ubuntu3) ...
Adding group `uuidd' (GID 113) ...
Done.
Warning: The home dir /run/uuidd you specified can't be accessed: No such file or directory
Adding system user `uuidd' (UID 106) ...
Adding new user `uuidd' (UID 106) with group `uuidd' ...
Not creating home directory `/run/uuidd'.
Created symlink /etc/systemd/system/sockets.target.wants/uuidd.socket → /lib/systemd/system/uuidd.socket.
uuidd.service is a disabled or a static unit, not starting it.
Setting up libunbound8:amd64 (1.13.1-1ubuntu5.3) ...
Setting up ovn-common (22.03.2-0ubuntu0.22.04.1) ...
Setting up openvswitch-common (2.17.7-0ubuntu0.22.04.1) ...
Setting up openvswitch-switch (2.17.7-0ubuntu0.22.04.1) ...
update-alternatives: using /usr/lib/openvswitch-switch/ovs-vswitchd to provide /usr/sbin/ovs-vswitchd (ovs-vswitchd) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/openvswitch-switch.service → /lib/systemd/system/openvswitch-switch.service.
Created symlink /etc/systemd/system/openvswitch-switch.service.requires/ovs-record-hostname.service → /lib/systemd/system/ovs-record-hostname.service.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
A dependency job for openvswitch-switch.service failed. See 'journalctl -xe' for details.
invoke-rc.d: initscript openvswitch-switch, action "start" failed.
○ openvswitch-switch.service - Open vSwitch
Loaded: loaded (/lib/systemd/system/openvswitch-switch.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Jul 11 16:34:09 ovn systemd[1]: Dependency failed for Open vSwitch.
Jul 11 16:34:09 ovn systemd[1]: openvswitch-switch.service: Job openvswitch-switch.service/start failed with result 'dependency'.
dpkg: error processing package openvswitch-switch (--configure):
installed openvswitch-switch package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of ovn-host:
ovn-host depends on openvswitch-switch (>= 2.17.0~); however:
Package openvswitch-switch is not configured yet.
dpkg: error processing package ovn-host (--configure):
dependency problems - leaving unconfigured
Setting up ovn-central (22.03.2-0ubuntu0.22.04.1) ...
Created symlink /etc/systemd/system/ovn-sb-ovsdb.service → /lib/systemd/system/ovn-ovsdb-server-sb.service.
Created symlink /etc/systemd/system/ovn-nb-ovsdb.service → /lib/systemd/system/ovn-ovsdb-server-nb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ovn-central.service → /lib/systemd/system/ovn-central.service.
ovn-northd.service is a disabled or a static unit, not starting it.
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Errors were encountered while processing:
openvswitch-switch
ovn-host
E: Sub-process /usr/bin/dpkg returned an error code (1)