Bug 15486 - raspberrypi3: eth0 configuration by ifplugd.action script fails since 2023.02/busybox v1.36.0
Summary: raspberrypi3: eth0 configuration by ifplugd.action script fails since 2023.02...
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2023.02
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-25 08:08 UTC by freemp
Modified: 2024-06-15 15:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description freemp 2023-03-25 08:08:12 UTC
Network interface setup via ifplugd.action script fails since 2023.02.

The script tries to configure the interface via DHCP first. If this fails it applies some static settings.

/etc/ifplugd/ifplugd.action:
----------------------------
#!/bin/bash

if [ "$2" = 'up' ]; then
	ifup -v eth0 && ping -Ieth0 -c1 -W1 google.com && exit 0
	echo 'eth0 setup failed. applying static settings...'
	ifconfig eth0 192.168.0.1 netmask 255.255.255.0
elif [ "$2" = 'down' ]; then
	ifdown -f eth0
fi
----------------------------

/etc/network/interfaces:
------------------------
iface eth0 inet dhcp
------------------------

udhcpc runs with modified options:

CONFIG_FEATURE_UDHCPC_ARPING=n
CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n -O search"

Right after system startup, no network connection available yet, the network cable is plugged in. DHCP setup actually succeeds but for some reason DNS does not. This works smoothly in the 2022.11.x branch (busybox v1.35.0).

# journalctl -fu ifplugd
Dec 20 19:15:58 buildroot systemd[1]: Starting network cable plug detection service...
Dec 20 19:15:58 buildroot systemd[1]: Started network cable plug detection service.
Dec 20 19:15:58 buildroot ifplugd[203]: ifplugd 0.28 initializing.
Dec 20 19:15:58 buildroot ifplugd[203]: Using interface eth0/B8:28:EB:17:F7:B8 with driver <smsc95xx> (version: 5.10.92-v7)
Dec 20 19:15:59 buildroot ifplugd[203]: Using detection mode: SIOCETHTOOL
Dec 20 19:15:59 buildroot ifplugd[203]: Initialization complete, link beat not detected.
Dec 20 19:16:26 buildroot ifplugd[203]: Link beat detected.
Dec 20 19:16:27 buildroot ifplugd[203]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
Dec 20 19:16:27 buildroot ifplugd[203]: client: run-parts /etc/network/if-pre-up.d
Dec 20 19:16:27 buildroot ifplugd[203]: client: ip link set eth0 up
Dec 20 19:16:27 buildroot ifplugd[203]: client: udhcpc -R -n -O search -p /var/run/udhcpc.eth0.pid -i eth0
Dec 20 19:16:27 buildroot ifplugd[203]: client: udhcpc: started, v1.36.0
Dec 20 19:16:27 buildroot ifplugd[203]: client: udhcpc: broadcasting discover
Dec 20 19:16:28 buildroot ifplugd[203]: client: udhcpc: broadcasting select for 10.0.0.133, server 10.0.0.1
Dec 20 19:16:28 buildroot ifplugd[203]: client: udhcpc: lease of 10.0.0.111 obtained from 10.0.0.1, lease time 21600
Dec 20 19:16:28 buildroot ifplugd[203]: client: deleting routers
Dec 20 19:16:28 buildroot ifplugd[203]: client: adding dns 10.0.0.1
Dec 20 19:16:28 buildroot ifplugd[203]: client: run-parts /etc/network/if-up.d
Dec 20 19:16:28 buildroot ifplugd[203]: client: ping: bad address 'google.com'
Dec 20 19:16:28 buildroot ifplugd[203]: client: eth0 setup failed. applying static settings...
Dec 20 19:16:28 buildroot ifplugd[203]: Program executed successfully.
Comment 1 freemp 2023-04-01 06:55:38 UTC
After I modified the 'hosts' entry in /etc/nsswitch.conf

from

hosts:          resolve [!UNAVAIL=return] files myhostname dns

to

hosts:          resolve [SUCCESS=return] files myhostname dns

everything appears to work.
Comment 2 Yann E. MORIN 2024-06-15 15:07:31 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!