Sample Header Ad - 728x90

failed starting vm with libvirt/qemu permission denied

0 votes
1 answer
2916 views
this is my first time i'm asking a question so if i can do something better please tell me. I'm not very good in Linux things, so far i could follow along guides and the problems i had where easy fixes with some searching, but now i'm stuck. I have a small homeserver running Debian Buster. On there i run several VM's with libvirt/qemu. My problem is with a nextcloud instance: Yesterday i had a power loss on the system. After rebooting everything was normal so far. Then i wanted to start my VM's and all of them started fine but one. There i get the following error:
sudo virsh start mydomain 
error: Failed to start domain mydomain 
error: internal error: process exited while connecting to monitor: 
qemu-system-x86_64: -realtime mlock=off: warning: '-realtime mlock=...' is deprecated, please use '-overcommit mem-lock=...' instead 
2022-10-01T13:31:17.160445Z qemu-system-x86_64: -drive file=/path/to/mydomain.snapshot1.snapshot2,format=qcow2,if=none,id=drive-virtio-disk0: 
Could not open backing file: Could not open '/path/to/mydomain.snapshot1': Permission denied
I created external snapshot following this guide https://fabianlee.org/2021/01/10/kvm-creating-and-reverting-libvirt-external-snapshots/ And i first thought something was broken with the vm so i tried to revert to an older snapshot (i have one only hours before the powerloss) According to the guide i used these steps to revert:
# edit hda path back to original qcow2 disk
virt-xml $thedomain --edit target=$targetdisk --disk path=$backingfile --update

# validate that we are now pointing back at original qcow2 disk
virsh domblklist $thedomain

# delete snapshot metadata
virsh snapshot-delete --metadata $thedomain $snapshotname

# delete snapshot qcow2 file
sudo rm $pooldir/$thedomain.$snapshotname

# start guest domain
virsh start $thedomain
But after that i still get the same errors just pointing to the snapshot file. Also when i tried to start the VM, the owner and the group of the snapshot file changed from "libvirt-qemu" to "root". I tried to search for the Problem but couldn't find a lot. The closest i found was https://unix.stackexchange.com/questions/435837/how-to-configure-apparmor-so-that-kvm-can-start-guest-that-has-a-backing-file-ch So it might have to do something with apparmor. But i'm confused what changed over the powerloss. But anyway i tried the suggentions in those posts without an effect. But it is also possible that something changed through an update and only came to effect after the reboot. So far the server ran quite well and wasn't shutdown very often. Sorry for the long text. Thanks in advance for any help
Asked by entenbürzel (1 rep)
Oct 1, 2022, 02:14 PM
Last activity: Jul 30, 2025, 06:05 AM