
我在沒有 GUI 的 Linux 上運行 QEMU。
使用 QEMU 運行啟動自訂核心後,我無法透過按 Ctrl+C 來終止並返回主機。
有什麼辦法可以回到主機作業系統嗎?
答案1
Ctrl-A X
只需-nographic
輸入:
Ctrl-A X
意思是
- 首先按Ctrl + A(A只是鍵a,不是alt鍵),
- 然後放開按鍵,
- 然後按X.
或者:
進入 QEMU 監視器,
Ctrl-A C
然後輸入:quit
並按回車鍵。也可以看看:https://stackoverflow.com/questions/14165158/how-to-switch-to-qemu-monitor-console-when-running-with-curses
使用 QEMU 監視器(與 相同
Ctrl-A C
)telnet
:qemu-system-x86_64 -monitor telnet::45454,server,nowait -serial mon:stdio
並在主機終端機上:
telnet localhost 45454
然後
quit
從那裡開始。-serial mon:stdio
需要保持 Ctrl+C 工作:https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-ngraphic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144通常從來賓關閉虛擬機,例如,
powerdown
如果可以的話,使用 Linux 來賓 shell 中的命令。這當然會經歷正常的關閉順序,而不是立即終止虛擬機,但有時這只是最簡單的方法。
在 Ubuntu 17.10、QEMU 2.10.1 中測試。
答案2
要關閉 shell 中的 QEMU 進程:
ctrl+a
, 然後x
答案3
答案4
這只是其他答案的補充,這些答案ctrl-a x
可行,但您已經對其使用了別名。如果你像我一樣,你正在使用 tmux 並ctrl-b
替換為ctrl-a
,這就是你不能使用 的原因ctrl-a x
。一個簡單的解決方案是使用 tmux 的send-keys
實用程式傳送ctrl-a x
到 qemu。
在執行的 tmux 視窗中,按ctrl-a :
調出 tmux 提示符,然後鍵入send-keys C-a x Enter
,qemu 將退出。