← Back to team overview

touch-packages team mailing list archive

[Bug 1446103] [NEW] upstart vs sysV init script pid-file-name conflict

 

Public bug reported:

Hi,

the pid-file-name for upstart is hardcoded in /etc/init/isc-dhcp-
server.conf to "/run/dhcp-server/dhcpd.pid" while /etc/init.d/isc-dhcp-
server tries to parse "/etc/dhcp/dhcpd.conf" (and fails due to an regex
error) for the setting "pid-file-name" and defaults back to
"/var/run/dhcpd.pid" (which does not exist if started by upstart).

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.

----------------cut--------------------------
root@d01-svi-22:/proc/1265# ps -efa | grep dhc
dhcpd     1265     1  0 Apr07 ?        00:00:30 dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf eth0
ntp      10244     1  0 Apr14 ?        00:01:01 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 105:112
root     21809 21382  0 09:16 pts/2    00:00:00 grep --color=auto dhc
root@d01-svi-22:/proc/1265# bash -x /etc/init.d/isc-dhcp-server stop
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
+ test -f /usr/sbin/dhcpd
+ DHCPD_DEFAULT=/etc/default/isc-dhcp-server
+ '[' '!' -f /etc/default/isc-dhcp-server ']'
+ . /lib/lsb/init-functions
+++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
++ . /lib/lsb/init-functions.d/20-left-info-blocks
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/50-ubuntu-logging ']'
++ . /lib/lsb/init-functions.d/50-ubuntu-logging
+++ LOG_DAEMON_MSG=
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ '[' -f /etc/default/isc-dhcp-server ']'
+ . /etc/default/isc-dhcp-server
++ INTERFACES=eth0
+ NAME=dhcpd
+ DESC='ISC DHCP server'
+ DHCPD_CONF=/etc/dhcp/dhcpd.conf
+ '[' -z '' ']'
++ sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p'
++ head -n 1
+ DHCPD_PID=
+ DHCPD_PID=/var/run/dhcpd.pid
+ case "$1" in
+ log_daemon_msg 'Stopping ISC DHCP server' dhcpd
+ '[' -z 'Stopping ISC DHCP server' ']'
+ log_use_fancy_output
+ 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
                                                                                                         + printf ' '
 + 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
                                                                                                   + '[' 1 -eq 0 ']'
+ 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-svi-22:/proc/1265# cat /var/run/dhcpd.pid
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
----------------cut--------------------------

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:

----------------cut--------------------------
root@d01-svi-22:/etc/dhcp#  /etc/init.d/isc-dhcp-server status
Status of ISC DHCP server: dhcpd is not running.

root@d01-svi-22:/etc/dhcp# sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p' < /etc/dhcp/dhcpd.conf 
sed: -e expression #1, char 49: invalid reference \1 on `s' command's RHS

root@d01-svi-22:/etc/dhcp# grep pid-file-name /etc/dhcp/dhcpd.conf
pid-file-name	"/run/dhcp-server/dhcpd.pid";

root@d01-svi-22:/etc/dhcp# sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < /etc/dhcp/dhcpd.conf 
/run/dhcp-server/dhcpd.pid
----------------cut--------------------------

Regards,
Ralf

PS: upstart will ignore the default config path of
"/etc/dhcp/dhcpd.conf" if "/etc/ltsp/dhcpd.conf" exists, but /etc/init.d
/isc-dhcp-server has no support for this.

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: isc-dhcp-server 4.2.4-7ubuntu12
ProcVersionSignature: Ubuntu 3.13.0-48.80-generic 3.13.11-ckt16
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.conffile..etc.dhcp.dhcpd.conf: [modified]
mtime.conffile..etc.dhcp.dhcpd.conf: 2015-04-20T09:48:33.537686
mtime.conffile..etc.init.d.isc.dhcp.server: 2015-04-20T10:03:05.513855

** Affects: isc-dhcp (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug trusty

** Patch added: "regex fix"
   https://bugs.launchpad.net/bugs/1446103/+attachment/4379853/+files/isc-dhcp-server.regex.patch

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to isc-dhcp in Ubuntu.
https://bugs.launchpad.net/bugs/1446103

Title:
  upstart vs sysV init script pid-file-name conflict

Status in isc-dhcp package in Ubuntu:
  New

Bug description:
  Hi,

  the pid-file-name for upstart is hardcoded in /etc/init/isc-dhcp-
  server.conf to "/run/dhcp-server/dhcpd.pid" while /etc/init.d/isc-
  dhcp-server tries to parse "/etc/dhcp/dhcpd.conf" (and fails due to an
  regex error) for the setting "pid-file-name" and defaults back to
  "/var/run/dhcpd.pid" (which does not exist if started by upstart).

  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.

  ----------------cut--------------------------
  root@d01-svi-22:/proc/1265# ps -efa | grep dhc
  dhcpd     1265     1  0 Apr07 ?        00:00:30 dhcpd -user dhcpd -group dhcpd -f -q -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf eth0
  ntp      10244     1  0 Apr14 ?        00:01:01 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 105:112
  root     21809 21382  0 09:16 pts/2    00:00:00 grep --color=auto dhc
  root@d01-svi-22:/proc/1265# bash -x /etc/init.d/isc-dhcp-server stop
  + PATH=/sbin:/bin:/usr/sbin:/usr/bin
  + test -f /usr/sbin/dhcpd
  + DHCPD_DEFAULT=/etc/default/isc-dhcp-server
  + '[' '!' -f /etc/default/isc-dhcp-server ']'
  + . /lib/lsb/init-functions
  +++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
  ++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
  ++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
  ++ . /lib/lsb/init-functions.d/20-left-info-blocks
  ++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
  ++ '[' -r /lib/lsb/init-functions.d/50-ubuntu-logging ']'
  ++ . /lib/lsb/init-functions.d/50-ubuntu-logging
  +++ LOG_DAEMON_MSG=
  ++ FANCYTTY=
  ++ '[' -e /etc/lsb-base-logging.sh ']'
  ++ true
  + '[' -f /etc/default/isc-dhcp-server ']'
  + . /etc/default/isc-dhcp-server
  ++ INTERFACES=eth0
  + NAME=dhcpd
  + DESC='ISC DHCP server'
  + DHCPD_CONF=/etc/dhcp/dhcpd.conf
  + '[' -z '' ']'
  ++ sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p'
  ++ head -n 1
  + DHCPD_PID=
  + DHCPD_PID=/var/run/dhcpd.pid
  + case "$1" in
  + log_daemon_msg 'Stopping ISC DHCP server' dhcpd
  + '[' -z 'Stopping ISC DHCP server' ']'
  + log_use_fancy_output
  + 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
                                                                                                           + printf ' '
   + 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
                                                                                                     + '[' 1 -eq 0 ']'
  + 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-svi-22:/proc/1265# cat /var/run/dhcpd.pid
  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
  ----------------cut--------------------------

  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:

  ----------------cut--------------------------
  root@d01-svi-22:/etc/dhcp#  /etc/init.d/isc-dhcp-server status
  Status of ISC DHCP server: dhcpd is not running.

  root@d01-svi-22:/etc/dhcp# sed -n -e 's/^[ \t]*pid-file-name[ \t]*"(.*)"[ \t]*;.*$/\1/p' < /etc/dhcp/dhcpd.conf 
  sed: -e expression #1, char 49: invalid reference \1 on `s' command's RHS

  root@d01-svi-22:/etc/dhcp# grep pid-file-name /etc/dhcp/dhcpd.conf
  pid-file-name	"/run/dhcp-server/dhcpd.pid";

  root@d01-svi-22:/etc/dhcp# sed -n -e 's/^[ \t]*pid-file-name[ \t]*"\(.*\)"[ \t]*;.*$/\1/p' < /etc/dhcp/dhcpd.conf 
  /run/dhcp-server/dhcpd.pid
  ----------------cut--------------------------

  Regards,
  Ralf

  PS: upstart will ignore the default config path of
  "/etc/dhcp/dhcpd.conf" if "/etc/ltsp/dhcpd.conf" exists, but
  /etc/init.d/isc-dhcp-server has no support for this.

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: isc-dhcp-server 4.2.4-7ubuntu12
  ProcVersionSignature: Ubuntu 3.13.0-48.80-generic 3.13.11-ckt16
  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.conffile..etc.dhcp.dhcpd.conf: [modified]
  mtime.conffile..etc.dhcp.dhcpd.conf: 2015-04-20T09:48:33.537686
  mtime.conffile..etc.init.d.isc.dhcp.server: 2015-04-20T10:03:05.513855

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1446103/+subscriptions


Follow ups

References