How to fix invalid cPanel license error when the IP is in fact licensed

 

Was getting below error on cpanel server  even when cpanel license was assigned for main server IP address

root@server4 [/etc/sysconfig/network-scripts]# /usr/local/cpanel/cpkeyclt
Updating cPanel license…Done. Update Failed!
Error message:
The cPanel license server said that there was no license for your IP address.
For more information visit: http://www.cpanel.net/lic.html

The exact message was: Abort, Retry, Fail?

Building global cache for cpanel…Done

 

The issue was due to wrong entries in  /etc/hosts file

went ahead and set the correct hostname and IP in  /etc/hots file and  refreshed cpanel license

root@server4 [/etc/sysconfig/network-scripts]# /usr/local/cpanel/cpkeyclt
Updating cPanel license…Done. Update succeeded.
Building global cache for cpanel…Done
root@server4 [/etc/sysconfig/network-scripts]#