bootclean.sh shouldn't wipe out dhcp leases

Bug #12071 reported by Roland Dreier
6
Affects Status Importance Assigned to Milestone
ifupdown (Debian)
New
Unknown
ifupdown (Ubuntu)
Invalid
Low
Scott James Remnant (Canonical)

Bug Description

When ifup runs dhclient3, it tells dhclient3 to put its lease file in
/var/run/dhclient.<ifname>.leases. However when bootclean.sh gets called during
boot, it deletes this file (along with almost everything in /var/run). This is
unfortunate because it forces dhclient to get a new lease and may lead to the
system's IP address changing unnecessarily.

Revision history for this message
In , I-postmaster-aglu-demon-nl (i-postmaster-aglu-demon-nl) wrote : Re: Bug#282740: Defeats dhclient's attempts to store and reuse leases

> In the event that no DHCP server is reachable, dhclient can check for leases
> stored in the dhclient.leases file, and if they are still valid, they can be
> reused. However, since ifupdown directs dhclient to use a leases file
> stored in /var/run, the file is deleted at boot, which more or less prevents
> this feature from working.
>
> I have been noticing this repeatedly, having been plagued with electrical
> problems recently, and having a DHCP server which takes just slightly longer
> to start up than my desktop. :-)
>
> The simple solution is to save the leases file in
> (for example) /var/lib/dhcp3/dhclient.<interface>.leases rather than a file
> in /var/run.

This is a duplicate of, or is related to, #246621.

There is currently not much point in keeping the leases file in /var/lib/.
The reason is that ifdown stops dhclient3 in such a way that dhclient3
relinquishes the lease, thus removing the lease from the .leases file
(I believe ... I should confirm this but I am not at my Debian machine
right now). In earlier versions of ifupdown, dhclient3 was simply killed
by ifdown. This had the advantage of preventing dhclient3 from
relinquishing the lease; however, it had the disadvantage that it also
prevented dhclient3 from doing anything else, such as running its hook
scripts. We chose to change ifupdown so that it stopped dhclient3
"cleanly" even though this meant deleting the lease info and making
another set of users unhappy. :/

In order to solve this problem, dhclient3 needs to be enhanced such
that there is some way of stopping it without it relinquishing
leases. (See #247812: "Please provide a way of stopping without
releasing".) One dhclient3 has been enhanced it will be possible to
change ifupdown to make use of the new feature.

--
Thomas Hood

Revision history for this message
In , Matt Zimmerman (mdz) wrote :

On Wed, Nov 24, 2004 at 12:12:58PM +0000, <email address hidden> wrote:

> This is a duplicate of, or is related to, #246621.
>
> There is currently not much point in keeping the leases file in /var/lib/.
> The reason is that ifdown stops dhclient3 in such a way that dhclient3
> relinquishes the lease, thus removing the lease from the .leases file

This is actually a different issue. Consider my situation: there is a power
failure, and so ifdown is not called at all. The leases file is removed
during the boot process because it is in /var/run, and so dhclient cannot
regain the lease, even though it is still valid and has not been released.

--
 - mdz

Revision history for this message
In , Thomas Hood (jdthood-yahoo) wrote : severity of 282740 is wishlist ..., merging 282740 246621

# Automatically generated email from bts, devscripts version 2.8.5
severity 282740 wishlist
retitle 282740 ifupdown: Please keep dhclient's leases file in /var/lib/
merge 282740 246621

Revision history for this message
In , Thomas Hood (jdthood-aglu) wrote : Different, but related

#282740 is indeed a different issue from #246621; however, it will only
be worth the trouble moving the leases file to /var/lib/ once #246621 is
fixed (so that bringing down an interface in the normal way doesn't
relinquish the lease). For that reason I am merging the reports. Once
#246621 is done we should do #246621 too.

--
Thomas Hood

Revision history for this message
Roland Dreier (roland.dreier) wrote :

When ifup runs dhclient3, it tells dhclient3 to put its lease file in
/var/run/dhclient.<ifname>.leases. However when bootclean.sh gets called during
boot, it deletes this file (along with almost everything in /var/run). This is
unfortunate because it forces dhclient to get a new lease and may lead to the
system's IP address changing unnecessarily.

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Tue, 23 Nov 2004 20:38:30 -0800
From: Matt Zimmerman <email address hidden>
To: <email address hidden>
Subject: Defeats dhclient's attempts to store and reuse leases

Package: ifupdown
Severity: normal

In the event that no DHCP server is reachable, dhclient can check for leases
stored in the dhclient.leases file, and if they are still valid, they can be
reused. However, since ifupdown directs dhclient to use a leases file
stored in /var/run, the file is deleted at boot, which more or less prevents
this feature from working.

I have been noticing this repeatedly, having been plagued with electrical
problems recently, and having a DHCP server which takes just slightly longer
to start up than my desktop. :-)

The simple solution is to save the leases file in
(for example) /var/lib/dhcp3/dhclient.<interface>.leases rather than a file
in /var/run.

--
 - mdz

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Wed, 24 Nov 2004 12:12:58 GMT
From: <email address hidden>
To: Matt Zimmerman <email address hidden>, <email address hidden>, <email address hidden>
Cc: <email address hidden>
Subject: Re: Bug#282740: Defeats dhclient's attempts to store and reuse leases

> In the event that no DHCP server is reachable, dhclient can check for leases
> stored in the dhclient.leases file, and if they are still valid, they can be
> reused. However, since ifupdown directs dhclient to use a leases file
> stored in /var/run, the file is deleted at boot, which more or less prevents
> this feature from working.
>
> I have been noticing this repeatedly, having been plagued with electrical
> problems recently, and having a DHCP server which takes just slightly longer
> to start up than my desktop. :-)
>
> The simple solution is to save the leases file in
> (for example) /var/lib/dhcp3/dhclient.<interface>.leases rather than a file
> in /var/run.

This is a duplicate of, or is related to, #246621.

There is currently not much point in keeping the leases file in /var/lib/.
The reason is that ifdown stops dhclient3 in such a way that dhclient3
relinquishes the lease, thus removing the lease from the .leases file
(I believe ... I should confirm this but I am not at my Debian machine
right now). In earlier versions of ifupdown, dhclient3 was simply killed
by ifdown. This had the advantage of preventing dhclient3 from
relinquishing the lease; however, it had the disadvantage that it also
prevented dhclient3 from doing anything else, such as running its hook
scripts. We chose to change ifupdown so that it stopped dhclient3
"cleanly" even though this meant deleting the lease info and making
another set of users unhappy. :/

In order to solve this problem, dhclient3 needs to be enhanced such
that there is some way of stopping it without it relinquishing
leases. (See #247812: "Please provide a way of stopping without
releasing".) One dhclient3 has been enhanced it will be possible to
change ifupdown to make use of the new feature.

--
Thomas Hood

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Wed, 24 Nov 2004 10:50:28 -0800
From: Matt Zimmerman <email address hidden>
To: <email address hidden>
Cc: <email address hidden>, <email address hidden>
Subject: Re: Bug#282740: Defeats dhclient's attempts to store and reuse leases

On Wed, Nov 24, 2004 at 12:12:58PM +0000, <email address hidden> wrote:

> This is a duplicate of, or is related to, #246621.
>
> There is currently not much point in keeping the leases file in /var/lib/.
> The reason is that ifdown stops dhclient3 in such a way that dhclient3
> relinquishes the lease, thus removing the lease from the .leases file

This is actually a different issue. Consider my situation: there is a power
failure, and so ifdown is not called at all. The leases file is removed
during the boot process because it is in /var/run, and so dhclient cannot
regain the lease, even though it is still valid and has not been released.

--
 - mdz

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <20041124193207.C074510D70B@localhost>
Date: Wed, 24 Nov 2004 20:32:07 +0100
From: Thomas Hood <email address hidden>
To: <email address hidden>
Subject: severity of 282740 is wishlist ..., merging 282740 246621

# Automatically generated email from bts, devscripts version 2.8.5
severity 282740 wishlist
retitle 282740 ifupdown: Please keep dhclient's leases file in /var/lib/
merge 282740 246621

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <1101326176.5828.421.camel@thanatos>
Date: Wed, 24 Nov 2004 20:56:16 +0100
From: Thomas Hood <email address hidden>
To: <email address hidden>
Subject: Different, but related

#282740 is indeed a different issue from #246621; however, it will only
be worth the trouble moving the leases file to /var/lib/ once #246621 is
fixed (so that bringing down an interface in the normal way doesn't
relinquish the lease). For that reason I am merging the reports. Once
#246621 is done we should do #246621 too.

--
Thomas Hood

Revision history for this message
In , Jeroen van Wolffelaar (jeroenvw) wrote :

On Wed, Nov 24, 2004 at 08:56:16PM +0100, Thomas Hood wrote:
> #282740 is indeed a different issue from #246621; however, it will only
> be worth the trouble moving the leases file to /var/lib/ once #246621 is
> fixed (so that bringing down an interface in the normal way doesn't
> relinquish the lease). For that reason I am merging the reports. Once
> #246621 is done we should do #246621 too.

I disagree that #246621 should be a prerequisite, rather, if you have
saved the lease across a reboot, the dhcp client will at least try to
get a similar lease (i.e., same IP address, most likely). And as noted
before, in case of a power failure, the lease will be in the file
regardless.

This has bothered me for a while, and only now I've found out it isn't
dhclient's fault, but actually caused by ifupdown... And I'd like to
urge you to consider reverting the behaviour to what it was before, to
store leases in /var/lib. Note also that the dhcp-client manpages
advertises stuff to be placed in /var/lib.

Especially since the location is not configureable, this is would be
really nice to have.

Thanks very much,
--Jeroen

--
Jeroen van Wolffelaar
<email address hidden>
http://jeroen.A-Eskwadraat.nl

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Tue, 19 Apr 2005 04:02:31 +0200
From: Jeroen van Wolffelaar <email address hidden>
To: Thomas Hood <email address hidden>, <email address hidden>
Subject: Re: Different, but related

On Wed, Nov 24, 2004 at 08:56:16PM +0100, Thomas Hood wrote:
> #282740 is indeed a different issue from #246621; however, it will only
> be worth the trouble moving the leases file to /var/lib/ once #246621 is
> fixed (so that bringing down an interface in the normal way doesn't
> relinquish the lease). For that reason I am merging the reports. Once
> #246621 is done we should do #246621 too.

I disagree that #246621 should be a prerequisite, rather, if you have
saved the lease across a reboot, the dhcp client will at least try to
get a similar lease (i.e., same IP address, most likely). And as noted
before, in case of a power failure, the lease will be in the file
regardless.

This has bothered me for a while, and only now I've found out it isn't
dhclient's fault, but actually caused by ifupdown... And I'd like to
urge you to consider reverting the behaviour to what it was before, to
store leases in /var/lib. Note also that the dhcp-client manpages
advertises stuff to be placed in /var/lib.

Especially since the location is not configureable, this is would be
really nice to have.

Thanks very much,
--Jeroen

--
Jeroen van Wolffelaar
<email address hidden>
http://jeroen.A-Eskwadraat.nl

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

I must be missing something ... we put the leases file in /var/lib!

Changed in ifupdown:
assignee: debzilla → keybuk
status: Unconfirmed → Rejected
Revision history for this message
In , Allard Hoeve (allard) wrote : Yes, please keep leases in /var/lib somewhere.

Dear AJ,

This bug is biting me in the foot as well.

Please do consider storing the leases in /var/lib/ifupdown or similar.

Regards,

Allard Hoeve

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.