When attempting to remove NSX installation files from an ESXi host the 'del nsx' command may fail.
You may need to remove NSX from an ESXi host manually in the following scenarios:
- host removed from vCenter without being removed from NSX first
- host moved to another vCenter without being removed from NSX first
- host experienced an outage and had to be rebuilt
- ESXi upgrade failing because of an NSX VIB dependency
After running the 'del nsx' command, you may see the following error on the CLI:
% Exception when deleting nsx from host: ' error code: 137 stdout: localcli software vib remove -n nsx-adf -n nsx-cfgagent -n nsx-context-mux -n nsx-cpp-libs -n nsx-esx-datapath -n nsx-exporter -n nsx-host -n nsx-ids -n nsx-monitoring -n nsx-mpa -n nsx-nestdb -n nsx-netopa -n nsx-opsagent -n nsx-platform-client -n nsx-proto2-libs -n nsx-proxy -n nsx-python-gevent -n nsx-python-greenlet -n nsx-python-logging -n nsx-python-protobuf -n nsx-python-utils -n nsx-sfhc -n nsx-shared-libs -n nsx-vdpi -n nsxcli -n vsipfwlib delete_nsx_instance_from_host.sh: Failed to remove NSX , stderr: chmod: /opt/vmware/nsx-common/python/nsx_utils/make_cert.py: Operation not permitted rm: can't remove '/tmp/nsx-lcp-*.zip': No such file or directory Killed Failed to remove NSX'
Navigate to the /tmp directory of the ESXi host and confirm that the file, 'nsx-lcp-*.zip' is missing.
To confirm that the NSX VIBs are still installed, run the command:
esxcli software vib list | grep -E 'nsx|vsipfwlib'
ESXi 7
NSX 4.x
Operation not permitted rm: can't remove '/tmp/nsx-lcp-*.zip': No such file or directory
This indicates that there is a missing NSX zip file which is required to proceed with the uninstall.
From the impacted ESXi host's root shell, run the command:
esxcli software vib list | grep -E 'nsx|vsipfwlib'
The output will show all the VIBs required by NSX. In the second column, the NSX version and ESXi VIB build number are shown together. Make note of these numbers.
To resolve the error, you may copy the missing file from either of the following:
- an ESXi host that is currently running NSX in the same environment
The file can be found under the /tmp directory
- an NSX manager that manages or managed the host
The file can be found under /repository/<NSX version Folder>/HostComponents/<esxversionFolder>/
Example:
root@nsx-mngr: /repository/4.1.2.4.0.23786733/HostComponents/esx70/nsx-lcp-4.1.2.4.0.23786733-esx70.zip
You can use scp commands or WinSCP client to transfer the zip file to the /tmp directory of the impacted host.
After completing the file transfer, complete the steps of the uninstall process again.
The 'del nsx' command should output 'terminated'.
After the script returns 'terminated', periodically check for the NSX VIBs:
esxcli software vib list | grep -E 'nsx|vsipfwlib'
This should return no entries and signifies that NSX has been removed successfully from the ESXi host.