Bug 198601 - Pass the DHCP lease from the initrd to dhclient
Pass the DHCP lease from the initrd to dhclient
Product: Fedora
Classification: Fedora
Component: mkinitrd (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Jones
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2006-07-12 04:44 EDT by Mark McLoughlin
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version: 5.0.47-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-07-13 14:57:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
mkinitrd-dhcp-lease.patch (4.50 KB, patch)
2006-07-12 04:44 EDT, Mark McLoughlin
no flags Details | Diff
initscripts-initrd-dhcp-lease.patch (1.84 KB, patch)
2006-07-12 04:45 EDT, Mark McLoughlin
no flags Details | Diff
mkinitrd-dhcp-lease.patch (4.00 KB, patch)
2006-07-12 10:14 EDT, Mark McLoughlin
no flags Details | Diff
initscripts-initrd-dhcp-lease.patch (1.28 KB, patch)
2006-07-12 10:15 EDT, Mark McLoughlin
no flags Details | Diff

  None (edit)
Description Mark McLoughlin 2006-07-12 04:44:11 EDT
With nash's "network --bootproto dhcp" command, the initrd obtains a DHCP lease
and brings up the device.

However, if this device is configured to be brought up at boot time (ONBOOT=yes)
with dhcp (BOOTPROTO=dhcp) by the init scripts, the device is first brought down
and then a new DHCP lease is obtained before bringing the device back up.

This is obviously pretty catastrophic when the root filesystem is on NFS.

The most correct fix seems to be to allow the initrd to pass the lease onto
dhclient, in which case dhclient won't re-configure the device.

Attaching patches which takes a first cut at this.

The mkinitrd patch does the following:

  - Makes libdhcp write out the lease[1]
  - Adds a lame "cp" command to nash
  - Makes setuproot mount a tmpfs on /sysroot/var/lib/initrd
  - Copies the lease to there

The initscripts patch does the following:

  - Creates the /var/lib/initrd dir
  - In ifup-eth, copies any lease for that device from /var/lib/initrd
    for dhclient

[1] - If we're not happy with /var/lib/dhclient/dhclient.leases as the location
for this, we have the following options:

  - change libdhcp's pumpDhcpClassRun() to accept a path for the lease
    and pass that using "-lf <path>" to libdhcp4client's dhcpv4_client()
  - set the PATH_DHCLIENT_DB env var with the path for the lease
Comment 1 Mark McLoughlin 2006-07-12 04:44:11 EDT
Created attachment 132287 [details]
Comment 2 Mark McLoughlin 2006-07-12 04:45:24 EDT
Created attachment 132288 [details]
Comment 3 Jeremy Katz 2006-07-12 07:00:22 EDT
One problem with this is that it doesn't work if you have /var as a separate
filesystem (which we allow, and lots of people do).  :-/
Comment 4 Mark McLoughlin 2006-07-12 08:28:04 EDT
how about /initrd ? :/
Comment 5 Bill Nottingham 2006-07-12 09:12:56 EDT
Well, if you want someplace writable, that pretty much leaves /dev.

/initrd is dead, AFAIR.
Comment 6 Mark McLoughlin 2006-07-12 09:23:03 EDT
(In reply to comment #5)
> Well, if you want someplace writable, that pretty much leaves /dev.

Yeah ...

> /initrd is dead, AFAIR.

Sure, but it could be re-incarnated :)

We could make ourselves feel a bit better by saying /initrd is a "generic
mechanism for the initrd to pass stuff to initscripts" so, e.g. the initrd could
generate the root fstab entry this way too.
Comment 7 Bill Nottingham 2006-07-12 09:46:41 EDT
In rc.sysinit, we use /dev/.in_sysinit for some ugly temporary bookkeeping.
Defining something else could work, altough the LSB/FHS would probably yell at us.
Comment 8 Mark McLoughlin 2006-07-12 10:14:29 EDT
Created attachment 132308 [details]
Comment 9 Mark McLoughlin 2006-07-12 10:15:40 EDT
Created attachment 132309 [details]
Comment 10 Mark McLoughlin 2006-07-12 10:16:30 EDT
Okay, updated (but didn't test yet) the patches to copy the lease into /dev
Comment 11 Bill Nottingham 2006-07-13 13:58:50 EDT
Seems OK visually. Added in initscripts CVS.
Comment 12 Peter Jones 2006-07-13 14:57:55 EDT
In mkinitrd as well.

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