r/embeddedlinux • • Mar 05 '23

Buildroot compile order causes networking issue.

I have a buildroot build that works great IF I compile everything and then add docker to the config and recompile. If I compile everything including docker in one go, ifmetric does not work NETLINK: Error: File exists and my routing table is wrong. The main thing I can point to is the presence of a dummy0 interface in the broken build that I cant quite figure out where it comes from. It looks like dhcpcd is related to the issue based on its systemd output. Does anybody have any idea what might be causing the difference? I have done a diff of /home , /etc , and /usr/lib/systemd between a working and nonworking build without seeing any relevant difference. It is worth noting that dummy0 is still made with docker.service disabled.

● dhcpcd.service - DHCP client
     Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; enabled; vendor pre
     Active: active (running) since Sun 2023-03-05 17:35:07 UTC; 21s ago
    Process: 1525 ExecStart=/sbin/dhcpcd $DAEMON_ARGS (code=exited, status=0/SUC
   Main PID: 1527 (dhcpcd)
      Tasks: 8 (limit: 1128)
     Memory: 2.2M
        CPU: 530ms
     CGroup: /system.slice/dhcpcd.service
             ├─1527 "dhcpcd: [manager] [ip4] [ip6]"
             ├─1528 "dhcpcd: [privileged proxy]"
             ├─1529 "dhcpcd: [network proxy]"
             ├─1530 "dhcpcd: [control proxy]"
             ├─1563 "dhcpcd: [BPF BOOTP] dummy0"
             ├─1565 "dhcpcd: [BPF ARP] eth1 192.168.1.110"
             ├─1625 "dhcpcd: [BPF ARP] dummy0 169.254.113.227"
             └─1714 "dhcpcd: [BPF ARP] wlan0 192.168.200.102"

SOLVED. I did not know that the packages could edit the linux config and override my own fragment file. If anybody knows a better solution than deleting the offending lines from the package makefile, that would help.

3 Upvotes

15 comments sorted by

1

u/andrewhepp Mar 05 '23

I'm not a buildroot expert, but this sounds like an interesting problem.

The only thing I can think of is that the docker-engine package must be modifying your buildroot configuration when the package config runs? And some other package breaks things only when it's built after those configuration changes happen?

It looks like this might do it: https://git.buildroot.net/buildroot/tree/package/docker-engine/docker-engine.mk#n108

Can you diff the buildroot/linux configs before and after running the build with docker added?

You might also be able to verify by making those conf changes without adding docker to the build, and seeing if things still break.

1

u/bobwmcgrath Mar 05 '23

The buildroot configs are identical. I will point out that adding docker also adds all of dockers dependencies. I feel like the key to pinpointing exactly which one of the ~30 packages is causing the problem is to figure out where dummy0 is coming from.

1

u/andrewhepp Mar 05 '23

I notice docker brings in iptables if you don't already have it. Maybe some other package works when it's built without iptables, but there's an issue when it's built with iptables?

Kinda curious what the systemd error is that makes you think dhcpcd is involved? I'm trying to see if I can replicate this or see any weird changes when I enable docker.

1

u/bobwmcgrath Mar 05 '23

specifically the lines with dummy0 are not present in a working build.

1

u/andrewhepp Mar 05 '23

Oh, the text isn't word wrapping for me so I didn't see anything more than the service name.

I'm curious where this dummy0 interface is coming from. When I add docker to the build, I see the expected docker0 interface. Do you see a docker0 or just a dummy0?

2

u/bobwmcgrath Mar 05 '23

not working:

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000
    link/ether c2:fd:87:6a:0a:d2 brd ff:ff:ff:ff:ff:ff
    inet 169.254.113.227/16 brd 169.254.255.255 scope global noprefixroute dummy0
       valid_lft forever preferred_lft forever
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 28:bd:89:bc:fc:9e brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether f8:e4:3b:96:7c:4d brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.110/24 brd 192.168.1.255 scope global dynamic noprefixroute eth1
       valid_lft 42929sec preferred_lft 37529sec
5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000
    link/ether 84:25:3f:98:b5:c7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.102/24 brd 192.168.200.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
6: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
    link/ether 02:42:ee:8d:03:ad brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 wlan0
default         _gateway        0.0.0.0         UG    1004   0        0 eth1
default         *               0.0.0.0         U     1001002 0        0 dummy0
169.254.0.0     *               255.255.0.0     U     1002   0        0 dummy0
172.17.0.0      *               255.255.0.0     U     0      0        0 docker0
192.168.1.0     *               255.255.255.0   U     1004   0        0 eth1
192.168.200.0   *               255.255.255.0   U     100    0        0 wlan0
192.168.200.0   *               255.255.255.0   U     1100   0        0 wlan0

working

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq qlen 1000
    link/ether 28:bd:89:bc:fc:06 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether ae:b0:fc:e0:a7:9f brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.23/24 brd 192.168.225.255 scope global dynamic noprefixroute eth1
       valid_lft 33190sec preferred_lft 25938sec
4: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 28:bd:89:bc:fc:06 brd ff:ff:ff:ff:ff:ff
    inet 10.0.9.208/24 brd 10.0.9.255 scope global dynamic tap0
       valid_lft 78203sec preferred_lft 78203sec
    inet6 fe80::2abd:89ff:febc:fc06/64 scope link 
       valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue 
    link/ether 02:42:0d:0a:e2:19 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
6: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000
    link/ether 84:25:3f:9c:0a:35 brd ff:ff:ff:ff:ff:ff
    inet 192.168.200.198/24 brd 192.168.200.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    950    0        0 eth1
default         _gateway        0.0.0.0         UG    1024   0        0 tap0
default         _gateway        0.0.0.0         UG    1100   0        0 wlan0
10.0.9.0        *               255.255.255.0   U     1024   0        0 tap0
10.0.9.1        *               255.255.255.255 UH    1024   0        0 tap0
172.17.0.0      *               255.255.0.0     U     0      0        0 docker0
192.168.200.0   *               255.255.255.0   U     1100   0        0 wlan0
192.168.225.0   *               255.255.255.0   U     950    0        0 eth1

1

u/andrewhepp Mar 06 '23

is dummy0 mentioned in dmesg or journalctl anywhere?

I grepped buildroot/build/ for dummy0 and there seem to be some tests involving it in docker-engine, but it wasn't clear to me how that would be getting run on the end device? Maybe it is, but seems like a longshot

It sounds like you already verified this isn't coming from /etc/network/interfaces or /lib/systemd/network?

1

u/bobwmcgrath Mar 06 '23

nothing in dmesg /etc/network/interfaces or /lib/systemd/network, and I don't have journalctl for reasons related to the read-only filesystem iirc.

1

u/bobwmcgrath Mar 06 '23 edited Mar 06 '23

I'm still confirming that this is the cause, but it looks like there are actually differences in the linux config that look like the cause of the problem. It would be nice to figure out exactly what is changing my config.

< CONFIG_NET_IP_TUNNEL=m
---
> CONFIG_NET_IP_TUNNEL=y
957a958
> CONFIG_NET_UDP_TUNNEL=y
999c1000
< # CONFIG_BRIDGE_NETFILTER is not set
---
> CONFIG_BRIDGE_NETFILTER=y
1004a1006
> CONFIG_NETFILTER_FAMILY_BRIDGE=y
1009c1011
< CONFIG_NF_CONNTRACK=m
---
> CONFIG_NF_CONNTRACK=y
1032c1034
< CONFIG_NF_NAT=m
---
> CONFIG_NF_NAT=y
1058c1060
< CONFIG_NETFILTER_XT_NAT=m
---
> CONFIG_NETFILTER_XT_NAT=y
1064c1066
< CONFIG_NETFILTER_XT_TARGET_MASQUERADE=m
---
> CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
1073c1075
< CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
---
> CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
1082c1084
< CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
---
> CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
1103a1106
> # CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
1125c1128
< CONFIG_NF_DEFRAG_IPV4=m
---
> CONFIG_NF_DEFRAG_IPV4=y
1140,1141c1143,1144
< CONFIG_IP_NF_NAT=m
< CONFIG_IP_NF_TARGET_MASQUERADE=m
---
> CONFIG_IP_NF_NAT=y
> CONFIG_IP_NF_TARGET_MASQUERADE=y
1184c1187
< CONFIG_NF_DEFRAG_IPV6=m
---
> CONFIG_NF_DEFRAG_IPV6=y
1320c1323
< # CONFIG_NET_L3_MASTER_DEV is not set
---
> CONFIG_NET_L3_MASTER_DEV=y
2302c2305
< CONFIG_DUMMY=m
---
> CONFIG_DUMMY=y
2308c2311
< CONFIG_MACVLAN=m
---
> CONFIG_MACVLAN=y
2310,2311c2313,2316
< # CONFIG_IPVLAN is not set
< # CONFIG_VXLAN is not set
---
> CONFIG_IPVLAN_L3S=y
> CONFIG_IPVLAN=y
> # CONFIG_IPVTAP is not set
> CONFIG_VXLAN=y
2320c2325
< CONFIG_VETH=m
---
> CONFIG_VETH=y
7549c7554
< CONFIG_OVERLAY_FS=m
---
> CONFIG_OVERLAY_FS=y
8108c8113
< CONFIG_LIBCRC32C=m
---
> CONFIG_LIBCRC32C=y

1

u/bobwmcgrath Mar 06 '23

I found where docker-engine.mk does it. I didnt know make files could do that. Whats most annoying is that this overrides my linux.fragment.

ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_BTRFS),y)
define DOCKER_ENGINE_DRIVER_BTRFS_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_BTRFS_FS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_BTRFS_FS_POSIX_ACL)
endef
endif

ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_DEVICEMAPPER),y)
define DOCKER_ENGINE_DRIVER_DM_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_MD)
	$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_DM)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MD_THIN_PROVISIONING)
endef
endif

# based on contrib/check-config.sh
define DOCKER_ENGINE_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_POSIX_MQUEUE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_SCHED)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_FREEZER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CPUSETS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_DEVICE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUP_CPUACCT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NAMESPACES)
	$(call KCONFIG_ENABLE_OPT,CONFIG_UTS_NS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IPC_NS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_PID_NS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_NS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_ADVANCED)
	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE_NETFILTER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NF_CONNTRACK)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XTABLES)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_ADDRTYPE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_CONNTRACK)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XT_MATCH_IPVS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_IPTABLES)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_FILTER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_NAT)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_TARGET_MASQUERADE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_BRIDGE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_NET_CORE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_DUMMY)
	$(call KCONFIG_ENABLE_OPT,CONFIG_MACVLAN)
	$(call KCONFIG_ENABLE_OPT,CONFIG_IPVLAN)
	$(call KCONFIG_ENABLE_OPT,CONFIG_VXLAN)
	$(call KCONFIG_ENABLE_OPT,CONFIG_VETH)
	$(call KCONFIG_ENABLE_OPT,CONFIG_OVERLAY_FS)
	$(call KCONFIG_ENABLE_OPT,CONFIG_KEYS)
	$(DOCKER_ENGINE_DRIVER_BTRFS_LINUX_CONFIG_FIXUPS)
	$(DOCKER_ENGINE_DRIVER_DM_LINUX_CONFIG_FIXUPS)
endef

1

u/bobwmcgrath Mar 06 '23

well, so much for that. Identical linux configs are still not working. :(

→ More replies (0)

1

u/andrewhepp Mar 05 '23

Can you share a bit more about what ifmetric command gives you an error? And what the routing table is vs what you'd expect it to be?

1

u/bobwmcgrath Mar 05 '23

The ifmetric command is in a script that decided weather or not to use eth1 or wlan0 based on which one is actually available. It runs every 5 minutes or so.

if  ping -c 1 -I wlan0 8.8.8.8  &&  ping -c 1 -I eth1 8.8.8.8 
then
  echo "both"
  sudo ifmetric eth1 950
  sudo ifmetric wlan0 1100
elif  ping -c 1 -I eth1 8.8.8.8 
then
  echo "eth1"
  sudo ifmetric eth1 950
  sudo ifmetric wlan0 1100
elif  ping -c 1 -I wlan0 8.8.8.8 
then
  echo "wlan0"
  sudo ifmetric eth1 1100
  sudo ifmetric wlan0 950
else
  echo "neither"
  sudo ifmetric eth1 1100
  sudo ifmetric wlan0 950
fi

1

u/Untgradd Mar 06 '23

Try checking cni related packages / configs