Symptoms
-
Cannot start BIND DNS server or to run
plesk repair dns
command:# systemctl status named-chroot
● named-chroot.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named-chroot.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2019-01-08 02:10:22 GMT; 7s ago
...# plesk repair dns -y
...
PHP Fatal error: Uncaught exception 'PleskMultipleException' with message 'Error during example.com updateZone: dnsmng failed: dnsmng: Unable to update reverse lookup zone
... -
In
/var/log/messages
the following errors might be shown:named-checkconf: zone example.com/IN: NS 'ns1.example.com' has no address records (A or AAAA)
named-checkconf: zone example.com/IN: example.com/MX 'mail.example.com' has no address records (A or AAAA)
named: zone example.com/IN: has no NS records
named: zone 312.kg/IN: not loaded due to errors.
_default/example.com/IN: bad zone
dnsmng[121377]: Failed to update reverse lookup DNS zone for domain 'example.com': bad lexical cast: source type value could not be interpreted as target
named[48070]: zone example.com/IN: zone serial (2015011702) unchanged. zone may fail to transfer to slaves. -
Domain example.com does not exist in Plesk.
Cause
Inconsistency in Plesk database with invalid DNS zones from inexistent domains causes problems in DNS service.
Resolution
-
Connect to the server via SSH
-
Back up Plesk database:
# plesk db dump psa > psa.backup.sql
-
Remove orphaned records:
# plesk db "delete from dns_zone where id not in (select dns_zone_id from domains) and id not in (select dns_zone_id from domain_aliases) and id not in (select val from misc where param = 'default_dns_zone_id')"
# plesk db "delete from dns_recs where dns_zone_id not in (select dns_zone_id from domains) and dns_zone_id not in (select dns_zone_id from domain_aliases) and dns_zone_id not in (select val from misc where param = 'default_dns_zone_id')"
-
Backup
/etc/named.conf
file:# cp -a /etc/named.conf{,.backup}
-
Remove all configuration related to example.com from
/etc/named.conf
file. The configuration that needs to be removed looks like follows:zone "example.com" {
type master;
file "example.com";
allow-transfer {
203.0.113.2;
common-allow-transfer;
};
}; -
Move example.com DNS zone from
/var/named/chroot/var
directory:# mv /var/named/chroot/var/example.com /root/example.com
-
Restart bind:
# service named-chroot restart
-
Repair DNS zones:
# plesk repair dns -y