Hi guys.I’m trying to run a container using the command
sudo lxc-start mycontainer
but the container failes to start and the command give me this message error:
lxc-start: mycontainer: lxccontainer.c: wait_on_daemonized_start: 877 Received container state "ABORTING" instead of "RUNNING"
lxc-start: mycontainer: tools/lxc_start.c: main: 306 The container failed to start
lxc-start: mycontainer: tools/lxc_start.c: main: 309 To get more details, run the container in foreground mode
lxc-start: mycontainer: tools/lxc_start.c: main: 311 Additional information can be obtained by setting the --logfile and --logpriority options
So, I run the container in foreground mode as specified by the above message and it gives me more information about the error:
lxc-start: mycontainer: network.c: netdev_configure_server_veth: 711 No such file or directory - Failed to attach "vethC1QWRX" to bridge "lxcbr0", bridge interface doesn't exist
lxc-start: mycontainer: network.c: lxc_create_network_priv: 3427 No such file or directory - Failed to create network device
lxc-start: mycontainer: start.c: lxc_spawn: 1843 Failed to create the network
lxc-start: mycontainer: start.c: __lxc_start: 2074 Failed to spawn container "mycontainer"
lxc-start: mycontainer: tools/lxc_start.c: main: 306 The container failed to start
lxc-start: mycontainer: tools/lxc_start.c: main: 311 Additional information can be obtained by setting the --logfile and --logpriority options
I tried to create the lxcbr0 (which is missing) by using thi commands:
sudo ip link add name lxcbr0 type bridge
sudo ip addr add 10.0.3.1/24 dev lxcbr0
sudo ip link set lxcbr0 up
and configure the /etc/lxc/lxc-usernet file as follow
# USERNAME TYPE BRIDGE COUNT
spena veth lxcbr0 2
Unfortunately nothing as changed. Do you have an idea ? Can anyone help me ?
Below I write my system configuration:
-
Virtual machine with ubuntu 22.04
-
Linux kernel 5.15.52-dfl
-
/etc/default/lxc-net file
# This file is auto-generated by lxc.postinst if it does not
# exist. Customizations will not be overridden.
# Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
# containers. Set to "false" if you'll use virbr0 or another existing
# bridge, or mavlan to your host's NIC.
USE_LXC_BRIDGE="true"
# If you change the LXC_BRIDGE to something other than lxcbr0, then
# you will also need to update your /etc/lxc/default.conf as well as the
# configuration (/var/lib/lxc/<container>/config) for any containers
# already created using the default config to reflect the new bridge
# name.
# If you have the dnsmasq daemon installed, you'll also have to update
# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
LXC_BRIDGE="lxcbr0"
LXC_ADDR="10.0.3.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.3.0/24"
LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"
LXC_DHCP_MAX="253"
# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
# container 'mail1' always get ip address 10.0.3.100.
#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
# Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
# domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
# to your system dnsmasq configuration file (normally /etc/dnsmasq.conf,
# or /etc/NetworkManager/dnsmasq.d/lxc.conf on systems that use NetworkManager).
# Once these changes are made, restart the lxc-net and network-manager services.
# 'container1.lxc' will then resolve on your host.
#LXC_DOMAIN="lxc"
- /etc/default/lxc file
# LXC_AUTO - whether or not to start containers at boot
LXC_AUTO="true"
# BOOTGROUPS - What groups should start on bootup?
# Comma separated list of groups.
# Leading comma, trailing comma or embedded double
# comma indicates when the NULL group should be run.
# Example (default): boot the onboot group first then the NULL group
BOOTGROUPS="onboot,"
# SHUTDOWNDELAY - Wait time for a container to shut down.
# Container shutdown can result in lengthy system
# shutdown times. Even 5 seconds per container can be
# too long.
SHUTDOWNDELAY=5
# OPTIONS can be used for anything else.
# If you want to boot everything then
# options can be "-a" or "-a -A".
OPTIONS=
# STOPOPTS are stop options. The can be used for anything else to stop.
# If you want to kill containers fast, use -k
STOPOPTS="-a -A -s"
USE_LXC_BRIDGE="true" # overridden in lxc-net
[ ! -f /etc/default/lxc-net ] || . /etc/default/lxc-net
- lxc-checkconfig
LXC version 5.0.0
Kernel configuration not found at /proc/config.gz; searching...
Kernel configuration found at /boot/config-5.15.52-dfl
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
--- Control groups ---
Cgroups: enabled
Cgroup namespace: enabled
Cgroup v1 mount points:
/sys/fs/cgroup/systemd
/sys/fs/cgroup/net_cls,net_prio
/sys/fs/cgroup/cpu,cpuacct
/sys/fs/cgroup/devices
/sys/fs/cgroup/rdma
/sys/fs/cgroup/pids
/sys/fs/cgroup/memory
/sys/fs/cgroup/cpuset
/sys/fs/cgroup/perf_event
/sys/fs/cgroup/freezer
/sys/fs/cgroup/blkio
/sys/fs/cgroup/misc
/sys/fs/cgroup/hugetlb
Cgroup v2 mount points:
/sys/fs/cgroup/unified
Cgroup v1 clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
--- Misc ---
Veth pair device: enabled, loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, loaded
Advanced netfilter: enabled, loaded
CONFIG_IP_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, not loaded
CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, not loaded
FUSE (for use with lxcfs): enabled, not loaded
--- Checkpoint/Restore ---
checkpoint restore: enabled
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities:
Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig