• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Bind doesn't run

I had the same problem. The solution is quite simple: paste (maybe you should do a backup before) this text in your /etc/init.d/bind9:

Code:
#!/bin/sh -e

### BEGIN INIT INFO
# Provides:          bind9
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Should-Start:      $network $syslog
# Should-Stop:       $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop bind9
# Description:       bind9 is a Domain Name Server (DNS)
#        which translates ip addresses to and from internet names
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

# for a chrooted server: "-u bind -t /var/lib/named"
# Don't modify this line, change or create /etc/default/bind9.
OPTIONS=""
RESOLVCONF=no

test -f /etc/default/bind9 && . /etc/default/bind9

test -x /usr/sbin/rndc || exit 0

. /lib/lsb/init-functions
PIDFILE=/var/run/named/named.pid

check_network() {
    if [ -x /usr/bin/uname ] && [ "X$(/usr/bin/uname -o)" = XSolaris ]; then
	IFCONFIG_OPTS="-au"
    else
	IFCONFIG_OPTS=""
    fi
    if [ -z "$(/sbin/ifconfig $IFCONFIG_OPTS)" ]; then
       #log_action_msg "No networks configured."
       return 1
    fi
    return 0
}

case "$1" in
    start)
	log_daemon_msg "Starting domain name service..." "bind9"

	modprobe capability >/dev/null 2>&1 || true

	# dirs under /var/run can go away on reboots.
	mkdir -p /var/run/named
	chmod 775 /var/run/named
	chown root:bind /var/run/named >/dev/null 2>&1 || true

	if [ ! -x /usr/sbin/named ]; then
	    log_action_msg "named binary missing - not starting"
	    log_end_msg 1
	fi

	if ! check_network; then
	    log_action_msg "no networks configured"
	    log_end_msg 1
	fi

	if start-stop-daemon --start --oknodo --quiet --exec /usr/sbin/named \
		--pidfile ${PIDFILE} -- $OPTIONS; then
	    if [ "X$RESOLVCONF" != "Xno" ] && [ -x /sbin/resolvconf ] ; then
		echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.named
	    fi
	    log_end_msg 0
	else
	    log_end_msg 1
	fi
    ;;

    stop)
	log_daemon_msg "Stopping domain name service..." "bind9"
	if ! check_network; then
	    log_action_msg "no networks configured"
	    log_end_msg 1
	fi

	if [ "X$RESOLVCONF" != "Xno" ] && [ -x /sbin/resolvconf ] ; then
	    /sbin/resolvconf -d lo.named
	fi
	pid=$(/usr/sbin/rndc stop -p | awk '/^pid:/ {print $2}') || true
	if [ -z "$pid" ]; then		# no pid found, so either not running, or error
	    pid=$(pgrep -f ^/usr/sbin/named) || true
	    start-stop-daemon --stop --oknodo --quiet --exec /usr/sbin/named \
		    --pidfile ${PIDFILE} -- $OPTIONS
	fi
	if [ -n $pid ]; then
	  while kill -0 $pid 2>/dev/null; do
	    log_progress_msg "waiting for pid $pid to die"
	    sleep 1
	  done
	fi
	log_end_msg 0
    ;;

    reload|force-reload)
	log_daemon_msg "Reloading domain name service..." "bind9"
	if ! check_network; then
	    log_action_msg "no networks configured"
	    log_end_msg 1
	fi

	/usr/sbin/rndc reload >/dev/null && log_end_msg 0 || log_end_msg 1
    ;;

    restart)
	if ! check_network; then
	    log_action_msg "no networks configured"
	    exit 1
	fi

	$0 stop
	$0 start
    ;;
    
    status)
    	ret=0
	status_of_proc -p ${PIDFILE} /usr/sbin/named bind9 2>/dev/null || ret=$?
	exit $ret
	;;

    *)
	log_action_msg "Usage: /etc/init.d/bind9 {start|stop|reload|restart|force-reload|status}"
	exit 1
    ;;
esac

exit 0

Also, make sure the permissions are correct:
Code:
$ ls -la /etc/init.d/bind9
-rwxr-xr-x 1 root root 3215 oct 13 17:39 /etc/init.d/bind9

I hope this fix your problem.

PS: /etc/init.d/bind9 status and service bind9 status are bugged. Both of them answer * bind9 is not running, but that's incorrect. /opt/psa/admin/bin/dnsmng --status gives you the real status. I don't know why.
 
Thank you Velty's My file only had 1 line
Code:
exit 0
I have spent hours looking at this and it is finally running.
 
@Everyone,

If your /etc/init.d/bind9 is empty, first have a look in the directory /etc/init.d.

There should be a file called bind9.dpkg-dist.

Copy (do not move, simply copy) this file, with the command: cp bind9.dpkg-dist bind9

After that, bind9 should work properly.

Note that it is not adviceable to insert to lines of code provided by Veltys, since those lines differ from what bind9 should be in Plesk versions 12.0.18 AND 12.5.30.

In the exceptional case that you do not have a file /etc/init.d/bind9.dpkg-dist, just let me know.

Kind regards....
 
@OnsEns

The /etc/init.d/bind9.dpkg-dist is only relevant if your /etc/init.d/bind9 file is empty: the contents of bind9.dpkg-dist can be copied to the bind9 file.

However, whenever some files are not installed properly, first try to install the appropriate packages: for instance, on Ubuntu, run "apt-get install bind9" (and some other packages).

This way, you are sure that you are not missing any other relevant file, that should be installed with bind.

Regards....
 
Back
Top