So, there is a python script that allows to connect to QEMU monitor from a usual shell. I had to download a bunch of files from the QEMU source tree, and add -qmp unix:./qmp-sock,server,nowait to the vm command line. It connects, but I can’t get it working.

$ qmp-shell qmp-sock 
Welcome to the QMP low-level shell!
Connected to QEMU 1.5.3

(QEMU) help
{u'error': {u'class': u'CommandNotFound', u'desc': u'The command help has not been found'}}
(QEMU) query-
query-balloon               query-fdsets                query-status
query-block                 query-kvm                   query-target
query-block-jobs            query-machines              query-tpm
query-blockstats            query-mice                  query-tpm-models
query-chardev               query-migrate               query-tpm-types
query-command-line-options  query-migrate-cache-size    query-uuid
query-commands              query-migrate-capabilities  query-version
query-cpu-definitions       query-name                  query-vnc
query-cpus                  query-pci                   
query-events                query-spice                 
(QEMU) query-kvm
{u'return': {u'enabled': True, u'present': True}}
(QEMU) info block
Error while parsing command line: list index out of range
command format: <command-name>  [arg-name1=arg1] ... [arg-nameN=argN]
(QEMU) info
{u'error': {u'class': u'CommandNotFound', u'desc': u'The command info has not been found'}}
(QEMU) exit
{u'error': {u'class': u'CommandNotFound', u'desc': u'The command exit has not been found'}}

1 Answer 1


Assuming that the qmp-shell works the same way as, say, telneting to QMP socket and sending JSON commands directly, you need to issue the qmp_capabilities command. None of the other commands in qmp will work until it has been executed, and will result in the 'CommandNotFound' error quoted.

See qemu wiki page regarding QMP for details.

  • That was a wrong assumption. qmp-shell does negotiation by itself. Moreover, as you could see above, some commands do work, e.g. device_add driver=e1000 id=net1 prints {u'return': {}} and quit closes virtual machine.
    – tijagi
    Oct 23, 2014 at 22:11
  • Thanks for that additional information @tijagi about qmp-shell doing the negotiation. The details of the return codes from "device_add" and "quit" commands weren't present in the original post though. It might be worth adding those additional details. Nov 10, 2014 at 11:04
  • There’s a query-kvm command, that works as well as device_add in this case.
    – tijagi
    Nov 21, 2014 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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