Red Hat Bugzilla – Bug 5405
No /var/lib/dhcp/dhcpd.leases file when dhcpd first run
Last modified: 2008-05-01 11:37:51 EDT
When dhcpd first runs on a system, it exits with an error
because there is no /etc/dhcpd.leases file present.
Obviously, all it takes to fix the problem is 'touch
/etc/dhcpd.leases', but it's always nicer to have services
start without errors.
We could put a %post section in the dhcp RPM that would do a
'touch /etc/dhcpd.leases'. For first-time runs, it would
allow dhcpd to start without the current error. If there is
already a dhcpd.leases file, it will just have its time
Thank you for the suggestion. It has been forwarded to a developer
for further review.
We do this intentionally, as dhcpd can't run without significant configuration
being done first.
Putting configuration file in place is sufficient I think. This file shoul be
very clean (ie. perfect subnet allocation for each interface/network). This is
simply abusing (to push our users to do touch /var/lib/dhcp/dhcpd.leases or
anything more than creating proper configuration file).
*** Bug 21265 has been marked as a duplicate of this bug. ***
It is true that one must actually configure dhcpd before it can be used, but I
would argue that the need to configure it is a sufficient safety valve: dhcpd
won't even run if there isn't a dhcpd.conf file. Consequently, if we were to
touch the leases file as per my earlier suggestion we would see one of two
results. dhcpd would NOT start for people who had not done the "significant
configuration" or had done it incorrectly, which is the result we desire. For
those who have done the configuration and done it correctly, things would work
cleanly, which is also a result we desire. It's an admittedly trivial point,
but our current approach does open the door for someone who has configured dhcpd
correctly for the first time wondering if perhaps they have configured it
We might find it beneficial to place the sample dhcpd.conf that is in the docs
in /etc as dhcpd.conf.sample. I don't think having an actual /etc/dhcpd.conf
would be a good thing, but having the sample in /etc might help a few people
out. (I personally think they should be looking the docs directory as a matter
of habit, but a lot of people don't and I've had multiple people tell me they
would like to see a sample configuration in /etc.)
So please do at least one of the discussed cases. The second (with sample of
configuration file) could be nice but don't forget to write inside something
about need to touch the leases file.
This is really braindead behaviour as there is _NO_ user notification that
configuration must take place and no sample dhcpd.conf installed. After scping
across my pre-prepared dhcpd.conf, the rc script still failed. No messages
were sent to syslog. Only upon running it manually did I discover the leases
file was missing.
How about a little feedback on "this won't work out of the box -- do this then
this to make it work". Better yet, how about the rc script actually _does_
something when it detects a missing lease or config file?
*** Bug 38768 has been marked as a duplicate of this bug. ***
Another example to point out is when a fresh configuration is done with
linuxconf. (Having usually done it manually, and only done it with linuxconf
once...) Linuxconf seems to catch most of the obvious errors, but it doesn't go
and touch the leases file either. It just blindly tries to start the daemon and
exits with an error. Having the rpm touch the file seems like a trivial fix, so
much so that I fail to see why it couldn't have been done a long time ago.
Will have it as %config(noreplace) in rawhide.