ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1406

dpkg init scripts don't restart - missing check_priv_sep_dir

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.4.3
    • Fix Version/s: 3.4.4, 3.5.0
    • Component/s: scripts
    • Labels:
      None
    • Environment:

      Linux Ubuntu 10.4 lucid - presumably affects debian too, but not tested here

    • Hadoop Flags:
      Reviewed

      Description

      The included init.d script for dpkg creation doesn't restart.

      It exits with the following error:

      # /etc/init.d/zookeeper restart
      /etc/init.d/zookeeper: 127: check_privsep_dir: not found

      Also the actual zkServer.sh line in restart has a path of .../bin/ rather than .../sbin/

      1. ZOOKEEPER-1406.patch
        2 kB
        Chris Beauchamp

        Activity

        Hide
        Chris Beauchamp added a comment -
        --- zookeeper/zookeeper-3.4.3/src/packages/deb/init.d/zookeeper	2012-02-06 10:48:40.000000000 +0000
        +++ zookeeper.new	2012-03-06 08:37:57.566109535 +0000
        @@ -34,7 +34,17 @@
         
         . /lib/lsb/init-functions
         
        -ZOOPIDFILE=/var/lib/zookeeper/data/zookeeper_server.pid
        +ZOOPIDDIR=/var/lib/zookeeper/data
        +ZOOPIDFILE=${ZOOPIDDIR}/zookeeper_server.pid
        +
        +check_privsep_dir() {
        +    # Create the PrivSep empty dir if necessary
        +    if [ ! -d ${ZOOPIDDIR} ]; then
        +	mkdir -p ${ZOOPIDDIR}
        +        chown zookeeper:hadoop ${ZOOPIDDIR}
        +	chmod 0775 ${ZOOPIDDIR} 
        +    fi
        +}
         
         # Are we running from init?
         run_by_init() {
        @@ -59,6 +69,7 @@
         case "$1" in
           start)
         	check_for_no_start
        +	check_privsep_dir
         	log_daemon_msg "Starting Apache ZooKeeper server" "zookeeper"
         	if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then
         	    log_end_msg 0
        @@ -80,7 +91,7 @@
         	log_daemon_msg "Restarting Apache ZooKeeper server" "zookeeper"
         	start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${ZOOPIDFILE}
         	check_for_no_start log_end_msg
        -	if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then
        +	if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then
         	    log_end_msg 0
         	else
         	    log_end_msg 1
        @@ -98,7 +109,7 @@
         	    0)
         		# old daemon stopped
         		check_for_no_start log_end_msg
        -		if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then
        +		if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then
         		    log_end_msg 0
         		else
         		    log_end_msg 1
        
        Show
        Chris Beauchamp added a comment - --- zookeeper/zookeeper-3.4.3/src/packages/deb/init.d/zookeeper 2012-02-06 10:48:40.000000000 +0000 +++ zookeeper.new 2012-03-06 08:37:57.566109535 +0000 @@ -34,7 +34,17 @@ . /lib/lsb/init-functions -ZOOPIDFILE=/var/lib/zookeeper/data/zookeeper_server.pid +ZOOPIDDIR=/var/lib/zookeeper/data +ZOOPIDFILE=${ZOOPIDDIR}/zookeeper_server.pid + +check_privsep_dir() { + # Create the PrivSep empty dir if necessary + if [ ! -d ${ZOOPIDDIR} ]; then + mkdir -p ${ZOOPIDDIR} + chown zookeeper:hadoop ${ZOOPIDDIR} + chmod 0775 ${ZOOPIDDIR} + fi +} # Are we running from init? run_by_init() { @@ -59,6 +69,7 @@ case "$1" in start) check_for_no_start + check_privsep_dir log_daemon_msg "Starting Apache ZooKeeper server" "zookeeper" if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then log_end_msg 0 @@ -80,7 +91,7 @@ log_daemon_msg "Restarting Apache ZooKeeper server" "zookeeper" start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${ZOOPIDFILE} check_for_no_start log_end_msg - if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then + if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then log_end_msg 0 else log_end_msg 1 @@ -98,7 +109,7 @@ 0) # old daemon stopped check_for_no_start log_end_msg - if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then + if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c zookeeper -x ${ZOOKEEPER_PREFIX}/sbin/zkServer.sh start; then log_end_msg 0 else log_end_msg 1
        Hide
        Chris Beauchamp added a comment -

        Have attached a patch which should fix it - check_privsep_dir shamelessly lifted from hadoop's init script and other minor tweaks

        Show
        Chris Beauchamp added a comment - Have attached a patch which should fix it - check_privsep_dir shamelessly lifted from hadoop's init script and other minor tweaks
        Hide
        Patrick Hunt added a comment -

        Great artists steal. Thanks. Would you mind attaching that as a patch file? (and select the "grant" option when doing so).
        https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute
        Regards.

        Show
        Patrick Hunt added a comment - Great artists steal. Thanks. Would you mind attaching that as a patch file? (and select the "grant" option when doing so). https://cwiki.apache.org/confluence/display/ZOOKEEPER/HowToContribute Regards.
        Hide
        Chris Beauchamp added a comment -

        Patch Attached

        Show
        Chris Beauchamp added a comment - Patch Attached
        Hide
        Chris Beauchamp added a comment -

        All done, hopefully in the right way - thanks.

        Show
        Chris Beauchamp added a comment - All done, hopefully in the right way - thanks.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12517398/ZOOKEEPER-1406.patch
        against trunk revision 1297740.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed core unit tests.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12517398/ZOOKEEPER-1406.patch against trunk revision 1297740. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-Build/980//console This message is automatically generated.
        Hide
        Patrick Hunt added a comment -

        Thanks Chris!

        Show
        Patrick Hunt added a comment - Thanks Chris!
        Hide
        Hudson added a comment -

        Integrated in ZooKeeper-trunk #1498 (See https://builds.apache.org/job/ZooKeeper-trunk/1498/)
        ZOOKEEPER-1406. dpkg init scripts don't restart - missing check_priv_sep_dir (Chris Beauchamp via phunt) (Revision 1302069)

        Result = SUCCESS
        phunt : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1302069
        Files :

        • /zookeeper/trunk/CHANGES.txt
        • /zookeeper/trunk/src/packages/deb/init.d/zookeeper
        Show
        Hudson added a comment - Integrated in ZooKeeper-trunk #1498 (See https://builds.apache.org/job/ZooKeeper-trunk/1498/ ) ZOOKEEPER-1406 . dpkg init scripts don't restart - missing check_priv_sep_dir (Chris Beauchamp via phunt) (Revision 1302069) Result = SUCCESS phunt : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1302069 Files : /zookeeper/trunk/CHANGES.txt /zookeeper/trunk/src/packages/deb/init.d/zookeeper

          People

          • Assignee:
            Chris Beauchamp
            Reporter:
            Chris Beauchamp
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development