Skip to content

libvirt: Cannot access storage file (as uid:64055) – Permission denied

Virtualizationtested on Ubuntu 24.04.5, QEMU 8.2.2, libvirt 10.0.0

The domain is defined, but virsh start fails with Permission denied. The user in the message is not you but libvirt-qemu – the account QEMU runs as under libvirt.

Symptom

virsh define erste.xml
virsh start erste
Domain 'erste' defined from erste.xml

error: Failed to start domain 'erste'
error: Cannot access storage file '/home/ubuntu/kvm-lab/tag01/erste.qcow2' (as uid:64055,
gid:993): Permission denied

define only stores the definition. start opens the disk – and not as you.

Diagnosis

Look up who uid 64055 is.

getent passwd 64055
libvirt-qemu:x:64055:993:Libvirt Qemu,,,:/var/lib/libvirt:/usr/sbin/nologin

Causes

uid:64055QEMU runs as libvirt-qemu

libvirt does not start QEMU with your rights but as its own user. A hijacked QEMU process should see as little as possible – your home is not part of that.

/home/…The disk lives in your home directory

With plain QEMU (no libvirt) the same disk worked from your home because QEMU ran as you. Under libvirt, disks belong in /var/lib/libvirt/images.

Fix

Move the disk, remove the definition, define it again with the new path and start it.
sudo mv ~/kvm-lab/tag01/erste.qcow2 /var/lib/libvirt/images/
virsh undefine erste
Domain 'erste' has been undefined
virsh define erste.xml
virsh start erste
Domain 'erste' defined from erste.xml

Domain 'erste' started

Don't: Open your home to libvirt-qemu or run QEMU as root. The separation is a protective layer.

▶
Break it yourself and find it – free
KVM hands-on, Day 3: libvirt takes over the VM from Day 1 – with exactly this error on the first start.
Go to day 3 →

FAQ

Does virsh undefine delete my disk?

No. undefine only removes the definition; the qcow2 file stays.

Why did the same start work without libvirt?

Plain QEMU runs with the rights of the calling user. libvirt starts QEMU as libvirt-qemu instead.

Related error patterns

More