You are not logged in.

#1 2022-01-15 16:11:13

Hoswoo
Member
From: United States
Registered: 2021-11-12
Posts: 21

[SOLVED] virt-manager: Unable to connect to libvirt qemu:///system

Hello everyone, last night I was trying to set up GPU passthrough for my virtual machines. I followed through a few guides (particularly, this guide) and after running a few shell scripts and manually changing a few things, I now have this error coming up:

Unable to connect to libvirt qemu:///system.
Verify that the 'libvirtd' daemon is running.
Libvirt URI is: qemu:///system
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 922, in _do_open
    self._backend.open(cb, data)
  File "/usr/share/virt-manager/virtinst/connection.py", line 153, in open
    conn = libvirt.openAuth(self._open_uri,
  File "/usr/lib/python3.10/site-packages/libvirt.py", line 148, in openAuth
    raise libvirtError('virConnectOpenAuth() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Connection refused

I have had this error before and fixed it (so subsequently, I also do already have a few VMs set up in virt-manager) but whatever I did last night broke whatever I did before and now I can't  for the life remember what I did last time.

I will do my best to provide what I can remember doing below.

1) I have added myself to the kvm and libvirt groups.
output of groups $(whoami):

games wheel audio kvm optical storage uucp video dialout wireshark libvirt hoswoo

(I just realized I added my username as a group on my user, lol)

2) In my /etc/libvirt/qemu.conf, changed the line from

user="root"
group="root"

to

user="hoswoo"
group="libvirt"

3) Output of sudo virsh net-list:

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

4) When I type

systemctl

I see the libvirtd.service, libvirtd-admin.socket, libvirtd-ro.socket, and libvirtd.socket services all highlighted in red, indicating a failure in starting the service.

5) I also have done the following:

su - root
virsh start default
virsh autostart default

Doing this also gives me the following output:

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

6) I also do have another laptop running Arch with virt-manager working. I tried comparing my desktop's and laptop's configuration but could not figure out what I changed.

7) The virtual machines that I did have added before do not show in virt-manager. I just see QEMU/KVM  - Not Connected

EDIT: I have also restarted the libvirtd service (and even my computer a few times) after making the changes

Last edited by Hoswoo (2022-01-15 17:59:25)

Offline

#2 2022-01-15 17:59:09

Hoswoo
Member
From: United States
Registered: 2021-11-12
Posts: 21

Re: [SOLVED] virt-manager: Unable to connect to libvirt qemu:///system

So, I found the solution. I am an idiot.

I entered the command

journalctl -u libvirtd.service

and the output showed that I had a syntax error hidden away in my /etc/libvirt/libvirtd.conf file.
If anyone has a similar problem in the future and sees this, try running that command!

Offline

Board footer

Powered by FluxBB