VIBS deletion fails with error "Resources attached to the NSXPGs on the host" on ESXi
search cancel

VIBS deletion fails with error "Resources attached to the NSXPGs on the host" on ESXi

book

Article ID: 451002

calendar_today

Updated On:

Products

VMware NSX

Issue/Introduction

  • When attempting to remove NSX VIBs from an ESXi host via the CLI, the process fails due to active network resource attachments.
  • Executing the VIB removal task returns the following explicit error message:
    • Current state: Resources attached to the NSXPGs on the host, manually migrate and then try again. Next Step: Manually migrate these resources then retry the NSXCLI command.
  • Stale virtual machine inventory records remain registered (visible in nsxcli.log) on the host even if workloads were previously migrated.
  • The host may have been in a disconnected state in vCenter Server during the initial migration or uninstallation attempt.

Environment

  • NSX Version: 4.2.1.3

Cause

  • Stale VM object entries and port references remain cached within the ESXi and the vDS in database. Although the virtual machines have been migrated to alternate hosts, these orphaned object references maintain active resource locks on the NSX Port Groups (NSXPGs).

Resolution

To resolve this issue, the local DVS database must be re-initialized and the host rebooted to clear the stale runtime states.

  • Prepare the Host:

    • Place the affected ESXi host in Maintenance Mode.
    • Ensure the host management interface (vmk0) is migrated to a Standard Virtual Switch (vSS).
    • Confirm that no other VMkernel adapters reside on the affected Distributed Virtual Switch (vDS).
  • Disconnect from vCenter:

    • In the vSphere Client, right-click the host and select Connection > Disconnect. This prevents vCenter from attempting to push configuration syncs during the cleanup.
  • Reset DVS Database:

    • Log in to the ESXi host via SSH as root.
    • Execute the net-dvs -i to initialize and resync the local DVS database.

If the above steps doesn't resolve the issue then perform the below steps:

    • Reboot the Host:

      • Reboot host to clear the management layer cache and locked resource references.
         
    • Remove NSX VIBs:

      • Once the host is back online, log in via SSH and run the nsxcli -c del nsx  command to delete the VIBs.
    • Verify Removal:

      • Verify using esxcli software vib list | grep nsx that no NSX-related VIBs remain:

Additional Information

  • If the VIB removal still fails after these steps, inspect the /var/log/nsxcli.log for specific stale UUIDs that may require manual object deletion.
  • Please refer the KB for more info - 428806