Score:0

QEMU+KVM: Two errors after running virsh list --all, seems to be permission error

in flag

after running virsh list --all, I get the following errors:

error: failed to connect to the hypervisor
error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

This is what I get after running ls -la /var/run/libvirt/:

total 0
drwxr-xr-x 12 root root     380 Jan 19 20:28 .
drwxr-xr-x 40 root root    1100 Jan 19 20:28 ..
drwx------  2 root root      60 Jan 19 20:28 common
drwxr-xr-x  2 root root      40 Jan 19 20:28 hostdevmgr
drwx------  2 root root      60 Jan 19 20:28 interface
srw-------  1 root root       0 Jan 19 20:28 libvirt-admin-sock
srw-rw----  1 root libvirt    0 Jan 19 20:28 libvirt-sock
srw-rw-rw-  1 root root       0 Jan 19 20:28 libvirt-sock-ro
drwxr-xr-x  2 root root     140 Jan 19 20:28 network
drwx------  2 root root      60 Jan 19 20:28 nodedev
drwx------  2 root root      60 Jan 19 20:28 nwfilter
drwx------  2 root root      40 Jan 19 20:28 nwfilter-binding
drwxr-xr-x  4 root root     120 Jan 19 20:28 qemu
drwx------  2 root root      60 Jan 19 20:28 secrets
drwxr-xr-x  2 root root      80 Jan 19 20:28 storage
srw-------  1 root root       0 Jan 19 20:28 virtlockd-admin-sock
srw-------  1 root root       0 Jan 19 20:28 virtlockd-sock
srw-------  1 root root       0 Jan 19 20:28 virtlogd-admin-sock
srw-------  1 root root       0 Jan 19 20:28 virtlogd-sock

Score:1
sl flag

On install of libvirt users which are allowed to use sudo are added to the libvirt group, those can access the socket. Everyone else is considered non-privileged.

If you are on a user that didn't exist back then or was not in the sudoers group you will not yet have a group membership of libvirt. You can check that by running id which should list ... groups=...,129(libvirt) (the numer can vary).

If you are not, then you need to add yourself (or ask an admin to do so) to that group.

Something like sudo usermod -a -G libvirt <youruser> should do that.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.