I'm running QEMU on Linux without GUI.
After running starting my custom kernel with QEMU, I can't kill and return to host by pressing Ctrl+C.
Is there any way to get back to host OS?
I'm running QEMU on Linux without GUI.
After running starting my custom kernel with QEMU, I can't kill and return to host by pressing Ctrl+C.
Is there any way to get back to host OS?
Ctrl-A x
For -nographic just enter:
Ctrl-A x
which means
Alternatively:
enter the QEMU monitor with Ctrl-A C then type:
quit
and press enter. See also: https://stackoverflow.com/questions/14165158/how-to-switch-to-qemu-monitor-console-when-running-with-curses
use the QEMU monitor (same as Ctrl-A C) with telnet:
qemu-system-x86_64 -monitor telnet::45454,server,nowait -serial mon:stdio
and on a host terminal:
telnet localhost 45454
and then quit from there.
-serial mon:stdio is required to keep Ctrl+C working: https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-nographic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144
shut down the VM from guest normally, e.g. with a powerdown command from a Linux guest shell if you are able. This of course goes through the normal shutdown sequence instead of immediately killing the VM, but sometimes it is just the simplest approach.
It does not work for all machines however: https://stackoverflow.com/questions/31990487/how-to-cleanly-exit-qemu-after-executing-bare-metal-program-without-user-interve
Tested in Ubuntu 17.10, QEMU 2.10.1.
Ok, found a solution.
This is just in addition to other answers, where ctrl-a x works but you've aliased over it. If you're like me, you're using tmux with ctrl-b replaced with ctrl-a, which is why you can't use ctrl-a x. A simple solution to this is to use tmux's send-keys utility to send ctrl-a x to qemu.
In a running tmux window, press ctrl-a : to bring up the tmux prompt, then type send-keys C-a x Enter and qemu will quit.
i tried
Ctrl + Alt + Q
That worked for me, even if most of the documentation I see only says to use
Ctrl + Q
For me Ctrl+Alt+g worked in i3wm on Arch. Also I noticed qemu displays the quit shortcut in the title of window.