upstart vs sysV init script pid-file-name conflict
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hi,
the pid-file-name for upstart is hardcoded in /etc/init/
So the sysV script reports incorrectly that the isc-dhcp-server is not running and/or that it failed to stop the already running isc-dhcp-server daemon.
-------
root@d01-
dhcpd 1265 1 0 Apr07 ? 00:00:30 dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-
ntp 10244 1 0 Apr14 ? 00:01:01 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/
root 21809 21382 0 09:16 pts/2 00:00:00 grep --color=auto dhc
root@d01-
+ PATH=/sbin:
+ test -f /usr/sbin/dhcpd
+ DHCPD_DEFAULT=
+ '[' '!' -f /etc/default/
+ . /lib/lsb/
+++ run-parts --lsbsysinit --list /lib/lsb/
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/
++ '[' -r /lib/lsb/
++ . /lib/lsb/
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/
++ '[' -r /lib/lsb/
++ . /lib/lsb/
+++ LOG_DAEMON_MSG=
++ FANCYTTY=
++ '[' -e /etc/lsb-
++ true
+ '[' -f /etc/default/
+ . /etc/default/
++ INTERFACES=eth0
+ NAME=dhcpd
+ DESC='ISC DHCP server'
+ DHCPD_CONF=
+ '[' -z '' ']'
++ sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p'
++ head -n 1
+ DHCPD_PID=
+ DHCPD_PID=
+ case "$1" in
+ log_daemon_msg 'Stopping ISC DHCP server' dhcpd
+ '[' -z 'Stopping ISC DHCP server' ']'
+ log_use_
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ '[' -t 1 ']'
+ '[' xxterm-256color '!=' x ']'
+ '[' xxterm-256color '!=' xdumb ']'
+ '[' -x /usr/bin/tput ']'
+ '[' -x /usr/bin/expr ']'
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ '[' -z ']'
+ FANCYTTY=1
+ case "$FANCYTTY" in
+ true
+ /usr/bin/tput xenl
++ /usr/bin/tput cols
+ COLS=106
+ '[' 106 ']'
+ '[' 106 -gt 6 ']'
++ /usr/bin/expr 106 - 7
+ COL=99
+ log_use_plymouth
+ '[' n = y ']'
+ plymouth --ping
+ printf ' * Stopping ISC DHCP server dhcpd '
* Stopping ISC DHCP server dhcpd ++ /usr/bin/expr 106 - 1
+ /usr/bin/tput hpa 105
+ start-stop-daemon --stop --quiet --pidfile /var/run/dhcpd.pid
+ log_end_msg 1
+ '[' -z 1 ']'
+ '[' 99 ']'
+ '[' -x /usr/bin/tput ']'
+ log_use_plymouth
+ '[' n = y ']'
+ plymouth --ping
+ printf '\r'
+ /usr/bin/tput hpa 99
+ printf '['
[+ /usr/bin/tput setaf 1
+ printf fail
fail+ /usr/bin/tput op
+ echo ']'
]
+ return 1
+ rm -f /var/run/dhcpd.pid
+ exit 0
root@d01-
cat: /var/run/dhcpd.pid: No such file or directory
root@d01-svi-22:~# status isc-dhcp-server
isc-dhcp-server start/running, process 1265
root@d01-svi-22:~# stop isc-dhcp-server
isc-dhcp-server stop/waiting
root@d01-svi-22:~# status isc-dhcp-server
isc-dhcp-server stop/waiting
-------
Even if you add the pid-file-name setting to your dhcpd.conf the sysV script fails to determine the correct pidfile due to a regex error as shown below:
-------
root@d01-
Status of ISC DHCP server: dhcpd is not running.
root@d01-
sed: -e expression #1, char 49: invalid reference \1 on `s' command's RHS
root@d01-
pid-file-name "/run/dhcp-
root@d01-
/run/dhcp-
-------
Regards,
Ralf
PS: upstart will ignore the default config path of "/etc/dhcp/
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: isc-dhcp-server 4.2.4-7ubuntu12
ProcVersionSign
Uname: Linux 3.13.0-48-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.10
Architecture: amd64
Date: Mon Apr 20 10:18:40 2015
SourcePackage: isc-dhcp
UpgradeStatus: No upgrade log present (probably fresh install)
modified.
mtime.conffile.
mtime.conffile.
Here is another Patch, I choose to disable the sysV script if upstart is being used. I "borrowed" the code from "openssh-server: /etc/init.d/ssh".