Bug 817556 - dhclient is being run twice on boot
dhclient is being run twice on boot
Status: CLOSED DUPLICATE of bug 607921
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: NetworkManager (Show other bugs)
x86_64 Linux
unspecified Severity high
: rc
: ---
Assigned To: Dan Williams
Desktop QE
Depends On:
  Show dependency treegraph
Reported: 2012-04-30 09:35 EDT by Paul Smith
Modified: 2012-08-29 18:01 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-29 18:01:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Paul Smith 2012-04-30 09:35:27 EDT
Description of problem:
I have modified my eth0 interface configuration using the NetworkManager GUI utility.  It created a /etc/sysconfig/network-scripts/ifcfg-Auth_eth0 script with content as follows:

        NAME="Auto eth0"

(I added the DHCP_HOSTNAME entry by hand).  Now when I reboot my system, dhclient is being run TWICE.  To debug this I renamed dhclient and replaced it with a script that generated some debugging then invoked the real dhclient.  I can see that the first time dhclient is invoked it's run by the S10network script and the second time it's run by NetworkManager.

The result of this is that my system obtains two leases: one lease is kept in /var/lib/dhclient/dhclient-eth0.lease (the one obtained when S10network runs it) and the other is kept in /var/lib/dhclient/dhclient-$UUID-eth0.leases where $UUID is the value set in the ifcfg-Auto_eth0 above.

This would be only an annoyance except for one thing: the two different leases have DIFFERENT IP ADDRESSES.  Sometimes it works out and the IP address associated with the hostname (via DHCP_HOSTNAME) in DNS is the same as the one configured on the local interface, but sometimes it doesn't work out and the hostname and IP address are different... then I can't access the system.  I suppose there's some sort of timing issue with the DHCP handshake.

The question is why is the same interface trying to obtain a lease twice and how can I keep that from happening?  It seems that SysV network and NetworkManager are not in agreement over who controls the interface and both are trying to control it.

This is happening across all of my RHEL 6.2 installs and causing instability.

Version-Release number of selected component (if applicable):
$ rpm -qf /etc/rc.d/init.d/network

$ rpm -qf /usr/sbin/NetworkManager

$ rpm -qf /sbin/dhclient

How reproducible:

Steps to Reproduce:
1. Configure an interface using NetworkManager
2. Reboot
3. Verify that dhclient was run twice by looking for duplicate leases files in /var/lib/dhclient
Actual results:
dhclient run twice for the interface

Expected results:
dhclient only run one time and a single lease obtained

Additional info:
Comment 2 Bill Nottingham 2012-04-30 22:51:58 EDT
See 817660, sorry about the duplicate.
Comment 3 Paul Smith 2012-05-02 12:59:42 EDT
This also seems to be related to bug #607921.  Although that bug is related to iSCSI but the underlying issue is the same one as in this bug.

However, apparently (according to the comments) there's a workaround for iSCSI, but that workaround does not work for my situation.

That bug has been open for almost two years; is there any way to get some progress on this problem?  It's biting us hard in our Red Hat EL 6.2.2 Workstation deployments here and I don't see an obvious workaround.

Comment 4 RHEL Product and Program Management 2012-05-06 00:07:03 EDT
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.
Comment 5 Dan Williams 2012-08-09 15:14:36 EDT
How many ifcfg files do you have in /etc/sysconfig/network, and what are their names?
Comment 6 Dan Williams 2012-08-09 16:57:46 EDT
I meant /etc/sysconfig/network-scripts/  ...
Comment 7 Paul Smith 2012-08-29 14:47:52 EDT
Hi Dan.  I have two: one for lo and one created by NetworkManager:

~$ ls -1 /etc/sysconfig/network-scripts/ifcfg-*

Here's what I think is going on.

If you have a standard desktop install, then both sysv networking (/etc/init.d/network) and NetworkManager are "enabled".

The sysv networking looks for files in /etc/sysconfig/network-scripts and brings up interfaces there as appropriate.  However it appears that a normal desktop install does not, by default create any files in /etc/sysconfig/network-scripts (at least when I installed a new RedHat EL 6.3 yesterday, it didn't create any).  So at first install, the sysv network scripts don't actually do anything.  When I log in, NetworkManager brings up the interface using its default config (DHCP, etc.) without any files in /etc/sysconfig/network-scripts.

However, the minute you modify any of the interface configuration (set the DHCP client ID for example), then NetworkManager appears to create an /etc/sysconfig/network-scripts/ifcfg-Auto_eth0 (or whatever name you gave the interface in NetworkManager) and it puts a fully-formed sysv network script in there, plus the setting you modified (DHCP_CLIENT_ID).

Now the next time you reboot, the sysv network scripts see this ifcfg-Auto_eth0 file and they see that it's got BOOTPROTO=dhcp and ONBOOT=yes in it, and those scripts run the DHCP client and they get an IP address.  Then later (I guess when you log in), NetworkManager ALSO sees that the interface is configured, without checking first to see if the interface is already up, it re-runs the DHCP client protocols.

This causes multiple problems: first, if you configure the sysv init dhclient scripts (/etc/dhcp/dhclient-hook or whatever) they will run at the first DHCP request is made but not the second (there's apparently no way to hook into NetworkManager for this, which is a bummer).

Second, in our environment (for some reason I don't understand, not having any access to the DHCP server logs etc.), these two requests return DIFFERENT IP addresses, even though they are both registering the same MAC address.  Not only that but our DHCP server is keeping both lookups in the DNS server, so now two different IP addresses are resolving to the same hostname, which is very bad.

Anyway, there seems to be a confusion because sysv network and NetworkManager are sharing the same config files, but they are both trying to operate on them.

Unfortunately I need both: this is a desktop and I want my network to come up when the system boots, even if I'm not there to log in.  And at the same time I want the NetworkManager icon on the desktop so I can manage the network using it (change parameters, start/stop VPN, etc.)
Comment 8 Paul Smith 2012-08-29 18:01:39 EDT
This as a duplicate of bug #607921

*** This bug has been marked as a duplicate of bug 607921 ***

Note You need to log in before you can comment on or make changes to this bug.