Skip to contentSkip to conversation

removing /etc/init.d/busybox-udhcpc

PATCH New Jesse Zhang 2 participants 4 messages Jul 26, 2012 – Jul 27, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I recently found that if "ip=dhcp" is specified in the kernel cmdline, there would be some strange behaviour of udhcpc.

1. udhcpc is started two times during bootup.

    Starting Bootlog daemon: bootlogd.
    Configuring network interfaces... udhcpc (v1.19.4) started
    Sending discover...
    Sending select for 128.224.162.132...
    Lease of 128.224.162.132 obtained, lease time 172800
    /etc/udhcpc.d/50default: Adding DNS 128.224.160.11
    /etc/udhcpc.d/50default: Adding DNS 147.11.100.30
    /etc/udhcpc.d/50default: Adding DNS 147.11.1.11
    done.
    Starting portmap daemon...
    [...]
    Starting domain name service: named.
    udhcpc (v1.19.4) started
    Sending discover...
    Sending select for 128.224.162.132...
    Lease of 128.224.162.132 obtained, lease time 172800
    RTNETLINK answers: File exists
    /etc/udhcpc.d/50default: Adding DNS 128.224.160.11
    /etc/udhcpc.d/50default: Adding DNS 147.11.100.30
    /etc/udhcpc.d/50default: Adding DNS 147.11.1.11
    creating NFS state directory: done

2. udhcpc is *started* when system is being shutdown.

    Stopping domain name service: namedrndc: neither /etc/bind/rndc.conf nor /etc/bind/rndc.key wd
    .
    udhcpc (v1.19.4) started
    Sending discover...
    Sending select for 128.224.162.132...
    Lease of 128.224.162.132 obtained, lease time 172800
    RTNETLINK answers: File exists
    /etc/udhcpc.d/50default: Adding DNS 128.224.160.11
    /etc/udhcpc.d/50default: Adding DNS 147.11.100.30
    /etc/udhcpc.d/50default: Adding DNS 147.11.1.11
    Stopping system message bus: dbus.
    stopping statd: done

The reason is busybox installs a busybox-udhcpc init script, which would start udhcpc when "ip=dhcp" is specified, but udhcpc is also invoked by the networking service (as specified through /etc/network/interfaces). That's why udhcpc is started twice.

And since the init script doesn't actually support "stop" actions, it will start udhcpc again during system shutdown.

The obvious fix is to remove the busybox-udhcpc init script; all configs should go through /etc/network/interfaces. But I'm wondering if anyone has problems with that.

If no one objects, I will send the patch shortly.

jesse

P.S. it only happens for non-qemu targets since they have different configs. I used an intel emenlow.

#1 lore raw
Quoted 8 lines · Jesse Zhang

Hi,

I recently found that if "ip=dhcp" is specified in the kernel cmdline, there would be some strange behaviour of udhcpc.

1. udhcpc is started two times during bootup.

snip...

I've also seen this happen on the beaglebone with meta-ti and poky under core-image-minimal configuration.

Quoted 5 lines

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 5 lines
  Jack Mitchell ([email protected])
  Embedded Systems Engineer
  http://www.embed.me.uk

--
#3 lore raw

PATCH 1/1 busybox: udhcpc shouldn't be a service

In reply to Jesse Zhang

udhcpc is invoked from the networking service, so it shouldn't exist standalone. If /etc/init.d/busybox-udhcpc is present, it will cause udhcpc to be started two times.

And since the script doesn't support the stop action, it will cause udhcpc to be started even when system is being shutdown.

Remove /etc/init.d/busybox-udhcpc to resolve the issues.

[YOCTO #2840]

---
 meta/recipes-core/busybox/busybox.inc          |    6 +---
 meta/recipes-core/busybox/busybox_1.19.4.bb    |    3 +-
 meta/recipes-core/busybox/files/busybox-udhcpc |   25 ------------------------
 3 files changed, 3 insertions(+), 31 deletions(-)
 delete mode 100755 meta/recipes-core/busybox/files/busybox-udhcpc
meta/recipes-core/busybox/busybox.inc +2 -4
index b2fbd52..0a4c067 100644
@@ -20,16 +20,15 @@ FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf*"
 FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
-FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc ${sysconfdir}/init.d/busybox-udhcpc"
+FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
 
-INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-udhcpc ${PN}-mdev"
+INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev"
 
 INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
 INITSCRIPT_NAME_${PN}-syslog = "syslog"
 INITSCRIPT_NAME_${PN}-mdev = "mdev"
 INITSCRIPT_PARAMS_${PN}-mdev = "start 06 S ."
 INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd" 
-INITSCRIPT_NAME_${PN}-udhcpc = "busybox-udhcpc" 
 CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
 CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
 
@@ -186,7 +185,6 @@ do_install () {
 		install -d ${D}${datadir}/udhcpc
                 install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
 		install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
-		install -m 0755 ${WORKDIR}/busybox-udhcpc ${D}${sysconfdir}/init.d/
 	fi
 	if grep "CONFIG_INETD=y" ${WORKDIR}/defconfig; then
 		install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN}
meta/recipes-core/busybox/busybox_1.19.4.bb +1 -2
index 6e69d22..4614cb6 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r10"
+PR = "r11"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://B921600.patch \
@@ -14,7 +14,6 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-cron \
            file://busybox-httpd \
            file://busybox-udhcpd \
-           file://busybox-udhcpc \
            file://default.script \
            file://simple.script \
            file://hwclock.sh \
meta/recipes-core/busybox/files/busybox-udhcpc deleted +0 -25
deleted file mode 100755
index 2c43f8d..0000000
@@ -1,25 +0,0 @@
-#!/bin/sh
-#
-# (c) 2010-2011 Wind River Systems, Inc.
-#
-# Busybox udhcpc init script
-#
-# script to start the udpchc DHCP client on boots where
-# the parameter 'ip=dhcp' was included in the kernel parameters
-
-# ensure the required binaries are present
-[ -x /sbin/udhcpc ] || exit 1
-[ -x /bin/grep ] || exit 1
-[ -x /bin/mount ] || exit 1
-
-# ensure /proc is mounted
-if ! mount | grep -q "/proc "; then
-	exit 2
-fi
-
-rc=0
-if grep -q -E "\bip=dhcp\b" /proc/cmdline; then
-	/sbin/udhcpc -D -s /usr/share/udhcpc/default.script
-	rc=$?
-fi
-exit $rc
Signature · 1 line
1.7.7
#2 lore raw

PATCH 1/1 busybox: udhcpc shouldn't be a service

In reply to Jesse Zhang

Fixed Bug 2840 - busybox: udhcpc misbehavior when "ip=dhcp".

Jesse Zhang (1):
busybox: udhcpc shouldn't be a service

 meta/recipes-core/busybox/busybox.inc          |    6 +---
 meta/recipes-core/busybox/busybox_1.19.4.bb    |    3 +-
 meta/recipes-core/busybox/files/busybox-udhcpc |   25 ------------------------
 3 files changed, 3 insertions(+), 31 deletions(-)
 delete mode 100755 meta/recipes-core/busybox/files/busybox-udhcpc
Signature · 1 line
1.7.7