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,909
2,222
463
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
938
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,909
2,222
463
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.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,269
62
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello guys. I had the same issues three years ago when the users posted this, and the commands in the first post helped me. Sometimes the /etc/named.conf weren't improperly cleaned after account termination. It happened then with Bind, and still happens with PowerDNS.

Three years have passed, and the issue still exists: you terminate a accounnt, and its DNS zone is not fully deleted from the cluster. Funny thing is: it happens sometimes. Sometimes you terminate an account and deletion is replicated correctly across the cluster, and sometimes it's not. Why does this happen and why does this STILL happens? You couldn't find the issue? It's a bug in the clustering routine itself?

It's a load issue maybe? Maybe if you terminate an account when high IO is happenning, then the script fail to cleanup files and cluster. That would explain why you guys don't find the cause yet.

It's a mission for QA staff.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,333
689
313
cPanel Access Level
Root Administrator
If you have a way we can reproduce the issue, feel free to open a ticket. Usually these aren't the fault of the DNS server or the cPanel tools, but issues with the cluster itself during the time the zone removal was happening.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,269
62
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
The problem is, that the issue happens randomly. Sometimes it deletes the domain registries and sometimes it doesn't.

Can you tell if there is some kind of log worth checking, whether in the server where the account has been deleted, or in the cluster servers, to know if deletion of DNS registries was successful or not?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
5,333
689
313
cPanel Access Level
Root Administrator
If you have the additional logging options enabled in WHM >> Tweak Settings >> Logging, you'd be able to check the logs at /usr/local/cpanel/logs/dnsadmin_log for additional errors. If that option is not enabled, there aren't going to be any additional areas with useful logged information.