Symptoms
When using WHM or cPanel to "Edit" a DNS Zone and you encounter this error below, it usually indicates that DNSAdmin is encountering an error:
Failed to fetch zone
Description
Some scenarios can occur in which WHM or cPanel's "Zone Editor" cannot open a zone file. This is usually due to the zone file itself not having proper permissions, or perhaps the file or the cache file is not opening properly. The zone files can be found in the directory: /var/named/
The best way to troubleshoot this type of error is to review the DNSAdmin log. Which is located at /usr/local/cpanel/logs/dnsadmin_log
Here is an example of an error that might occur:
warn [dnsadmin] Unable to save zone cptechs-testing.com: (XID 7rgpvk)
The system failed to rename “/var/named/cache/.tmp.cc5y2.domain.tld.db”
to “/var/named/cache/domain.tld.db” because of an error: Is a directory
In this example, the cache file for our zone file could not open because it was a directory and not a file. This was resolved by moving this /var/named/cache/domain.tld.db
directory out of the way so the cache could rebuild
Workaround
When troubleshooting errors such as this, we recommend taking the following steps:
- Confirm that the domain's DNS Zone file in
/var/named/
is owned by the user and group: "named
" - Confirm that the zone file has permissions of 600. (-rw------)
- Confirm that the folder
/var/named/cache/
is owned by root with 700 (rwx------ ) permissions and the *.db files inside are owned by root with 600 (-r-------) permissions - If nothing else, check the log in
/usr/local/cpanel/logs/dnsadmin_log
using a command similar to the one below (replacing domain.tld with your domain):
grep 'domain.tld' /usr/local/cpanel/logs/dnsadmin_log