Comment 8 for bug 1802005

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The permissions of the sockets are usually controlled by libvirtd.conf

$ grep '^unix_sock_' /etc/libvirt/libvirtd.conf
unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"

The new version still has the config entry but ... "fortunately" ignores the config and sets 666 instead.

This is due to:
# This setting is not required or honoured if using systemd socket
# activation.

This is now controlled by:
# systemctl cat libvirtd.socket
# /lib/systemd/system/libvirtd.socket
[Unit]
Description=Libvirt local socket
Before=libvirtd.service

[Socket]
# The directory must match the /etc/libvirt/libvirtd.conf unix_sock_dir setting
# when using systemd version < 227
ListenStream=/run/libvirt/libvirt-sock
Service=libvirtd.service
SocketMode=0666

[Install]
WantedBy=sockets.target

It is time to drop the superfluous (now non functional) delta that changes the libvirtd.conf entries on the next merge. Going back this is a simple config change to expose the sockets a bit wider to the system than they are by default.

1. set in /etc/libvirt/libvirtd.conf
unix_sock_rw_perms = "0777"
(or any other perm that is sufficient for you)
2. restart libvirt
systemctl restart libvirtd

=> now the permission is opened up and libvirt-dbus works.
# ll /var/run/libvirt/libvirt-soc*
srwxrwx--- 1 root libvirt 0 Feb 24 15:32 /var/run/libvirt/libvirt-sock=
srwxrwxrwx 1 root libvirt 0 Feb 24 15:32 /var/run/libvirt/libvirt-sock-ro=
# busctl call org.libvirt /org/libvirt/QEMU org.libvirt.Connect ListDomains u 0
ao 0

Not sure if we want/need to make a change to the default config in <=Eoan.
@Martin please advise if you are of different opinion.

P.S. I've taken notes to drop the default config delta on the next merge.