Friday, April 5, 2019

Linux Containers -- failed to attach to the bridge 'lxcbr0': Operation not permitted


While starting a Linux container originated for the lxc-oracle template you get errors similar to below:

# lxc-start -n racnode3 -d -o /container/racnode3_debug.log -l DEBUG
lxc-start: lxc_start.c: main: 344 The container failed to start.
lxc-start: lxc_start.c: main: 346 To get more details, run the container in foreground mode.
lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.

Checking the log file /container/racnode3_debug.log you identify the root cause:

lxc-start 1554454977.813 ERROR    lxc_conf - conf.c:instantiate_veth:2801 - failed to attach 'vethOR2RHO' to the bridge 'lxcbr0': Operation not permitted
      lxc-start 1554454977.831 ERROR    lxc_conf - conf.c:lxc_create_network:3084 - failed to create netdev
      lxc-start 1554454977.831 ERROR    lxc_start - start.c:lxc_spawn:935 - failed to create the network
      lxc-start 1554454977.831 ERROR    lxc_start - start.c:__lxc_start:1192 - failed to spawn 'racnode3'


As per documentation lxc-oracle template script should set bridge ( to virbr0. 

Check what bridge interfaces do you have in the system:

# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.5254005aedff       yes             virbr0-nic

To solve the problem you may either add lxcbr0 bridge or modify the configuration of the container: 

# vi /container/racnode3/config = virbr0

No comments: