Bug 6521

Summary: Some images have 2 dhcp clients and that causes problems
Product: [Runtime] General Runtime Reporter: Stoicescu Cornel <corneliux.stoicescu>
Component: General RuntimeAssignee: Saul Wold <sgw>
Status: VERIFIED FIXED QA Contact: Andra Necula <andrax.g.necula>
Severity: major    
Priority: Medium+ CC: andrax.g.necula
Version: 1.7   
Target Milestone: 1.7 M2   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Stoicescu Cornel 2014-07-10 10:53:35 UTC
As the title says, some images like core-image-sato-sdk have 2 DHCP clients and this causes a conflict. 

The the case of core-image-sato-sdk, there is connman and busibox's udhcpc.

Steps to reproduce:
1) Boot the image inside a network that has a fast IP address renewing DHCP server. In our case the IP was given on a per-MAC basis.
2) issue 'ps | grep dhcp" and notice:
root@genericx86-64:~# ps | grep dhcp
  650 root      4728 S    udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
3) Wait for the dhcp lease to expire. Notice in /var/log/messages:
...
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {del} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {add} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {del} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {add} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {del} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {add} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {del} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
Jul 10 11:30:27 genericx86-64 daemon.info connmand[660]: eth0 {add} route 0.0.0.0 gw 192.168.99.1 scope 0 <UNIVERSE>
...

These messages go on forever and the result is intermittent loss connectivity. Operations such as using the smart package manager are affected and sometimes fail with 'Network is unreachable'.

4) issue 'ps | grep dhcp" and notice:
root@genericx86-64:~# ps | grep dhcp
  650 root      4728 S    udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
  807 root      4728 S    run-parts -a renew /etc/udhcpc.d
  808 root     18840 R    {50default} /bin/sh /etc/udhcpc.d/50default renew

NOTES:
- killing the "{50default} /bin/sh /etc/udhcpc.d/50default renew" process solves the issue for the moment. Rebooting the image will bring it back though.
- Issuing 'smart remove busybox-udhcpc' will permanently solve the issue, even though 'ps | grep dhcp'  still shows the same as with the package installed:
root@genericx86-64:~# ps | grep dhcp
  650 root      4728 S    udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
- The only images I tested so far for this are core-image-sato-sdk for genericx86-64 and beaglebone.
- An email thread on the subject: https://lists.connman.net/pipermail/connman/2013-December/016272.html
Comment 1 Saul Wold 2014-07-11 17:37:41 UTC
Good news, I can reproduce this, so I will continue to bang on it
Comment 2 Saul Wold 2014-08-07 15:28:10 UTC
This patch makes busybox aware of EXTERNAL client and adds busybox into the known clients

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=a40db96621fdbc36889a53279aa8840513444a76
Comment 3 Andra Necula 2014-09-08 10:19:14 UTC
Hello,

Just checked on an core-image-sato-sdk on an emenlow, and now only one dhcp client (via connman) is available. Also did checks on /var/log/messages and no occurrences of the reported issue can be found. I will mark this bug as verified.

Andra,