Virtual Machine

Nuclear Option: How to Force Power Off a Hung VM via SSH | Lazy Admin Blog

Posted on Updated on

We’ve all been there: a Windows Update goes sideways or a database lock freezes a guest OS, and suddenly the “Shut Down Guest” command is greyed out or simply times out. When the GUI fails you, the ESXi Command Line (esxcli) is your best friend.

Step 1: Identify the “World ID”

In ESXi terminology, every running process is assigned a World ID. To kill a VM, you first need to find this unique identifier.

  1. SSH into your ESXi host using Putty.
  2. Run the following command to see all active VM processes:Bashesxcli vm process list
  3. Locate your hung VM in the list. Look for the World ID (a long string of numbers). You will also see the Display Name and the path to the .vmx file to confirm you have the right one.

Step 2: Execute the Kill Command

ESXi offers three levels of “force” to stop a process. It is best practice to try them in order:

  1. Soft: The most graceful. It attempts to give the guest OS a chance to shut down cleanly.
  2. Hard: Equivalent to pulling the power cable. Immediate cessation of the VMX process.
  3. Force: The “last resort.” Use this only if ‘Hard’ fails to clear the process from the kernel.

The Syntax:

Bash

esxcli vm process kill --type=[soft,hard,force] --world-id=WorldNumber

Example (Hard Kill): esxcli vm process kill -t hard -w 5241852


Step 3: Verify the Result

After running the kill command, it may take a few seconds for the host to clean up the memory registration. Run the list command again to ensure it’s gone:

Bash

esxcli vm process list | grep "Your_VM_Name"

If the command returns nothing, the VM is officially offline, and you can attempt to power it back on via the vSphere Client.

Lazy Admin Tip 💡

If esxcli still won’t kill the VM, the process might be stuck in an “I/O Wait” state (usually due to a failed storage path). In that rare case, you might actually need to restart the Management Agents (services.sh restart) or, in extreme cases, reboot the entire host.

#VMware #vSphere #ESXi #SysAdmin #Troubleshooting #Virtualization #ITOps #LazyAdmin #ServerManagement #DataCenter

How to Fix: Keyboard or Mouse Not Working in a VMware Virtual Machine

Posted on Updated on

It’s a frustrating classic: you click into your VM, and… nothing. The cursor doesn’t move, or the keyboard acts like it’s unplugged. Usually, this is a “focus” or driver issue rather than a hardware failure.

Here is the “Lazy Admin” checklist to get your inputs back online.


1. The “Focus” Check (The Most Common Culprit)

Virtualization software intercepts your hardware inputs. If the VM window doesn’t have “Focus,” your typing is still going to your host OS.

  • Action: Click anywhere inside the VM console window.
  • Pro Tip: Look at the bottom status bar of your VMware window. If the mouse icon isn’t lit up, the VM isn’t “grabbing” the input.

2. The Wireless Device “Passthrough” Trap

If you are using a wireless USB mouse/keyboard, the VM might have accidentally “claimed” the USB receiver for itself, cutting it off from the host.

  • Action: Go to VM > Removable Devices and ensure your HID (Human Interface Device) is Disconnected from the VM so the host can manage it and pass the input through the software layer instead.
  • Alternative: Remove the USB Controller from the VM settings and re-add it to reset the bus.

3. Driver Conflicts & Optimization

Sometimes, fancy “Gaming” drivers (Logitech G-Hub, Razer Synapse) inside the guest OS conflict with the VMware virtual driver.

  • Action: Uninstall any non-standard mouse/keyboard software inside the VM.
  • Optimization: In VMware Workstation settings, go to Preferences > Input and set “Optimize mouse for games” to Always or Automatic.

4. The Nuclear Option: Reinstall VMware Tools

The VMware Tools package includes the specialized vmmouse driver that handles smooth cursor movement and keyboard mapping. If this is corrupted, your input will fail.

  • Action: 1. Press Ctrl + Alt to release your mouse to the host. 2. Go to VM > Install (or Reinstall) VMware Tools. 3. Use the keyboard (Tab and Spacebar) if the mouse isn’t working to navigate the installer.

5. Troubleshooting the Host (OS-Specific)

If the issue persists, the problem might be a service on your physical computer blocking the input stream.

  • Windows Hosts: Run msconfig to perform a “Clean Boot,” disabling non-Microsoft services to see if a background app is interfering.
  • Linux Hosts: Drop to Run Level 2 to disable start daemons and test the raw input.

#VMware #Virtualization #SysAdmin #ITSupport #TechTips #LazyAdmin #VMwareWorkstation #vSphere #WindowsTips #LinuxTips

Fixed: The VMRC Console has Disconnected (Error 2050470)

Posted on Updated on

It’s a frustrating scenario: you go to check a virtual machine, and instead of a login screen, you get a black box with the message: “The VMRC Console has Disconnected… Trying to reconnect.” To make matters worse, the VM often appears unreachable on the network, leading you to believe the Guest OS has blue-screened or frozen. However, the issue is frequently just a hang-up in the VMware Remote Console (VMRC) process on your local management workstation.

The Quick Fix

You do not need to restart the VM or the ESXi host. Usually, the “stuck” process is living right on your own PC.

  1. Open Task Manager: Right-click your taskbar and select Task Manager (or press Ctrl + Shift + Esc).
  2. Find the Process: Go to the Processes or Details tab.
  3. Kill VMRC: Look for vmware-vmrc.exe (or vmware-vmrc.exe*32 on older systems).
  4. End Task: Right-click the process and select End Task.
  5. Relaunch: Go back to your vSphere Client and attempt to open the console again.

Why does this happen?

This error usually occurs when the VMRC process loses its handshake with the ESXi host but fails to terminate properly. By killing the process, you force a fresh authentication and network handshake, which typically restores the video feed immediately.

What if the VM is still “Black Screened”?

If killing the local process doesn’t work and the VM is still unreachable via ping/RDP, the issue might be on the host side:

  • Check the Hostd Service: Sometimes the management agent on the ESXi host needs a restart.
  • Video Memory: Ensure the VM has enough Video RAM allocated in its “Edit Settings” menu to support the resolution you are using.

#VMware #vSphere #VMRC #SysAdmin #ITPro #Virtualization #TechSupport #LazyAdmin #ServerAdmin #WindowsTroubleshooting