Unable to remove NSX VIBs from ESXi host due to stuck DVS resources
search cancel

Unable to remove NSX VIBs from ESXi host due to stuck DVS resources

book

Article ID: 428806

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

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.

Environment

VMware vSphere ESXi

VMware NSX-T Data Center

 

Cause

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.

Resolution

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

  1. 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.

  2. 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
    
  3. Reboot the Host: Restart the ESXi host to apply the database reset and clear the locked resources.reboot

  4. 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
    
  5. 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.