0

i got my own interfaces file added to buildroot filesystem (overlay rootfs)

auto lan1
iface lan1 inet manual
auto lan2
iface lan2 inet manual

auto br0
iface br0 inet static
    address 192.168.40.1
    netmask 255.255.255.0
    bridge_ports lan1 lan2
    bridge_fd 5
    bridge_stp no

but i get the following error (i do not see it in dmesg or /var/log/messages):

Cannot find device "br0"

i have bridge-utils built in my buildroot and can create the bridge manually (brctl addbr br0), but it is not done at bootup

any idea?

Edit: this is my defconfig and full interfaces-file

i do not use systemd...i guess legacy vinit

/sbin/init --help
BusyBox v1.32.0 (2021-01-21 18:56:27 CET) multi-call binary.

regards Frank

frank
  • 1
  • 1
  • does https://unix.stackexchange.com/questions/59018/create-and-control-start-up-scripts-in-busybox answer your question? – Ljm Dullaart Jan 20 '21 at 11:32
  • thank you, but this is more like a workaround (create bridge via startup-script), but does not answer, why bridges cannot be created via interfaces file....i have interface-configuration in the file for existing interfaces which works (interfaces file is read and applied)...and the bridge-config is copied from running system (so it should be valid) – frank Jan 20 '21 at 14:08
  • The first step is to edit your question and mention what flavour of `/etc/network/interface` processing you have in your buildroot: systemd? legacy sysv? something else? At the end of the day, the `bridge_*` stanzas have to be interpreted by something, and with the information you have given, the first guess would be that whatever your flavour needs to interpret those is not present. But since you are the only one who knows how the rest of your buildroot looks like, we cannot answer this. – dirkt Jan 22 '21 at 10:44
  • this is my [defconfig](https://github.com/frank-w/buildroot/blob/2020.11-bpi/configs/BPI-R2_defconfig) same repo/branch shows the full [interfaces-file](https://github.com/frank-w/buildroot/blob/2020.11-bpi/rootfs_overlay/etc/network/interfaces) – frank Jan 24 '21 at 11:28

2 Answers2

0

lan1 and lan2 are specified as manual which tells boot to leave those to be configure by hand. Since these two interfaces are not active prior to br0 being initalized, this fails.

Try assigning 0.0.0.0 to lan and lan2 so they are active and up. I've always suspected precedence matters in interfaces so be sure br0 is your last definition in that file:

auto lan1 lan2 br0

iface lan1 inet manual
   up ifconfig lan1 0.0.0.0 up

iface lan2 inet manual
   up ifconfig lan2 0.0.0.0 up

iface br0 inet static
    address 192.168.40.1
    netmask 255.255.255.0
    bridge_ports lan1 lan2
    bridge_fd 5         # not sure this is necessary with stp 'no'
    bridge_stp no
Server Fault
  • 547
  • 1
  • 4
  • 17
  • unfortunately it does not work...i see lan1&2 up (lowerlayerdown), tried also with up ip link set lan1 up same result, also tried removing the manual from lan-ports (so only auto-statement) and putting bridge-commands up (above address/netmask) also if i bring up lan1 by connecting lan-cable before bootup does not create br0...only lan1 up/up – frank Jan 24 '21 at 10:38
  • i also tried this approach: http://lists.busybox.net/pipermail/buildroot/2015-October/143143.html but still no br0 ls /sys/class/net/ eth0 lan0 lan1 lan2 lan3 lo sit0 wan i do not use systemd... /sbin/init --help BusyBox v1.32.0 (2021-01-21 18:56:27 CET) multi-call binary. i'm not sure how the interfaces is parsed here – frank Jan 24 '21 at 11:02
  • Shot in the dark here, but what sort of hardware are your NICs? I've had some really flaky USB and wi-fi hardware in the past that just doesn't work with the kernel. If that's the case, see If you can prove out your config on another system with known working hardware. – Server Fault Jan 28 '21 at 19:51
  • Hi,my hardware is bananapi-r2 (mt7623 soc+mt7630 switch) and above config with same kernel works in debian 10, but i need initramfs for testing so i try to get buildroot working same way. – frank Jan 29 '21 at 20:11
  • I've had issues with amperage being too low on the power adapter with some of my Raspberry PIs. Ran into problems with USB wi-fi adapter not getting enough power to link up. When I got a 3A 5.25V adapter everything worked. Maybe this helps? – Server Fault Jan 29 '21 at 23:15
  • my pi works well in debian and also with the bridge-config, but not in buildroot...i can work and create the bridge manually, but it seems it does not create the bridge via interfaces and so cannot configure it – frank Feb 06 '21 at 15:17
0

Support for the bridging in /etc/network/interfaces comes from "bridge" scripts in /etc/network/if-pre-up.d, if-post-down.d, if-down.d as well as a library script /lib/bridge-utils/bridge-utils.sh

In Debian these bridge support extension scripts are part of the bridge-utils package. If you look at the bridge-utils source that buildroot uses from kernel.org these bridge support scripts aren't part of the source package.

These extra bridge support scripts that are included with Debian come from Debian's own repository The reason the bridge syntax in /etc/network/interfaces doesn't work in Buildroot is because those scripts are missing.

Pete
  • 161
  • 1
  • 8