lstool.py unregister appears to succeed or returns no error, but the entries reappear or remain visible in lstool.py list output.The lstool.py unregister command operates at the lookupservice SDK layer. In some cases, it updates the lookupservice's in-memory state without fully removing the underlying LDAP objects from the vmdir database. Each lookupservice service registration is stored in vmdir as a parent object with child entries (endpoints and properties). If these child objects are not removed, the parent entry cannot be fully deleted from the directory, and the stale registration returns when the lookupservice refreshes its cache or restarts.
In ELM environments, vmdir replication between partner nodes can also restore entries that were only partially removed from one side.
Before you begin:
Note: Placeholder text is indicated by the <> symbols. Replace any of them in the commands with the actual data required.
Step 1: Export the vmdir database
/opt/likewise/bin/ldapsearch -b "dc=vsphere,dc=local" -s sub -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W > /tmp/vmdir_export.ldif
administrator@<domain>.local password when prompted.Step 2: Identify the stale LDAP entries
grep -n "<decommissioned-ip-or-hostname>" /tmp/vmdir_export.ldif
dn: cn=<service-id>,cn=ServiceRegistrations,cn=LookupService,cn=default-site, cn=Sites,cn=Configuration,dc=vsphere,dc=local
cn=Endpoint1,cn=<service-id>,cn=ServiceRegistrations,... cn=Endpoint2,cn=<service-id>,cn=ServiceRegistrations,... cn=Property1,cn=<service-id>,cn=ServiceRegistrations,...
Step 3: Delete the stale entries from vmdir
LDAP directory entries with children cannot be deleted until the children are removed first. Delete in this order: children first, then parents.
/opt/likewise/bin/ldapdelete -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "<full-DN-of-Endpoint1>" /opt/likewise/bin/ldapdelete -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "<full-DN-of-Endpoint2>" /opt/likewise/bin/ldapdelete -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "<full-DN-of-Property1>"
/opt/likewise/bin/ldapdelete -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "<full-DN-of-service-registration>"
Step 4: Verify the cleanup
/opt/likewise/bin/ldapsearch -b "cn=ServiceRegistrations,cn=LookupService,cn=default-site, cn=Sites,cn=Configuration,dc=vsphere,dc=local" -s sub -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "(cn=<service-id>*)"This should return no results for the deleted entries.
python /usr/lib/vmware-lookupsvc/tools/lstool.py list --url https://localhost/lookupservice/sdk --no-check-cert | grep -i "<decommissioned-ip-or-hostname>"This should return no results.
lstool.py list still shows the deleted entries after the LDAP objects are confirmed gone, restart the lookupservice to clear its in-memory cache:vmon-cli --restart lookupsvcWait at least two minutes, then re-run the
lstool.py list check.lstool.py unregister, see Script to remove stale service registrations from vCenter Server.dir-cli service delete. In many cases involving decommissioned appliances, no solution user accounts exist.