Subject: [alpine-devel] dhcpd won't start automatically

From: Jeremy Thomerson <[email-masked]>
Date: Tue, 18 Aug 2009 01:24:19 -0500

My new router is almost completely setup (shorewall, openvpn server, dns,
etc).  I have one problem, though.  I've added dhcpd to the default
runlevel, and it tries to start on a reboot, but it doesn't start
automatically.  If I sign in to the box and start the service manually, it
starts fine.

I think the problem has to do with ipv6 not being loaded BEFORE dhcpd tries
to start.  I've pasted the relevant part of /var/log/messages below.  I've
tried adding ipv6 to /etc/modules.  After the box finishes booting,
'/proc/net/if_inet6' exists, so I think that it may be just an order of
operations problem.

I also tried disabling ipv6 support in dhcpd by specifying "-4" in the
config.  However, I think the following bug may be causing this to fail:
http://bugs.archlinux.org/task/12792

Any suggestions?

Thanks!
Jeremy Thomerson

Aug 18 06:18:04 thomerson-rt01 daemon.info dhcpd: Internet Systems
Consortium DHCP Server 4.1.0p1
Aug 18 06:18:04 thomerson-rt01 daemon.info dhcpd: Copyright 2004-2009
Internet Systems Consortium.
Aug 18 06:18:04 thomerson-rt01 daemon.info dhcpd: All rights reserved.
Aug 18 06:18:04 thomerson-rt01 daemon.info dhcpd: For info, please visit
http://www.isc.org/sw/dhcp/
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: Internet Systems
Consortium DHCP Server 4.1.0p1
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: Copyright 2004-2009
Internet Systems Consortium.
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: All rights reserved.
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: For info, please visit
http://www.isc.org/sw/dhcp/
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: Internet Systems
Consortium DHCP Server 4.1.0p1
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: Copyright 2004-2009
Internet Systems Consortium.
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: All rights reserved.
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: For info, please visit
http://www.isc.org/sw/dhcp/
Aug 18 06:18:04 thomerson-rt01 local7.info dhcpd: Wrote 0 leases to leases
file.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: Error opening
'/proc/net/if_inet6' to list IPv6 interfaces; No such file or directory
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: Can't get list of
interfaces.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd:
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: If you did not get this
software from ftp.isc.org, please
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: get the latest from
ftp.isc.org and install that before
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: requesting help.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd:
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: If you did get this
software from ftp.isc.org and have not
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: yet read the README, please
read it before requesting help.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: If you intend to request
help from the [email-masked]
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: mailing list, please read
the section on the README about
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: submitting bug reports and
requests for help.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd:
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: Please do not under any
circumstances send requests for
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: help directly to the
authors of this software - please
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: send them to the
appropriate mailing list as described in
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: the README file.
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd:
Aug 18 06:18:04 thomerson-rt01 local7.err dhcpd: exiting.
Aug 18 06:18:04 thomerson-rt01 daemon.err /etc/init.d/dhcpd[1114]:
start-stop-daemon: failed to start `/usr/sbin/dhcpd'
Aug 18 06:18:04 thomerson-rt01 daemon.err /etc/init.d/dhcpd[1098]: ERROR:
dhcpd failed to start

---

From: Natanael Copa <[email-masked]>
Date: Tue, 18 Aug 2009 10:39:52 +0200

On Tue, 2009-08-18 at 01:24 -0500, Jeremy Thomerson wrote:
> My new router is almost completely setup (shorewall, openvpn server,
> dns, etc).  I have one problem, though.  I've added dhcpd to the
> default runlevel, and it tries to start on a reboot, but it doesn't
> start automatically.  If I sign in to the box and start the service
> manually, it starts fine.
> 
> I think the problem has to do with ipv6 not being loaded BEFORE dhcpd
> tries to start.  I've pasted the relevant part of /var/log/messages
> below.  I've tried adding ipv6 to /etc/modules.  After the box
> finishes booting, '/proc/net/if_inet6' exists, so I think that it may
> be just an order of operations problem.
> 

I applied the patch found in the archlinux bug report.
http://git.alpinelinux.org/cgit/aports/commit/?id=db5d9d6dcaa35ca33f48383464e0be66903f1bfa

So you can try install dhcp-4.1.0_p1-r2

Other option, if you want make sure that modules initscript is run
before dhcpd, you can add a forced depednency in /etc/conf.d/dhcpd:

rc_need="modules"

However, I'd believe that networking should come after modules anyway so
please let me know  if the above lines solves your problem. Then I'll
need to fix the init.d dependencies some place.

Thanks!

-nc

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Jeremy Thomerson <[email-masked]>
Date: Tue, 18 Aug 2009 12:31:07 -0500

Okay, perhaps this is a dumb question.  I upgraded the package, but I can't
figure out how to make that upgrade persist through a reboot.  I must be
doing it wrong.  Here's what I'm doing:

My /etc/apk/repositories has this in it:
/media/sda1/apks
http://dev.alpinelinux.org/alpine/v1.9/packages/main

I ran these commands:
apk update
apk fix -u dhcp
lbu commit sda1
reboot

What'd I do wrong?  Sorry for all the questions.

Jeremy Thomerson

---

From: Jeremy Thomerson <[email-masked]>
Date: Tue, 18 Aug 2009 12:36:10 -0500

Well, it did work (with the old dhcpd version) by adding the
rc_need="modules".  If I reboot and do an rc-status, it shows dhcpd as
"crashed", but in actuality, it is running.  At least it's automatically
starting with a reboot.  This line in the logs may be why it thinks that it
crashed:

local7.err dhcpd: Can't create PID file /var/run/dhcp/dhcpd.pid: Permission
denied.

Here's what I did:

echo "rc_need=\"modules\"" >> /etc/conf.d/dhcpd
rc-update add modules
lbu commit sda1
reboot

Thank you very much!
Jeremy Thomerson

---

From: Natanael Copa <[email-masked]>
Date: Tue, 18 Aug 2009 20:42:38 +0200

On Tue, 2009-08-18 at 12:36 -0500, Jeremy Thomerson wrote:
> "crashed", but in actuality, it is running.  At least it's
> automatically starting with a reboot.  This line in the logs may be
> why it thinks that it crashed:
> 
> local7.err dhcpd: Can't create PID file /var/run/dhcp/dhcpd.pid:
> Permission denied.

this is a bug. I dont have time right now and i will forget. please
create an issue on http://bugs.aplinelinux.org so its not forgotten.

Thanks!

-nc

---

---

From: Jeremy Thomerson <[email-masked]>
Date: Tue, 18 Aug 2009 13:57:14 -0500

> create an issue on http://bugs.aplinelinux.org so its not forgotten.
Done.
http://redmine.alpinelinux.org/issues/show/139

Thank you!
Jeremy

---

From: Jeremy Thomerson <[email-masked]>
Date: Wed, 19 Aug 2009 15:25:58 -0500

Thanks Natanael!  I just upgraded to your newest version, and now it works.

JT

---

From: Natanael Copa <[email-masked]>
Date: Tue, 18 Aug 2009 19:59:41 +0200

On Tue, 2009-08-18 at 12:31 -0500, Jeremy Thomerson wrote:
> Okay, perhaps this is a dumb question.  I upgraded the package, but I
> can't figure out how to make that upgrade persist through a reboot.  I
> must be doing it wrong.  Here's what I'm doing:
> 

there is a known issue with the 'apk fix -u' not sure its fixed. Try:
 apk add -u dhcp

> What'd I do wrong?  Sorry for all the questions.

having packages downloaded from network to persist after a reboot is a
very new feature. (last week). I have nto tried it myself but i *think*
that it might be enough to:

ln -s /media/sda1/apks /etc/apk/cache

I'm interested in if it works.

-nc

---

---

From: Jeremy Thomerson <[email-masked]>
Date: Tue, 18 Aug 2009 13:33:24 -0500

It seems that your patch worked.  I removed modules from the default run
level and removed rc_needs="modules", commited, and rebooted, and using the
updated dhcpd that you created, it stayed running.

rc-status still shows it as crashed, and I think it's from this line in the
logs:
local7.err dhcpd: Can't create PID file /var/run/dhcp/dhcpd.pid: Permission
denied

> I'm interested in if it works.

Persisting after a reboot seems to have worked after adding the link and
using apk add rather than fix.  See this output from just after doing your
commands, committing, and a reboot:

thomerson-rt01:~# ls -alh /etc/apk/cache/ | grep dhcp
-rwxr-xr-x    1 root     root         8.1K Aug 10 08:50
acf-dhcp-0.4.0-r0.apk
-rwxr-xr-x    1 root     root       630.1K Aug 10 08:50 dhcp-4.1.0_p1-r1.apk
-rwxr-xr-x    1 root     root       657.2K Aug 18 18:11
dhcp-4.1.0_p1-r2.239754d2.apk
-rwxr-xr-x    1 root     root        96.0K Aug 10 08:50
dhcp-doc-4.1.0_p1-r1.apk
-rwxr-xr-x    1 root     root        43.6K Aug 10 08:50 dhcpcd-5.0.6-r0.apk
-rwxr-xr-x    1 root     root         9.6K Aug 10 08:50
dhcpcd-doc-5.0.6-r0.apk

thomerson-rt01:~# dhcpd --version
isc-dhcpd-4.1.0p1

Perhaps that is expected?  Maybe the version string didn't change with your
patch?

thomerson-rt01:~# apk update
fetch http://dev.alpinelinux.org/alpine/v1.9/packages/main/APKINDEX.tar.gz

thomerson-rt01:~# apk add -u dhcp
OK: 46 packages, 186 dirs, 3513 files

Thanks for all the help!
Jeremy Thomerson

---

From: Natanael Copa <[email-masked]>
Date: Tue, 18 Aug 2009 20:41:29 +0200

> Perhaps that is expected?  Maybe the version string didn't change with
> your patch?

Yes. The patch does not change the interna version string of dhcpd. try:

apk version dhcp

-nc

---