DNS entry for the domain already exists

webservers

Active Member
Nov 3, 2014
33
0
6
cPanel Access Level
Root Administrator
Trying to add domain as an addon domain after terminating the account which had that domain as primary. I get this common error.

A DNS entry for the domain “mydomain.com” already exists.

So I did everything. See below:

/scripts/whoowns domain.com

nothing. Yes I'm replacing `domain.com` with my actual domain.

/scripts/killdns domain.com

nothing

grep mydomain.com /etc/userdomains

nope nothing

/etc/named.conf

not there

/usr/local/apache/conf/httpd.conf

not there either

/var/named/domain.com.db

nope, none there

/etc/userdomains

not there

/etc/localdomains

not there

/var/cpanel/users/<username>

not there

/scripts/killdns mydomain.com
/scripts/updateuserdomains
/scripts/rebuildhttpdconf

then restart both bind and httpd

still same error.

dig @IPAddress mydomain.com

This shows the former content from named.config, but this is not actually in named.conf, nor in anything else, as you can see above.

I contacted my system admin and I told myself that I already tried all these things (I am the only point of contact, no one else, it's just me and it is my server).

I also ran grep to try to see if I could find any instances, removed all that was possible, but still nothing.

[email protected] [/]# grep -rl "mydomain.com" /etc/*
/etc/httpd/conf/httpd.conf,v
/etc/localdomains,v
/etc/userdatadomains.stor
/etc/userdomains,v

It's listed a couple times but these are archive files and shouldn't affect anything.

Similar with var:

[email protected] [/]# grep -rl "mydomain.com" /var/*
grep: /var/clamd: No such device or address
/var/cpanel/configs.cache/_etc_mailips___default_colon_before_after_space
/var/cpanel/bandwidth/evxca1.sqlite
/var/cpanel/bandwidth_cache.sqlite
/var/cpanel/user_notifications/root/history/1432358935_wwwacct___[server.myserver.com] New account: mydomain (mydomain.com).eml
/var/lib/mlocate/mlocate.db
/var/lib/mysql/evxca1_em3f3dh5/wp_evm9xaoptions.MYD
/var/lib/mysql/evxca1_em3f3dh5/wp_evm9xaposts.MYD
/var/lib/mysql/evxca1_em3f3dh5/wp_evm9xausers.MYD
/var/lib/mysql/eximstats/smtp.MYI
/var/lib/mysql/eximstats/smtp.MYD
/var/log/maillog
/var/log/maillog-20160907
/var/log/bandwidth/ipmap
/var/log/exim_mainlog

Came here as a last resort. Please help.
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
931
21
168
Did you find a solution to this? We're using a cpanel DNS cluster but I think the same problem applies to us and I've noticed this happening quite a lot recently.

There was a time when removing a domain would delete the DNS entries instantly and you could add it again straight away. Then a while back we noticed that there was a time delay - after removing a domain and trying to add it again, we would get the DNS entry already exists error for a couple of minutes, as if the data was still temporarily cached. No problems with that.

More recently, we are seeing more regular instances of "DNS data" not being correctly removed when a domain is removed in cpanel or WHM - I say "DNS data" because I don't know the exact problem. It seems the zone file does get removed, but there is something else left behind that stops the domain from being added again. Running the /scripts/killdns script does seem to resolve it most of the time and it is more effective if you run it from all nameservers in the cluster and also the server you are adding the domain to. This has been happening for years off and on - but it does seem to be more frequent these days.

There have been a few instances recently of the exact problem described in the original post above. An example of this is yesterday - a client added 20 parked domains (sorry aliases) to their plan and then removed all of them - then proceeded to add them to another plan but received "the DNS entry already exists" error. So I ran the /scripts/killdns script to make sure the domains were fully removed. It made no difference. The domains couldn't be added.

I went through similar steps as the OP above, even resorting to a grep for instances of the domains in various places. Nothing. Same error. I asked the client to wait until this morning to try again. Same problem.

Then I ran the /scripts/killdns script for like the fourth time on all nameservers and the server I was adding it to just now - and as usual it reported that "the zone was possibly removed earlier".

However, after this time running the script again we were able to add the domains. So the script must still be doing something other than removing the zone file as it reports that the zone does not exist. Why is it necessary to run this script multiple times though before it finally works? It's a mystery!

I'd be interested to know exactly what different actions the killdns script is performing. It seems to run a "removezone" function within Cpanel::DnsUtils but whether that function simply deletes the zone file or performs other actions I don't know. You'd think if it can't complete one or more of those actions, there would be some error returned or logged.
 
  • Like
Reactions: jpjai

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
Hello @4u123,

Would you mind opening a support ticket so we can take a closer look at the affected system to see what's happening? Please post the ticket number here and we will update this thread with the outcome.

Thank you.