Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Failed to connect socket to '/var/run/libvirt/libvirt-sock'
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
juliedeville
n00b
n00b


Joined: 14 Oct 2024
Posts: 13

PostPosted: Sun Oct 20, 2024 5:42 pm    Post subject: Failed to connect socket to '/var/run/libvirt/libvirt-sock' Reply with quote

I get this error when trying to run virt-manager as my user

Code:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 923, in _do_open
    self._backend.open(cb, data)
  File "/usr/share/virt-manager/virtinst/connection.py", line 171, in open
    conn = libvirt.openAuth(self._open_uri,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/libvirt.py", line 147, in openAuth
    raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied




But I can run it and connect to the daemon as root. I have added myself to the libvirt group, and emerged virt-manager using policykit. Any advice is appreciated.

I am also unable to start virtbr0, and get an error saying "Package not installed," but I can't figure out what package I am missing.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22540

PostPosted: Sun Oct 20, 2024 5:56 pm    Post subject: Reply with quote

What is the output of id; namei -l /var/run/libvirt/libvirt-sock, as run from the same shell where that error can be reproduced?
Back to top
View user's profile Send private message
juliedeville
n00b
n00b


Joined: 14 Oct 2024
Posts: 13

PostPosted: Sun Oct 20, 2024 7:48 pm    Post subject: Reply with quote

Code:
uid=1000(julie) gid=1000(julie) groups=1000(julie),10(wheel),18(audio),27(video),79(libvirt),100(users)
f: /var/run/libvirt/libvirt-sock
drwxr-xr-x root root /
drwxr-xr-x root root var
lrwxrwxrwx root root run -> ../run
drwxr-xr-x root root   ..
drwxrwxrwt root root   run
drwxr-xr-x root root libvirt
srwx------ root root libvirt-sock
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22540

PostPosted: Sun Oct 20, 2024 8:08 pm    Post subject: Reply with quote

The socket is only accessible to root, so membership in the libvirt group will not help you. This seems wrong to me. I would have expected the socket to be accessible by a reasonable group, such as libvirt.
Back to top
View user's profile Send private message
juliedeville
n00b
n00b


Joined: 14 Oct 2024
Posts: 13

PostPosted: Sun Oct 20, 2024 10:20 pm    Post subject: Reply with quote

I see. How do I make it accessible to users? I read that libvirt uses polkit to allow user access, but I wasn't sure if it had to be configured manually.
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 614

PostPosted: Sun Oct 20, 2024 10:32 pm    Post subject: Reply with quote

Hu wrote:
The socket is only accessible to root, so membership in the libvirt group will not help you. This seems wrong to me. I would have expected the socket to be accessible by a reasonable group, such as libvirt.
Indeed, in all contexts.

polkit can (apparently?) override this, but I changed it a long time ago* so it took me a while to locate, but:
/etc/libvirt/libvirtd.conf:
#################################################################
#
# UNIX socket access controls
#

# Set the UNIX domain socket group ownership. This can be used to
# allow a 'trusted' set of users access to management capabilities
# without becoming root.
#
# This setting is not required or honoured if using systemd socket
# activation.
#
# This is restricted to 'root' by default.
unix_sock_group = "libvirt"

There is a bunch of other "stuff" you can alter after this section too, including "0775" style socket permissions.

*nano backups say aug 22.
Back to top
View user's profile Send private message
juliedeville
n00b
n00b


Joined: 14 Oct 2024
Posts: 13

PostPosted: Mon Oct 21, 2024 4:01 pm    Post subject: Reply with quote

Setting the socket to libvirt and permissions at 0775 did the trick, thank you much! However, I am still getting
Code:
error: Failed to start network default
error: Unable to create bridge virbr0: Package not installed
when trying to start the default network device.

Here is emerge --info for libvirt

Code:
app-emulation/libvirt-10.3.0-r3::gentoo was built with the following:
USE="caps libvirtd nls qemu udev virt-network -apparmor -audit -bash-completion -dtrace -firewalld -fuse -glusterfs -iscsi -iscsi-direct -libssh -libssh2 -lvm -lxc -nbd -nfs -numa (-openvz) -parted -pcap -policykit -rbd -sasl (-selinux) -test -verify-sig -virtiofsd -virtualbox -wireshark-plugins -xen -zfs" ABI_X86="(64)"
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 614

PostPosted: Mon Oct 21, 2024 4:41 pm    Post subject: Reply with quote

Does
Code:
ebuild /var/db/repos/gentoo/app-emulation/libvirt/libvirt-10.3.0-r3.ebuild setup clean
tell you about any missing kernel config?
Back to top
View user's profile Send private message
juliedeville
n00b
n00b


Joined: 14 Oct 2024
Posts: 13

PostPosted: Mon Oct 21, 2024 7:37 pm    Post subject: Reply with quote

Oh that's it, I was missing a couple. Thank you!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum