How to Expire ESXi License immediately
VMware has evaluation license for ESXi servers. After 60 days, it expires and you have to apply a paid or free license to continue. Technically, there is a trick to reset the evaluation key by deleting two files (/etc/vmware/vmware.lic and /etc/vmware/license.cfg) and rebooting the server. It’s of course not complying with VMwrae license terms. Under some circumstances like training lab, it may be OK. Make sure to consult VMware on this if you are not working for VMware. But wait – if you are working for VMware, do you need evaluation license? In his reply to my tweet, Duncan mentioned he never saw license expiration.
Anyway, I got into a different problem a few days ago. How to expire my evaluation license immediately? You don’t want to sit down and wait for 60 days. It may be a good excuse for not working hard.
Time to learn how to "Google" and manage your VMware and clouds in a fast and secureHTML5 App
It’s such a corner case that most people don’t care about. For myself, I have vExpert license thanks to VMware. I wish it does not expire but it does every year. I need a test bed with license expired for development and testing of a project that integrates with VMware. I want to alert users that the evaluation license has expired before moving any further work which would eventually fail. As a good principle of user experience, fail it fast if it’s going to fail anyway. Good for VMware license sales.
That’s being said, let’s see how to solve this problem. The first thought I had and most people suggested is to change the ESX clock. It’s now July and setting the new time to October should be good enough to expire the evaluation license.
~ # esxcli system time set -M 10 ~ # date Mon Oct 12 10:43:52 UTC 2014
I was wrong on this. If I check out the MOB, the new expiration date actually moves to December. The engineers at VMware are smart enough to take care of this easy hack that works in most operation systems.
The ESXi license expiration date is not based on absolute time, but time left before expiration date is tracked.
Then, I start to observe how the two files change over the time with vi and MOB. Here are some findings.
1. The /etc/vmware/vmware.lic does not change over the time. Its content is always: 00000-00000-00000-00000-00000. As long it’s evaluation, its content remains as such. When a real license is applied on this ESXi, it changes to a real license number with same format.
2. The /etc/vmware/license.cfg changes every 5 minutes. If you use MOB, the expirationMinutes value jumps like 5, 10, 15… The real value is encoded or encrypted in the license.cfg file. Although it’s not clear on the details, it’s for sure not BASE64 encoded.
Without the details on how the hashed string is constructed, it’s not possible to change the real value. So it got stuck.
Inspired by a reply from shogan85, I randomly changed the value of
Logically it makes sense. If ESXi detects changes it cannot understand, it thinks it’s intentionally changed and therefore expires the license immediately.