LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-29-2023, 09:29 PM   #1
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
rc.dhcpd has an odd error.


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:
  1. You can make "--no-pid" a default DHCPD_OPTIONS value, so there won't be a pid file to check
  2. 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.
 
Old 10-29-2023, 11:18 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Original Poster
Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Derp. That's running Slackware64 15.0 that's up-to-date as of 4:40AM CDT this morning.
 
Old 10-30-2023, 12:33 PM   #3
gus3
Member
 
Registered: Jun 2014
Distribution: Slackware
Posts: 490

Rep: Reputation: Disabled
My first step is, trace it with
Code:
sh -vx /etc/rc.d/rc.dhcpd restart

Last edited by gus3; 11-02-2023 at 09:37 AM. Reason: wrong suggestion; httpd -> dhcpd
 
Old 11-01-2023, 09:01 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Original Poster
Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by gus3 View Post
My first step is, trace it with
Code:
sh -vx /etc/rc.d/rc.httpd restart
Maybe you replied to the wrong thread; I know what the problem is.
 
Old 11-02-2023, 04:13 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
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.

Last edited by pan64; 11-02-2023 at 04:22 AM.
 
Old 11-02-2023, 04:14 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
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.
 
Old 11-02-2023, 07:57 AM   #7
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,795

Rep: Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474
Quote:
Originally Posted by Richard Cranium View Post
Code:
root@testbed:~# /etc/rc.d/rc.dhcpd restart
Quote:
Originally Posted by gus3 View Post
Code:
sh -vx /etc/rc.d/rc.httpd restart
Quote:
Originally Posted by GazL View Post
'dhcpcd -k' or 'dhcpcd -x'.
dhcpcd != dhcpd != httpd
 
2 members found this post helpful.
Old 11-02-2023, 10:32 AM   #8
gus3
Member
 
Registered: Jun 2014
Distribution: Slackware
Posts: 490

Rep: Reputation: Disabled
Quote:
Originally Posted by Petri Kaukasoina View Post
dhcpcd != dhcpd != httpd
That was my (really stupid) goof.

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.
 
Old 11-02-2023, 11:21 AM   #9
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by Petri Kaukasoina View Post
dhcpcd != dhcpd
Oops!
 
Old 11-02-2023, 12:14 PM   #10
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,795

Rep: Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474Reputation: 1474
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.

I noticed this in https://www.isc.org/dhcp/:
Quote:
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 ...
This is the new one: https://www.isc.org/download/#Kea
In slackbuilds.org: https://slackbuilds.org/repository/15.0/network/kea/
 
2 members found this post helpful.
Old 11-03-2023, 07:38 PM   #11
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Original Poster
Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by Petri Kaukasoina View Post
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.

I noticed this in https://www.isc.org/dhcp/:

This is the new one: https://www.isc.org/download/#Kea
In slackbuilds.org: https://slackbuilds.org/repository/15.0/network/kea/
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.
 
Old 11-06-2023, 12:13 PM   #12
HQuest
Member
 
Registered: Jan 2018
Location: 2001:470:c2d0::/56
Distribution: Anyone that I can interface with
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
who the devil restarts their dhcpd while the system is running?
Me reading this thread:
Attached Thumbnails
Click image for larger version

Name:	dd0.png
Views:	15
Size:	229.8 KB
ID:	42005  
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing /etc/init.d/dhcpd from ISC DHCPD Quigi Linux - Networking 4 03-27-2008 08:50 PM
/etc/dhcpd.conf or /ltsp/dhcpd.conf ? maxsanders Ubuntu 1 07-07-2007 06:32 AM
dhcpd subnet declaration problems in dhcpd.conf vcrispo Linux - Networking 6 07-15-2005 10:32 AM
DHCPD startup failure, mdk 9.2, dhcpd v3.0.1rc11 fuzzyworm Linux - Networking 1 02-14-2004 03:58 AM
dhcpd.master or dhcpd.conf rickg Linux - Networking 0 04-11-2002 03:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration