To learn more about QEMU configuration, I would like to start VM ubuntu20.10 directly on the command line and not by usage of virt-manager.

I have read in Convert libvirt xml into qemu command line, that one way is to look into /var/log/libvirt/qemu/ubuntu20.10.log to retrieve the invoked qemu-system-x86_64 command.

E.g. I started the VM via virt-manager and then inspected its log:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin \
HOME=/var/lib/libvirt/qemu/domain-11-ubuntu20.10 \
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-11-ubuntu20.10/.local/share \
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-11-ubuntu20.10/.cache \
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-11-ubuntu20.10/.config \
/usr/bin/qemu-system-x86_64 \
-name guest=ubuntu20.10,debug-threads=on \
-S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-11-ubuntu20.10/master-key.aes \

But invoking triggers following error:

2021-03-11T21:38:13.041883Z qemu-system-x86_64: -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-11-ubuntu20.10/master-key.aes:

Unable to read /var/lib/libvirt/qemu/domain-11-ubuntu20.10/master-key.aes: Failed to open file “/var/lib/libvirt/qemu/domain-11-ubuntu20.10/master-key.aes”: No such file or directory

And indeed, /var/lib/libvirt/qemu/domain-11-ubuntu20.10/ does not exist.

Why does an apparently wrong command getting logged? And how can I start the VM correctly via CLI?

Update: More infos

The folder /var/lib/libvirt/qemu/domain-xx-ubuntu20.10/ seems to be temporarily created, when starting the VM by virt-manager. Stopping the VM causes the folder to be removed again (hence the command error).

I also tried the other proposed solutions from linked post:

Alternative 2

ps -fA | cat # copy qemu command while VM started via virt-manager
# problem is the same here with a temporary folder being referenced.

Alternative 3

virsh domxml-to-native qemu-argv --domain ubuntu20.10

assumes a domain folder /var/lib/libvirt/qemu/domain--1-ubuntu20.10, which does not exist. Command output:

LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin HOME=/var/lib/libvirt/qemu/domain--1-ubuntu20.10 XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-ubuntu20.10/.local/share XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-ubuntu20.10/.cache XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-ubuntu20.10/.config QEMU_AUDIO_DRV=spice /usr/bin/qemu-system-x86_64 -name guest=ubuntu20.10,debug-threads=on -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-ubuntu20.10/master-key.aes ...

and produces following error as expected, when invoked:

2021-03-12T09:34:03.794205Z qemu-system-x86_64: -object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-ubuntu20.10/master-key.aes: Unable to read /var/lib/libvirt/qemu/domain--1-ubuntu20.10/master-key.aes: Failed to open file “/var/lib/libvirt/qemu/domain--1-ubuntu20.10/master-key.aes”: No such file or directory

Being new to the QEMU/KVM/virt-manager ecosystem, this is quite confusing to me. If you need more infos, I'll happily update the question.

  • Ubuntu 20.04 (most recent updates)
  • virsh 6.0.0
  • virt-manager 2.2.1
  • QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.14)
  • VM has a snapshot (if that matters)
  • why don't you try the other two methods suggested in the link you mentioned? Check the running process and virsh domxml-to-native.
    – Krackout
    Commented Mar 12, 2021 at 9:02
  • @Krackout thanks for the hint, I also had tried the other two options before. Updated question.
    – ramo
    Commented Mar 12, 2021 at 9:44

1 Answer 1


If I well understand the question, I found a working solution for me at https://www.garron.me/en/bits/start-stop-kvm-virtual-machine-command-line.html. Here what I did to apply the advice. I just made a virtual machine with the virtual manager and named it "Xubuntu20.04". It's actually shut off and properly listed by virsh:

~$ virsh list --all
 Id   Name           State
 -    Xubuntu20.04   shut off

Then I started it with virsh:

~$ virsh start Xubuntu20.04
Domain Xubuntu20.04 started

Finally I set a connection with the virtual machine using remote-viewer. I'm using remote-viewer because it allows to show the two displays I set to the virtual machine. In this case I'm keeping the default port 5900, but of course you can change it at your convenience:

~$ remote-viewer spice://localhost:5900

Don't be concerned of the output you're going to see, the vm actually started:

(remote-viewer:15718): Gtk-WARNING **: 14:32:38.836: Theme parsing error: gtk.css:2:15: Unit is missing.

(remote-viewer:15718): GLib-GObject-WARNING **: 14:32:39.635: value "64" of type 'gint' is invalid or out of range for property 'desktop-width' of type 'gint'

(remote-viewer:15718): GLib-GObject-WARNING **: 14:32:39.635: value "64" of type 'gint' is invalid or out of range for property 'desktop-height' of type 'gint'

That's all, I hope this hint can help someone somewhere.

You must log in to answer this question.

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