Server Fault is a question and answer site for system and network administrators. 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

We use kvm on ubuntu 10.4 as virtualisation-solution (we have bash-scripted the whole networking, subneting, starting of vms.....

Is there a way to shutdown a kvm-guest without the usage of libvirt/virsh? A bash or python based solution would be great.

share|improve this question
up vote 6 down vote accepted

If you have started your VM with the monitor option (-monitor unix:/tmp/file.mon,server,nowait ), you can stop it by using echo 'system_powerdown' | socat - UNIX-CONNECT:/tmp/file.mon.

It send a ACPI signal to the VM, which can use it as you push your power button, and then do a shutdown.

share|improve this answer
exact what i have been searching for! thank you! – bmaeser Nov 29 '11 at 20:14
The socat command wasn't installed by default on my Fedora (F14) box, but was available in the main repos. I'd never heard of socat, it's similar to netcat (nc). More info can be found on it's main site. Also this serverfault question was helpful in understanding the differences b/w netcat and socat. – slm Dec 11 '11 at 6:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.