Mar 29, 2015

[SOLVED] failed to attach bridge 'virbr0': No such device


LXC is just simple solution to make simple virtual operating system (OS), its like vmware or virtualbox or qemu or any other, but not fully like them, some feature was dropped. More detail about this software, you can check on LXC Ubuntu

for me, its very useful to create demo OpenERP / Odoo to client.

Just a simple solution for those who got lxc container error,


lxc-start: conf.c: instantiate_veth: xxxx failed to attach 'vethxxx' to the bridge 'virbr0': No such device
lxc-start: conf.c: lxc_create_network: 3261 failed to create netdev
lxc-start: start.c: lxc_spawn: 826 failed to create the network
lxc-start: start.c: __lxc_start: 1080 failed to spawn 'test'
lxc-start: lxc_start.c: main: 342 The container failed to start.
lxc-start: lxc_start.c: main: 346 Additional information can be obtained by setting the --logfile and --logpriority options.



Root Cause failed attach the bridge virbr0 or lxcbr0

its because of the container can not create bridge, can be because of your bridge is not created yet, or the network device on container is failed to create.

LXC container does not start solution

check your bridge

  • use ifconfig or brctl to check that your bridge (on Host Server, not on guest) is exist and enable, ensure virbr0
    • brctl show
    • if doen't exists, you can add with brctl addbr virbr0
  •  ensure that guest hwaddr is changed, you need to do this to make guest host initiate from beginning to create networking device. Change it on /var/lib/lxc/(NAME_of_YOUR_CONTAINER)/config
  • ensure that your bridge have IP in the same network of your lxc container and make it Up
    • sudo brctl addbr virbr0
      sudo ifconfig virbr0 10.0.5.1 netmask 255.255.255.0 up



.

LXC is just simple solution to make simple virtual operating system (OS), its like vmware or virtualbox or qemu or any other, but not fully like them, some feature was dropped. More detail about this software, you can check on LXC Ubuntu

for me, its very useful to create demo OpenERP / Odoo to client.

Just a simple solution for those who got lxc container error,


lxc-start: conf.c: instantiate_veth: xxxx failed to attach 'vethxxx' to the bridge 'virbr0': No such device
lxc-start: conf.c: lxc_create_network: 3261 failed to create netdev
lxc-start: start.c: lxc_spawn: 826 failed to create the network
lxc-start: start.c: __lxc_start: 1080 failed to spawn 'test'
lxc-start: lxc_start.c: main: 342 The container failed to start.
lxc-start: lxc_start.c: main: 346 Additional information can be obtained by setting the --logfile and --logpriority options.



Root Cause failed attach the bridge virbr0 or lxcbr0

its because of the container can not create bridge, can be because of your bridge is not created yet, or the network device on container is failed to create.

LXC container does not start solution

check your bridge

  • use ifconfig or brctl to check that your bridge (on Host Server, not on guest) is exist and enable, ensure virbr0
    • brctl show
    • if doen't exists, you can add with brctl addbr virbr0
  •  ensure that guest hwaddr is changed, you need to do this to make guest host initiate from beginning to create networking device. Change it on /var/lib/lxc/(NAME_of_YOUR_CONTAINER)/config
  • ensure that your bridge have IP in the same network of your lxc container and make it Up
    • sudo brctl addbr virbr0
      sudo ifconfig virbr0 10.0.5.1 netmask 255.255.255.0 up


3 comments:

  1. Hey,

    Thanks for your help.

    I am able to create the lxcbr0 card. You have done a awesome job

    ReplyDelete
  2. Hi,

    Thanks for posting that. Solved my problem with lxcbr0

    ReplyDelete
  3. Same in my case it solved, after creating lxcbro.
    I am getting following error now in
    Cent

    [root@blrpc654 network-scripts]# lxc-start -n MCB_Centos
    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.
    [root@blrpc654 network-scripts]# lxc-start -F -n MCB_Centos
    lxc-start: cgfs.c: cgfs_init: 2246 cgroupfs failed to detect cgroup metadata
    lxc-start: start.c: lxc_spawn: 948 failed initializing cgroup support
    lxc-start: start.c: __lxc_start: 1192 failed to spawn 'MCB_Centos'
    lxc-start: lxc_start.c: main: 344 The container failed to start.
    lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options.
    [root@blrpc654 network-scripts]#


    system:
    [root@blrpc654 network-scripts]# cat /etc/issue
    CentOS release 6.7 (Final)
    Kernel \r on an \m

    [root@blrpc654 network-scripts]# uname -a
    Linux blrpc654 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 21:19:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    [root@blrpc654 network-scripts]#

    ReplyDelete