After attempting to uninstall NSX-T from an ESXi host via the NSX Manager UI, the NSX VIBs remain present on the host.
When attempting to force delete the VIBs via the command line, the operation fails with the following error message: "Resources attached to the NSXPGs on the host. Manually migrate these resources, then retry the nsxcli command"
Manual attempts to remove associated VMkernel adapters (vmk10, vmk11, vmk50) and uplink associations do not resolve the error.
VMware vSphere ESXi
VMware NSX-T Data Center
The issue is caused by a lingering association of the NSX Distributed Virtual Switch (DVS) on the ESXi host. Even though the uplinks and VMkernel adapters have been manually removed, the local switch database on the host retains a state indicating that resources are still attached to the NSX Port Groups, preventing the VIB removal safety checks from passing.
To resolve this issue and successfully remove the NSX VIBs, perform the following steps on the affected host:
Make sure host MGMT/vmk0 should be moved to vSS and no other vmk's should be present on that affected DVS
Disconnect the Host: Right-click the ESXi host in vCenter Server and select Connection > Disconnect. This ensures vCenter does not attempt to push DVS configurations back to the host during the repair.
Reset the DVS Database: Log in to the ESXi host via SSH and run the following command to initialize/resync the local DVS database.
Note: This will disrupt network connectivity for VMs on DVS switches. Ensure the host is in Maintenance Mode.
net-dvs -i
Reboot the Host: Restart the ESXi host to apply the database reset and clear the locked resources.reboot
Remove NSX VIBs: Once the host is back online, run the NSX CLI command to remove the VIBs. The dependency error should now be cleared.
nsxcli -c del nsx
Cleanup vCenter:
Reconnect the host to vCenter Server.
Verify that the host has been removed from the Distributed Switch in the vCenter networking view. If the switch remains but is empty/unused, it can now be deleted from vCenter.