Troubleshooting VMware vSphere 5 Via Command Line

ESXi 5

In vSphere 5, an administrator can manage the ESXi host from the command line using esxcli commands, such as esxcli network vswitch standard. The commands are available using the Direct Console User Interface (DCUI) to access the ESXi shell, using a remote application like putty to ssh into the host, or through the vSphere Command-Line Interface (vCLI).

A second method to access the command line is by utilizing an application such as putty to ssh into the ESXi host. In order for ssh to work you must enable the sshd service on the ESXi host. And a third method to run command line commands is thru vCLI. The vCLI provides a command-line interface for ESXi hosts. The central system that VMware uses is a downloadable appliance called vMA. vMA enables administrators to run scripts that interact with ESXi hosts and VMware vCenter Server systems without having to authenticate each time.

Direct Console User Interface (DCUI)

  1. When the DCUI screen appears, press F2 Customize the System and login as root.
  2. Scroll to Troubleshooting Options and press Enter.
  3. Choose Enable ESXi shell and press Enter.
  4. Press Esc until you return to the main DCUI screen.

To enable ssh from the vsphere Client

  1. Select the host and click the Configuration tab.
  2. Click Security Profile in the Software panel.
  3. In the Services area, click Properties.
  4. Select ssh and click Options.
  5. Change the ssh options. To change the Startup policy across reboots, click Start and stop with host and reboot the host.
  6. Click OK.

ESXi 4.1

First method from the Direct Console User Interface (DCUI)

  1. Hit Alt+F1, if TSM is enabled, log in with root credentials, else
  2. Once the DCUI screen appears, press F2 and login as root to enable the TSM.
  3. Navigate down the screen and choose Troubleshooting Options, and press enter.
  4. Troubleshooting Options provides additional options for TSM in ESXi 4.1.

<Enable/Disable> Local Tech Support – Access command line via Alt+F1 on the console.

<Enable/Disable> Remote Tech Support (ssh) – ssh access on the console of the ESXi host.

Modify Tech Support Timeout – Tech Support Mode will be disabled after a certain amount of time.

Second Method from the vSphere Client

  1. From the vSphere Client, select the host and click Configuration tab.
  2. Then choose Security profile and Properties.
  3. Here you can enable Local Tech Support as well as Remote Tech Support (ssh). They are enabled
  4. if the Daemon is running, and disabled if the Daemon is Stopped.
  5. If you want to enable either mode, highlight the mode, then choose Options.
  6. Now you can modify the Startup Policy or change the Service to Start, then click OK.

Access the local TSM (Local Tech Support):

At the main DCUI screen, press Alt+F1, login.

Access the remote TSM:

Use a utility, such as putty, to establish an ssh connection.

ESX 4.x and Earlier

If you are using an ESX 4.x or earlier host, then you will need to use a third-party tool like putty to ssh into the ESX box. Essentially, you are logging into the service console, which is running Red Hat Linux. The challenge comes with ESXi because ESXi does not have a service console, although it is possible to setup a virtual appliance called vMA to run the command line. Instead let’s look at a method called Tech Support Mode, which is a hidden or unsupported method to gain command line access to the host. Essentially, you are enabling the ssh daemon directly on VMware’s proprietary version of Unix where the hypervisor is running, enabling the root user to either log in directly on the console of the ESXi host, or log in remotely via ssh.

ESXi 3.5 or 4.0

  1. To start, check the techSupportMode setting. To make sure this setting is correct, log into the vCenter Server, using the vSphere Client. Depending on version, this may not be necessary.
  2. Select the ESXi host and choose the Configuration tab, then select Advanced Settings in the Software panel. In the left pane, click VMkernel.
  3. Enable VMkernel.Boot.techSupportMode and click OK. Reboot the ESXi host if you need to enable technical support mode.
  4. To use Tech Support Mode, log in to the ESXi host using the Direct Console User Interface (DCUI).
  5. Press Alt+F1 to display the console screen.
  6. Enter by typing unsupported to start the Tech Support Mode process. Note that no text will appear on the console window.
  7. Enter the password for the root user, and you should than see an ssh prompt.
In this article

Join the Conversation