VM虛機無法重啟關機的強制處理辦法
- 2019 年 10 月 29 日
- 筆記
有一台虛機無法正常網路連接,通過VSPHERE CLIENT連接到VC中,也無法對其進行重啟和關機操作,具體報錯截圖

查看事件日誌

原來是執行VMTOOLS安裝程式時出現的問題,詢問實施工程師,原來是要進行VMTOOLS的升級未成功出現的問題,虛機現在掛死無任何響應。
對其進行重啟和關機均無任何響應,這台虛機掛有很多RDM裸盤,是存儲監控機。需要立即解決問題,刪除重建顯然來不及。
那麼有沒有別的辦法可以強制讓虛機關機或重啟呢?
下面介紹一種方法。
首先打開虛機所在ESXI主機的SSH連接功能。

然後連接到命令行
執行進程查看,可查看到每個虛機的進程
# esxcli vm process list|more
F9EMCSE01
World ID: 40008824
Process ID: 0
VMX Cartel ID: 40008821
UUID: 42 0a d0 01 38 68 b7 7d-61 5e 4c ab d5 5b f0 6c
Display Name: F9EMCSE01
Config File: /vmfs/volumes/55813f75-c661c1ac-dea8-6c0b8462a7e8/F9EMCSE01/F9EMCSE01.vmx
# esxcli vm process kill –type=
Error: Missing required parameter -w|–world-id
Usage: esxcli vm process kill [cmd options]
Description:
kill Used to forcibly kill Virtual Machines that are stuck
and not responding to normal stop operations.
Cmd options:
-t|–type=<str> The type of kill operation to attempt. There are three
types of VM kills that can be attempted: [soft,
hard, force]. Users should always attempt 'soft' kills
first, which will give the VMX process a chance to
shutdown cleanly (like kill or kill -SIGTERM). If that
does not work move to 'hard' kills which will shutdown
the process immediately (like kill -9 or kill
-SIGKILL). 'force' should be used as a last resort
attempt to kill the VM. If all three fail then a
reboot is required. (required)
-w|–world-id=<long> The World ID of the Virtual Machine to kill. This can
be obtained from the 'vm process list' command
(required)
有三種類型,SOFT是殺死虛機進程。HARD是強制殺死,類似KILL -9. FORCE是殺死整個虛機。
執行語句
# esxcli vm process kill –type=hard –world-id=40008824
發現虛機已被強制關閉,再重啟就正常了,升級VMTOOLS成功。