72

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?

triple fault
  • 833
  • 1
  • 6
  • 7

5 Answers5

127

Ctrl-A X

For -nographic just enter:

Ctrl-A X

which means

  1. first press Ctrl + A (A is just key a, not the alt key),
  2. then release the keys,
  3. afterwards press X.

Alternatively:

Tested in Ubuntu 17.10, QEMU 2.10.1.

12

To close a QEMU process in your shell:

ctrl+a, then x

Noich
  • 221
  • 2
  • 4
  • When using -nographics and -monitor need to include -serial mon:stdio que keep ctrl+a working. https://stackoverflow.com/questions/49716931/how-to-run-qemu-with-nographic-and-monitor-but-still-be-able-to-send-ctrlc-to/49751144#49751144 – arvati Jul 03 '20 at 10:41
8

Press Cntl-Alt-2 and then use the close button on the menu.

enter image description here

You can find more useful shortcuts here

Ramhound
  • 41,734
  • 35
  • 103
  • 130
YanivGK
  • 181
  • 1
  • 2
1

Ok, found a solution.

  1. Opened new terminal session: ctrl+alt+f2
  2. Used ps to find PID of previous tty: ps -fu
  3. Killed previous tty: kill -HUP PID
triple fault
  • 833
  • 1
  • 6
  • 7
  • 6
    This is a really inferior solution to the most upvoted answer here. I will not downvote the answer, since it was entered before the better solutions. – EFraim Aug 21 '18 at 08:05
1

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.

kjp
  • 11
  • 1