• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

FIX: named fails to start with: zone xx.tld/IN: NS 'ns.xx.tld' has no address records

StéphanS

Regular Pleskian
After migrating an old Plesk 8.6 to Plesk 11.5, I came across this annoying named limitation:


Code:
zone xx.tld/IN: NS 'ns.xx.tld' has no address records (A or AAAA)
zone xx.tld/IN: not loaded due to errors.
_default/xx.tld/IN: bad zone
                                                           [FAILED]

Which means that I have NS records that point to a host name that doesn't exist in the same zone.


You can list all of these failed zones with:

Code:
service named restart | grep "bad zone"


There were only 16 of these failed DNS zones for me, so I could have just fixed them by hand via Plesk.
But I'm in the process of migrating another 15 Plesk servers, so I decided to invest some time into fixing this via the DB.

I came across http://kb.parallels.com/en/113119 which doesn't solve the problem, but had far better SQL than I had.
So I merged my first piece of code with some of the code in the article.

This is my result:

Code:
# Fix any broken DNS entries

 # Inspect first
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "SELECT * FROM dns_recs AS DR, dns_zone AS DZ WHERE DZ.status=0 AND DZ.id=DR.dns_zone_id AND DR.type='NS' AND DR.val = CONCAT('ns.',DZ.name,'.') AND DR.val NOT IN (SELECT host FROM dns_recs);"


 # Delete all bad records and regenerate the bad zones
mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "SELECT DR.id, DZ.name FROM dns_recs AS DR, dns_zone AS DZ WHERE DZ.status=0 AND DZ.id=DR.dns_zone_id AND DR.type='NS' AND DR.val = CONCAT('ns.',DZ.name,'.') AND DR.val NOT IN (SELECT host FROM dns_recs);" | while read record domain; do mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Nse "DELETE FROM dns_recs WHERE dns_recs.id=$record"; plesk sbin dnsmng --update $domain; done
service named restart


Now if only
Code:
plesk bin repair --run
could do this for me, I would be so much happier :)
 
Back
Top