How To Repair Named When Not Starting

Named under plesk can sometimes go haywire. I have seen until now two cases when this happens:

First Scenario

Named will not start due to a faulty zone file. Log into your server by ssh (use putty on windows, but if you needed that information it’s better to post a support ticket at support@solarvps.com ) as user root

there you should try restarting named:

# /etc/init.d/named restart

If you see a (green) OK message, you can log out, as named is working.
If you see a (red) FAILED message, then you should read your logs:

# tail -f /var/log/messages

This will start by showing on your screen the last 10 lines of your /var/log/messages file, and will continue with messages as they get written in the logs. If these messages say something about a broken zone file, they will tell you which one is broken, and the line with the problem. Just edit that zone file and make sure the line where the error showed up follows the same pattern as the other similar lines:

e.g.:

Quote from: Correct Line

mail.domain.tld                 IN A    11.11.11.11

Quote from: Wrong line

mail.domain.tld           56      IN A    11.11.11.11

Notice the extra numbers 56 on that line.

If the messages you receive in your log don’t say anything about a broken zone file, you probably have a broken config file for named and you should go to the second scenario.

I haven’t seen the first scenario in the last couple of months, so probably Parallels fixed the bug that was causing this in the last releases of Plesk.

Second Scenario

In order to rebuild the named configuration file, follow the next steps:

1)

# cd /var/named/run-root/etc

2)

# mv named.conf named.conf.bak

3)

# cp named.conf.default named.conf

4)

# for x in `ls`; do /usr/local/psa/admin/sbin/dnsmng update $x; done;/etc/init.d/named restart

x is going to be the file name returned by ls for each file in the directory. that line of script is just a quick way to perform the dnsmng utility on all files in the directory and then restart named

If you still get a (red) FAILED message, open up a support ticket, and mention you followed this how to.

If you get a (green) OK message, this will start named again, but you need to reconfigure the zones for every domain you have hosted on your server. So, you need to create a new file, let’s say named-restore.sh by doing:

# cd /root/ ; touch named-restore.sh

Edit it with your preferred text editor and enter the following code inside:

#!/bin/sh

ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"

query="select name from domains;"
domains=`echo $query | $mysql `

for i in ${domains}; do
    echo "echo $i"
    /usr/local/psa/admin/sbin/dnsmng update $i
done

make it executable:

#chmod +x /root/named-restore.sh

then run it

# sh /root/named-restore.sh

Restart named again to make it use the new conf file:

# /etc/init.d/named restart

If you get a (green) OK message all is OK, if you still get a (red) FAILED message, open up a support ticket, and mention you followed this how to.

Let me know if this worked out for you.

Wayne Egerer

Leave a Reply