Bug#868240: isc-dhcp-server refuses to start if pidfile is present even when dhcpd is not running

2021-05-06 Thread Nuno Oliveira

Hi,

I have a setup with 2 redundant (primary / secondary) DHCPd servers 
where both of them crash occasionally. This is a separate bug, but this 
solution was useful in restarting the daemons after crashing and leaving 
the pid files behind.


To automatically restart the daemons after this modification is 
introduced, edit the systemd service description with


systemctl edit isc-dhcp-server.service

and add something like

[Service]
Type=forking
PIDFile=dhcpd.pid
Restart=on-failure
StartLimitIntervalSec=60s
StartLimitBurst=8
RestartSec=5s

in the appropriate section. Then enable this configuration, and systemd 
will be able to restart DHCPd after they crash.




Bug#868240: isc-dhcp-server refuses to start if pidfile is present even when dhcpd is not running

2019-02-07 Thread Antoine JOUBERT

Hi,

I encountered the same issue after a crash of the dhcpd process. The 
daemon could not be restarted without deleting the old PID file first.


I modified the /etc/init.d/isc-dhcp-server script on my servers from :

|if [ -e "$PIDFILE" ]; then log_failure_msg "dhcpd service already 
running (pid file $PIDFILE currenty exists)" exit 1 fi|



To :

|if [ -e "$PIDFILE" ]; then if read pid < "$PIDFILE" && ps -p "$pid" > 
/dev/null 2>&1; then log_failure_msg "dhcpd service already running (pid 
file $PIDFILE currenty exists)" exit 1 fi fi|




Bug#868240: isc-dhcp-server refuses to start if pidfile is present even when dhcpd is not running

2017-07-13 Thread Samuli Seppänen
Package: isc-dhcp-server
Version: 4.3.5-3
Severity: normal

Dear Maintainer,

The isc-dhcp-server service refuses to start ("systemctl start 
isc-dhcp-server") 
if the pidfile (/run/dhcpd.pid) is present, even if dhcpd is
not running. Reproducing this is easy given working dhcpd configuration:

  $ systemctl start isc-dhcp-server
  $ cat /run/dhcpd.pid|xargs kill
  $ systemctl start isc-dhcp-server

Now dhcpd will not be running:

  $ ps aux|grep dhcpd

This is problematic if the service has crashed abnormally, as external 
monitoring systems like monit won't be able to restart the service easily.

The problem is on lines 102-105 in /etc/init.d/isc-dhcp-server:

if [ -e "$PIDFILE" ]; then
log_failure_msg "dhcpd service already running (pid file $PIDFILE 
currenty exists)"
exit 1
fi

Interestingly the status target can already handle the "pidfile is present but 
dhcpd is not running" case, see line 83:

test "$OPTION" != -v || echo "$NAME is not running but $PIDFILE exists."

Removing the pidfile manually before starting the service solves the problem.

I would expect the init script to start dhcpd if it is not running, even if
pidfile is present.

-- System Information:
Debian Release: 9.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages isc-dhcp-server depends on:
ii  debconf [debconf-2.0]  1.5.61
ii  debianutils4.8.1.1
ii  libc6  2.24-11
ii  libdns-export162   1:9.10.3.dfsg.P4-12.3
ii  libirs-export141   1:9.10.3.dfsg.P4-12.3
ii  libisc-export160   1:9.10.3.dfsg.P4-12.3
ii  lsb-base   9.20161125

Versions of packages isc-dhcp-server recommends:
ii  isc-dhcp-common  4.3.5-3
ii  policycoreutils  2.6-3

Versions of packages isc-dhcp-server suggests:
pn  isc-dhcp-server-ldap  
ii  policykit-1   0.105-18

-- Configuration Files:
/etc/dhcp/dhcpd.conf changed [not included]

-- debconf information excluded