You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No network connection inside a freshly created vanilla unmodified container after lxc-start.
Distro doesn't matter, tested with Alpine edge as well as latest Waydroid.
I have done some debugging and found some clues.
For a veth net type, lxc-start should attach the container interface to a bridge, which I can confirm by running:
> lxc-start ... -l debug
...
lxc-start test 20240408183711.793 INFO network - ../src/lxc/network.c:netdev_configure_server_veth:745 - Attached "veth0xYE0v" to bridge "lxcbr0"
lxc-start test 20240408183711.793 DEBUG network - ../src/lxc/network.c:netdev_configure_server_veth:876 - Instantiated veth tunnel "veth0xYE0v <--> vethNYVz4E"
But there is still no network in the container, e.g. Alpine edge: udhcpc failed to get a DHCP lease.
On the host bridge link output is empty, ip link show master lxcbr0 is empty.
Bridge config in sysfs:
> ls -l /sys/class/net/lxcbr0/brif/
total 0
> ip link
...
31: lxcbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 00:16:3e:00:00:00 brd ff:ff:ff:ff:ff:ff
36: veth0xYE0v@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether fe:95:81:4b:e9:bd brd ff:ff:ff:ff:ff:ff link-netnsid 0
Here you can see that the bridge is DOWN. But a correctly configured bridge should be UP and veth0xYE0v should have a master.
Now, if I run ip link set dev veth0xYE0v master lxcbr0 everything starts to work: the container receives an IP address, bridge becomes UP etc.
So somehow, the bridge is misconfigured by the lxc-start.
If we dig deeper, we can see that lxc-start does indeed end up calling br_add_if in the kernel, same as ip link set ... master:
The only difference is that iproute2 uses netlink mechanism to configure the net layer, whereas lxc-start calls ioctl(SIOCBRADDIF) which is supposed to be a more outdated way of configuring net devices.
So clearly, either lxc-start misses something during net configuration or there is something wrong with the underlying host.
Steps to reproduce
Set USE_LXC_BRIDGE="true" in /etc/default/lxc
Start lxc-net
Create new container with Alpine Linux edge amd64
Start the container with lxc-start -n test -F
Observe the init output: udhcpc failed to get a DHCP lease
Additional info
Kernel log doesn't contain anything unusual.
Container log
> lxc-start -n test -F
OpenRC 0.54 is starting up Linux 6.7.6-zen1-2-zen (x86_64) [LXC]
* /proc is already mounted
* Mounting /run ... [ ok ]
* /run/openrc: creating directory
* /run/lock: creating directory
* /run/lock: correcting owner
* Caching service dependencies ... [ ok ]
* Mounting local filesystems ... [ ok ]
* Migrating /var/lock to /run/lock ... [ ok ]
* Creating user login records ... [ ok ]
* Cleaning /tmp directory ... [ ok ]
* Remounting devtmpfs on /dev ... [ ok ]
* Mounting /dev/mqueue ... [ ok ]
* Mounting /dev/shm ... [ ok ]
* Starting busybox syslog ... [ ok ]
* Starting busybox crond ... [ ok ]
* Starting networking ... * lo ... [ ok ]
* eth0 ...udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc: broadcasting discover
udhcpc failed to get a DHCP lease
udhcpc: no lease, forking to background
[ ok ]
Welcome to Alpine Linux 3.19
Kernel 6.7.6-zen1-2-zen on an x86_64 (/dev/console)
test login:
Container config file
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template:
# Template script checksum (SHA-1): f568fbbaa379c008dd8abe57067fd20be66ad75a
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.arch = linux64
# Container specific configuration
lxc.rootfs.path = dir:/var/lib/lxc/test/rootfs
lxc.uts.name = test
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:95:df:78
The text was updated successfully, but these errors were encountered:
@DevonSchwartz it's not clear that this is a bug in LXC yet, we've seen this kind of issues coming from external tools interfering with LXC. If this was a generalized issue, we'd have seen a LOT of people complaining about it :)
Required information
lxc-checkconfig
cat /proc/1/mounts
Issue description
No network connection inside a freshly created vanilla unmodified container after
lxc-start
.Distro doesn't matter, tested with Alpine edge as well as latest Waydroid.
I have done some debugging and found some clues.
For a
veth
net type,lxc-start
should attach the container interface to a bridge, which I can confirm by running:But there is still no network in the container, e.g. Alpine edge:
udhcpc failed to get a DHCP lease
.On the host
bridge link
output is empty,ip link show master lxcbr0
is empty.Bridge config in sysfs:
Here you can see that the bridge is DOWN. But a correctly configured bridge should be UP and
veth0xYE0v
should have a master.Now, if I run
ip link set dev veth0xYE0v master lxcbr0
everything starts to work: the container receives an IP address, bridge becomes UP etc.So somehow, the bridge is misconfigured by the
lxc-start
.If we dig deeper, we can see that
lxc-start
does indeed end up callingbr_add_if
in the kernel, same asip link set ... master
:The only difference is that
iproute2
usesnetlink
mechanism to configure the net layer, whereaslxc-start
callsioctl(SIOCBRADDIF)
which is supposed to be a more outdated way of configuring net devices.So clearly, either
lxc-start
misses something during net configuration or there is something wrong with the underlying host.Steps to reproduce
USE_LXC_BRIDGE="true"
in/etc/default/lxc
lxc-net
lxc-start -n test -F
udhcpc failed to get a DHCP lease
Additional info
Kernel log doesn't contain anything unusual.
Container log
Container config file
The text was updated successfully, but these errors were encountered: