Introduction
Encountering the error message "Failed to fetch zone" when using WHM or cPanel to edit a DNS zone can be frustrating. This issue usually indicates a problem with dnsadmin, which is responsible for managing DNS zones.
Common Causes
This error can arise from several scenarios, including:
- The zone file lacking proper permissions.
- The zone file or its cache file not opening correctly.
Zone files are typically located in the directory: /var/named/
.
Reviewing the DNSAdmin Log
The best way to troubleshoot this error is to review the DNSAdmin log, which can be found at:
/usr/local/cpanel/logs/dnsadmin_log
Example Error
Here is an example of an error you might encounter:
warn [dnsadmin] Unable to save zone example_domain.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 case, the cache file for the zone could not open because it was mistakenly created as a directory. The issue can be resolved by moving the directory out of the way so the cache can rebuild.
Troubleshooting Steps
To resolve this type of error, follow these steps:
- Confirm that the domain's DNS zone file in
/var/named/
is owned by the user and group:named
. - Ensure the zone file has permissions set to
600
(-rw------
). - Check that the folder
/var/named/cache/
is owned byroot
with700
(rwx------
) permissions, and that the.db
files inside are owned byroot
with600
(-r-------
) permissions. - If issues persist, check the log using a command similar to the following, replacing
domain.tld
with your actual domain:
grep 'domain.tld' /usr/local/cpanel/logs/dnsadmin_log
By following these troubleshooting steps, you can effectively address the "Failed to fetch zone" error in cPanel's DNS Zone Editor, ensuring proper management of your DNS records.