Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 currently have small VM to do certain tests (it has multiple benefits - like testing on another distribution, Fedora 15, as well as running make distcheck without the problem of polluting /).

However I'd like to automate tests and I'd like to be able to programatically (eg., using sh, python, c, ...) do the following:

  • Boot headlessly a VM (qemu) from local image
  • Wait till VM is fully booted (that's hardest part - initially I thought about magic sleep)
  • Sync the repository between host and guest (not necessary at this point)
  • Execute ./autogen && make && sudo make install && sudo make distcheck on machine
  • Download the generated tarballs from machine

I started to read about libvirt and it might allow me to use an API for that. While this would require guest support and I cannot find documentation regarding it, such ability would seem to be a logical element of libvirt.

Is it possible to check if machine is fully booted? Is there a ready tool to do this?

EDIT: By fully booted I mean that the system rc scripts have finished execution/all systemd services which were suppose to start have started. I know that qemu cannot know when it happens but I assume the support on guest side.

share|improve this question
Would you be interested in a xen specific answer? Yes, it's possible via Xenbus, It would take a while to write .. so if Xen's out of the question, probably not worth it. – Tim Post Sep 17 '11 at 14:08
up vote 7 down vote accepted

Afaik, libvirt doesn't know what "fully booted" means (neither do I). You could make a service that connect to your host (or another machine) during boot. Or you could try connecting in a loop to your guest, for example with ssh.

Another solution would be to rely on an exisiting service that communicate with the host, such as vdagent. You could easily write a spice-gtk python script that would wait until the Spice agent channel is connected (see spicy.c example, the status bar indicate the presence of the agent)

Note, testing "make distcheck" shouldn't polute / and shouldn't need sudo. If it does, it looks like a problem in your makefile.

share|improve this answer
The explanation of fully-booted I gave in body of main question. As of make distcheck - please discuss it fully with GObject Introspecition developers. While I agree that is unfortunate a) I'm not willing to support non-standard configuration (i.e. other then blessed by gir devs) b) I understend why it was done in such way (to make ./configure && make && sudo make install work while if the GIR macros respected prefix it would not). – Maciej Piechotka Sep 16 '11 at 11:22

why not just make an rc script that runs after the others and logs a message of "FULLY BOOTED". Then make syslog forward to the vm host, and wait for the message to appear in the logfiles on the host.

thats what i'd do, anyhow.

share|improve this answer

You can install this tool in vm: http://wiki.libvirt.org/page/Qemu_guest_agent Qemu_guest_agent will tell you when vm is fully booted.

You can also install spice guest agent in vm.If spice guest agent has started,vm is fully booted.

share|improve this answer

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.