SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This hasn't come up because who the devil restarts their dhcpd while the system is running? (At least that's my story and I'm sticking to it.)
It turns out I've been doing that while attempting to fix a dynamic DNS issue. The issue comes about because the dhcpd binary looks for the pid file and won't start if it finds one.
For example, the first time you run restart:
Code:
root@testbed:~# /etc/rc.d/rc.dhcpd restart
Shutting down dhcpd:
Starting dhcpd: /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/state/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
There's already a DHCP server running.
If you think you have received this message due to a bug rather
than a configuration issue please read the section on submitting
bugs on either our web page at www.isc.org or in the README file
before submitting a bug. These pages explain the proper
process and the information we find helpful for debugging.
exiting.
root@testbed:~#
...but the second time you run that command, you get...
Code:
root@testbed:~# /etc/rc.d/rc.dhcpd restart
Shutting down dhcpd: dhcpd: no process found
Starting dhcpd: /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcpd.conf
Database file: /var/state/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 1 leases to leases file.
Listening on LPF/virbr0/52:54:00:0a:3c:64/192.168.122.0/24
Sending on LPF/virbr0/52:54:00:0a:3c:64/192.168.122.0/24
Listening on LPF/eth0/b4:2e:99:4c:f8:21/10.10.0.0/24
Sending on LPF/eth0/b4:2e:99:4c:f8:21/10.10.0.0/24
Listening on LPF/eth1/00:13:3b:0e:d0:9e/172.16.0.0/24
Sending on LPF/eth1/00:13:3b:0e:d0:9e/172.16.0.0/24
Sending on Socket/fallback/fallback-net
root@testbed:~#
There are a couple of ways to fix the issue:
You can make "--no-pid" a default DHCPD_OPTIONS value, so there won't be a pid file to check
You can add "rm /var/run/dhcpd.pid" in the stop() block
I don't have an opinion upon which option is superior. The stop() bit of the script doesn't bother to look at /var/run/dhcpd.pid but instead just kills everything named dhcpd.
When you want to stop a service:
if the process/service is not running (stopped already) nothing will happen, therefore the pidfile will not be checked and removed.
if the process/service is running it should be terminated and also the pidfile(s) should be removed.
An existing pidfile without running process means incorrect termination or a bug in the software somewhere. The fix is: remove the pidfile manually or find/fix/report the bug. Don't add --no-pid as it will probably make things worse (because the pidfile is still there).
And I wouldn't add force remove to the stop function (it looks like an ugly workaround for me), but I would rather try to terminate it properly.
I don't use network-manager and I replaced slackware's stock networking scripts with my own, but I find dhcpcd manages its pidfiles itself if you issue the 'dhcpcd -k' or 'dhcpcd -x' commands to stop it.
One caveat is that the pidfile name used is somewhat dynamic and can change depending on what options were provided to dhcpcd when you started it: 'dhcpcd -P' can help with that though.
But my suggestion remains. Running "sh -vx /etc/rc.d/rc.[service]" in that directory, to examine what's going on, is the best place to start. It might be simple timing, so a simple fix; or maybe something worse, especially when it's wrong or suspicious. But the first step is to gather that extra, unusual information.
By the way, there is actually no /etc/rc.d/rc.dhcpd in Slackware. You have probably copied it from usb-and-pxe-installers/README_PXE.TXT like I did when I used PXE to install Slackware.
ISC has announced the end of maintenance for ISC DHCP as of the end of 2022. ISC will continue providing professional support services for existing subscribers, but does not intend to issue any further maintenance releases. For resources that may help in migrating your existing ISC DHCP server deployment to our newer DHCP server, Kea, please ...
By the way, there is actually no /etc/rc.d/rc.dhcpd in Slackware. You have probably copied it from usb-and-pxe-installers/README_PXE.TXT like I did when I used PXE to install Slackware.
You are absolutely correct about rc.dhcpd. I guess I pulled it in a loooong time ago on one of my Slackware machines and cloned it to the others I run.
The tell (had I been paying attention) would have been that it was launched via rc.local versus a block in rc.M.
I've never done a real PXE boot on my networks (I did look at it more than a decade ago), so I probably pulled rc.dhcpd out of one of the /usr/doc/ files that had it.
(I hadn't looked for kea in slackbuilds.org; I rather assumed that Slackware itself would pull that in. For all I know, it's in -current.)
Thank you very much, Petri Kaukasoina, for clarity. I apologize for the noise here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.