bind 9.3.5-P2 init.d script

ListAcc listacc at ocosa.com
Thu Aug 21 19:54:40 UTC 2008


Linux Addict wrote:
> ListAcc wrote:
>> Linux Addict wrote:
>>> ListAcc wrote:
>>>> Linux Addict wrote:
>>>>> ListAcc wrote:
>>>>>> Adam Tkac wrote:
>>>>>>  
>>>>>>> On Tue, Aug 19, 2008 at 09:55:30PM -0500, ListAcc wrote:
>>>>>>>  
>>>>>>>> Hello,
>>>>>>>>           
>>>>>>> Hi,
>>>>>>>
>>>>>>>  
>>>>>>>> I have removed Bind 9.4.2 from CentOS with yum and compiled 
>>>>>>>> Bind 9.3.5-P2.  I am having trouble using the old init script 
>>>>>>>> from the rpm setup previously installed.  Bind will not start 
>>>>>>>> but will stop fine.  It is chroot the same as the rpm.  I did 
>>>>>>>> not create the proc directory if this helps...I can't seem to 
>>>>>>>> find the culprit.
>>>>>>>>
>>>>>>>>           
>>>>>>> Did you check system log? Why exactly named won't start?
>>>>>>>
>>>>>>> Adam
>>>>>>>
>>>>>>>       
>>>>>> Adam it does not say anything in /var/log/messages  also when I 
>>>>>> type service named start nothing happens but when I type service 
>>>>>> named stop it shows:
>>>>>> Stopping named:                                            [  OK  ]
>>>>>>
>>>>>> --Otis
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   
>>>>> Did you update the /etc/sysconfig/named with your chroot dir?
>>>>>
>>>>> Enabe the named script verbose #!/bin/bash -xv and check what 
>>>>> variables are missing.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> Linux Addict - I have verified the chroot directory in 
>>>> /etc/sysconfig/named and still nothing but service named stop works 
>>>> find.  Also I even recompiled with ./configure --with-openssl && 
>>>> make && make install nothing. I am completely bummed.  Again logs 
>>>> say nothing.  Starting with named -g works fine. What do you think?
>>>>
>>>> --Otis
>>>>
>>>>
>>> Can you please post the output of " bash -xv /etc/init.d/named start 
>>> " ?
>>>
>> Here you go:
>>
>> start() {
>>
>>        [ -x /usr/sbin/$named ] || exit 5
>>
>>        if [ ! -r ${ROOTDIR}${named_conf} ] ; then
>>           if [ -z "$named_c_option" ] && [ -r 
>> ${ROOTDIR}/etc/named.conf ]; then
>>               named_conf='/etc/etc/named.conf';
>>               OPTIONS="$OPTIONS -c ${named_conf}";
>>           else
>>               echo Locating $ROOTDIR/${named_conf} failed:
>>               failure
>>               echo;
>>               exit 6;
>>           fi;
>>        fi;
>>
>>        # Start daemons.
>>        echo -n $"Starting $named: "
>>        if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
>>                echo -n $"$named: already running"
>>                failure
>>                echo
>>                return 1
>>        fi
>>        ckcf_options='-z'; # enable named-checkzone for each zone 
>> (9.3.1+) !
>>        if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
>>                OPTIONS="${OPTIONS} -t ${ROOTDIR}"
>>                ckcf_options="$ckcf_options -t ${ROOTDIR}";
>>                if [ -s /etc/localtime ]; then
>>                    cp -fp /etc/localtime ${ROOTDIR}/etc/localtime
>>                fi;
>>                if [ ! -d ${ROOTDIR}/proc ]; then
>>                    mkdir -p ${ROOTDIR}/proc
>>                fi
>>                if ! egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' 
>> /proc/mounts; then
>>                    mount --bind -n /proc ${ROOTDIR}/proc >/dev/null 2>&1
>>                fi
>>                if [ $dbusEnabled -eq 1 ]; then
>>                    if ! egrep -q 
>> '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; 
>> then
>>                        mkdir -p ${ROOTDIR}/var/run/dbus
>>                        if [ ! -d  /var/run/dbus ] ; then
>>                            mkdir -p /var/run/dbus ;
>>                        fi;
>>                        mount --bind -n /var/run/dbus 
>> ${ROOTDIR}/var/run/dbus > /dev/null 2>&1;
>>                    fi;
>>                fi;
>>        fi
>>        no_write_master_zones=0
>>        if [ -e /etc/selinux/config ]; then
>>           .  /etc/selinux/config
>>           if [[ ( "$SELINUX" != 'disabled') && ("$SELINUXTYPE" != "") 
>> && (-d /etc/selinux/${SELINUXTYPE}) && (-e 
>> /etc/selinux/${SELINUXTYPE}/booleans || (-e 
>> /etc/selinux/${SELINUXTYPE}/booleans.local)) ]]; then
>>               if [ -e /etc/selinux/${SELINUXTYPE}/booleans.local ]; then
>>                   . /etc/selinux/${SELINUXTYPE}/booleans.local;
>>               else
>>                   . /etc/selinux/${SELINUXTYPE}/booleans;
>>               fi;
>>               if echo "$named_write_master_zones" | /bin/egrep -q 
>> '^[0-9]+$'; then
>>                   if [ "$named_write_master_zones" -eq 1 ] ; then
>>                       /bin/chown -f --from=root:named named:named 
>> $ROOTDIR/var/named
>>                   elif [ "$named_write_master_zones" -eq 0 ] ; then
>>                       /bin/chown -f --from=named:named root:named 
>> $ROOTDIR/var/named
>>                   fi;
>>               fi;
>>           else
>>               no_write_master_zones=1
>>           fi;
>>        else
>>            no_write_master_zones=1
>>        fi;
>>        if [ "$no_write_master_zones" -eq 1 ]; then
>>            if [[ "$ENABLE_ZONE_WRITE" =  [yY1]* ]]; then
>>                /bin/chown -f --from=root:named named:named 
>> $ROOTDIR/var/named
>>            elif [[ "$ENABLE_ZONE_WRITE" =  [nN0]* ]]; then
>>                /bin/chown -f --from=named:named root:named 
>> $ROOTDIR/var/named
>>            fi;
>>        fi
>>        conf_ok=0;
>>        if [ -x /usr/sbin/named-checkconf ] && [ -x 
>> /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf 
>> $ckcf_options ${named_conf} >/dev/null 2>&1; then
>>           conf_ok=1;
>>        else
>>           RETVAL=$?;
>>        fi
>>        if [ $conf_ok -eq 1 ]; then
>>           daemon /usr/sbin/$named -u named ${OPTIONS};
>>           RETVAL=$?;
>>           if [ $RETVAL -eq 0 ]; then
>>               rm -f /var/run/named.pid
>>               rm -f /var/run/named_sdb.pid 2>/dev/null
>>               ln -s $ROOTDIR/var/run/named/named.pid /var/run/named.pid;
>>               if [ "$named" = "named_sdb" ]; then
>>                   ln -s $ROOTDIR/var/run/named/named.pid 
>> /var/run/named_sdb.pid;
>>               fi;
>>           fi;
>>           if [ -n "`/sbin/pidof -o %PPID $named`" ]; then
>>               # Verify that named actually started (JM 2006-10-04)
>>               if [ ! -e $ROOTDIR/var/run/named/named.pid ]; then
>>                  # If there is not a file containing the PID of the 
>> now running named daemon then create it (JM 2006-10-04)
>>                  echo `/sbin/pidof -o %PPID $named` > 
>> $ROOTDIR/var/run/named/named.pid;
>>                  if [ "$named" = "named_sdb" ]; then
>>                     echo `/sbin/pidof -o %PPID $named` > 
>> $ROOTDIR/var/run/named/named_sdb.pid;
>>                  fi;
>>               fi;
>>           fi;
>>        else
>>           named_err="`/usr/sbin/named-checkconf $ckcf_options 
>> $named_conf 2>&1`";
>>           echo
>>           echo $"Error in named configuration"':';
>>           echo "$named_err";
>>           failure
>>           echo
>>           if [ -x /usr/bin/logger ]; then
>>               echo "$named_err" | /usr/bin/logger -pdaemon.error -tnamed
>>           fi;
>>           return 7;
>>        fi;
>>        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named
>>        echo
>>        return $RETVAL
>> }
>> stop() {
>>        # Stop daemons.
>>        echo -n $"Stopping $named: "
>>        /usr/sbin/rndc stop >/dev/null 2>&1
>>        RETVAL=$?
>>        [ "$RETVAL" -eq 0 ] || killproc "$named" -TERM >/dev/null 2>&1
>>
>>        timeout=0
>>        RETVAL=0
>>        while /sbin/pidof -o %PPID "$named" >/dev/null; do
>>                if [ $timeout -ge $NAMED_SHUTDOWN_TIMEOUT ]; then
>>                        RETVAL=1
>>                        break
>>                else
>>                        sleep 2 && echo -n "."
>>                        timeout=$((timeout+2))
>>                fi;
>>        done
>>        if [ $RETVAL -eq 0 ]; then
>>            rm -f /var/lock/subsys/named
>>            rm -f /var/run/named.pid
>>            rm -f /var/run/named_sdb.pid 2>/dev/null
>>        fi;
>>        if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
>>            if egrep -q '^/proc[[:space:]]+'${ROOTDIR}'/proc' 
>> /proc/mounts; then
>>               umount ${ROOTDIR}/proc >/dev/null 2>&1
>>            fi
>>            if [ $dbusEnabled -eq 1 ]; then
>>               if egrep -q 
>> '^/[^[:space:]]+[[:space:]]+'${ROOTDIR}'/var/run/dbus' /proc/mounts; 
>> then
>>                  umount ${ROOTDIR}/var/run/dbus > /dev/null 2>&1
>>               fi;
>>            fi;
>>        fi;
>>        if [ $RETVAL -eq 0 ]; then
>>            success
>>        else
>>            failure
>>        fi;
>>        echo
>>        return $RETVAL
>> }
>> rhstatus() {
>>        /usr/sbin/rndc status
>>        status /usr/sbin/$named
>>        return $?
>> }
>> restart() {
>>        stop
>> # wait a couple of seconds for the named to finish closing down
>>        sleep 2
>>        start
>> }
>> reload() {
>>        echo -n $"Reloading $named: "
>>        p=`/sbin/pidof -o %PPID $named`
>>        RETVAL=$?
>>        if [ "$RETVAL" -eq 0 ]; then
>>            /usr/sbin/rndc reload >/dev/null 2>&1 || /bin/kill -HUP $p;
>>            RETVAL=$?
>>        fi
>>        [ "$RETVAL" -eq 0 ] && success $"$named reload" || failure 
>> $"$named reload"
>>        echo
>>        return $?
>> }
>> probe() {
>>        # named knows how to reload intelligently; we don't want 
>> linuxconf
>>        # to offer to restart every time
>>        /usr/sbin/rndc reload >/dev/null 2>&1 || echo start
>>        return $?
>> }
>> checkconfig() {
>>        ckcf_options='-z'; # enable named-checkzone for each zone 
>> (9.3.1+) !
>>        if [ -n "${ROOTDIR}" -a "x${ROOTDIR}" != "x/" ]; then
>>                OPTIONS="${OPTIONS} -t ${ROOTDIR}"
>>                ckcf_options="$ckcf_options -t ${ROOTDIR}";
>>        fi;
>>        if [ -x /usr/sbin/named-checkconf ] && [ -x 
>> /usr/sbin/named-checkzone ] && /usr/sbin/named-checkconf 
>> $ckcf_options ${named_conf} | cat ; then
>>            return 0;
>>        else
>>            return 1;
>>        fi
>> }
>>
>> # See how we were called.
>> case "$1" in
>>        start)
>>                start
>>                ;;
>>        stop)
>>                stop
>>                ;;
>>        status)
>>                rhstatus
>>                ;;
>>        restart)
>>                restart
>>                ;;
>>        condrestart)
>>                [ -e /var/lock/subsys/named ] && restart;
>>                ;;
>>        reload)
>>                reload
>>                ;;
>>        probe)
>>                probe
>>                ;;
>>        checkconfig|configtest|check|test) ROOTDIR/${named_conf} failed:
>>                checkconfig
>>                ;;
>>        *)
>>                echo $"Usage: $0 
>> {start|stop|status|restart|condrestart|reload|configtest|probe}"
>>                exit 2
>> esac
>> + case "$1" in
>> + start
>> + '[' -x /usr/sbin/named ']'
>> + exit 5
>>
>>
>> --Otis
>>
>>
>
> This is what your problem is:
>
> ROOTDIR/${named_conf} failed:
>
> If you are running on chroot environment, make sure named.conf placed 
> correctly. So it will be "ROOTDIR Value in etc sysconfig named" 
> /named.conf
>
> ~LA
>
>
LA,

I had named.conf placed in /var/named/chroot/etc/named.conf and a 
symbolic to it also at /etc/named.conf

Otis



More information about the bind-users mailing list