Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run Qemu on my Mac and I have some difficulties. I am using OS X 10.8.2 and installed Qemu 1.2.50 via their repository.

Update: Just upgraded to Qemu 1.3.50 and the problem is still the same.

When I run

qemu-system-i386

from the command line everything works well and I can terminate execution using Ctrl-C. As soon as I add -vnc :0 however I am no longer able to terminate without killing the process from the Activity Monitor.

My problem is, that I am not just starting Qemu manually from time to time but that I have a Java program that requieres Qemu to perform some task via the vnc protocol, so manual shutdown is not an option.

So basically at some point in my program I start a thread that does:

Runtime rt = Runtime.getRuntime();
process = rt.exec("/usr/local/bin/qemu-system-i386 -vnc :0");
// Some stuff via vnc protocol

At some later point from my main thread I call:

process.destroy();

This does not terminate Qemu on OS X. The same code works with Qemu 1.2.0 on Ubuntu 12.10

So I guess my question is how to properly shutdown Qemu with vnc enabled on OS X.

Or maybe I could just try to force-quit the Qemu process like the Activity Manager does?

share|improve this question

migrated from stackoverflow.com Dec 15 '12 at 8:03

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

I filed a bug report at Qemu and got a response:

Interesting -- my experience is that control-C doesn't work at all, even if using the cocoa UI frontend. It's a bug of some kind related to signal handling but I haven't been able to track it down. As far as I could tell with a debugger QEMU never received the SIGTERM at all, which makes no sense to me.

As a workaround you can send QEMU a SIGKILL, which will abruptly terminate QEMU (NB that if you have a writable disk image you may find it is corrupt since this is a long way from a clean shutdown). The best approach would be to make the guest cleanly power down the VM, which should cause QEMU to exit automatically.

From: Qemu Bug tracker

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .