Score:1

Unable to connect to libvirt qemu://system

fr flag

I am trying to setup a GPU passthrough for KVM but I've been facing this egregious problem the whole time. Basically, it's telling me to verify whether libvirt is running or not.

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/dist-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

When I check the status of libvirt, it indeed isn't active. But I couldn't myself a solution.

*aleeq@aleeq-MS-7A15:~$ sudo systemctl status libvirtd
[sudo] password for aleeq: 
× libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor pres>
     Active: failed (Result: start-limit-hit) since Wed 2022-03-02 21:27:26 +08>
TriggeredBy: × libvirtd-ro.socket
             × libvirtd.socket
             × libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
    Process: 2948 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, sta>
   Main PID: 2948 (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 32768)
     Memory: 9.7M
        CPU: 168ms
     CGroup: /system.slice/libvirtd.service
             ├─1198 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
             └─1199 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/defa>
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq[1198]: read /var/lib/libvirt/dnsmasq/defa>
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq-dhcp[1198]: read /var/lib/libvirt/dnsmasq>
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Deactivated success>
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1198 (>
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1199 (>
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Start request repea>
lines 1-23...skipping...
× libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
     Active: failed (Result: start-limit-hit) since Wed 2022-03-02 21:27:26 +08; 5min ago
TriggeredBy: × libvirtd-ro.socket
             × libvirtd.socket
             × libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
    Process: 2948 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS)
   Main PID: 2948 (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 32768)
     Memory: 9.7M
        CPU: 168ms
     CGroup: /system.slice/libvirtd.service
             ├─1198 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             └─1199 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq[1198]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq-dhcp[1198]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Deactivated successfully.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1198 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1199 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Start request repeated too quickly.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Failed with result 'start-limit-hit'.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1198 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1199 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: Failed to start Virtualization daemon.
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-27/27 (END)
× libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
     Active: failed (Result: start-limit-hit) since Wed 2022-03-02 21:27:26 +08; 5min ago
TriggeredBy: × libvirtd-ro.socket
             × libvirtd.socket
             × libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
    Process: 2948 ExecStart=/usr/sbin/libvirtd $libvirtd_opts (code=exited, status=0/SUCCESS)
   Main PID: 2948 (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 32768)
     Memory: 9.7M
        CPU: 168ms
     CGroup: /system.slice/libvirtd.service
             ├─1198 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leases>
             └─1199 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leases>
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq[1198]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Mac 02 21:27:26 aleeq-MS-7A15 dnsmasq-dhcp[1198]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Deactivated successfully.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1198 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1199 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Start request repeated too quickly.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Failed with result 'start-limit-hit'.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1198 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: libvirtd.service: Unit process 1199 (dnsmasq) remains running after unit stopped.
Mac 02 21:27:26 aleeq-MS-7A15 systemd[1]: Failed to start Virtualization daemon.
~
~
~
~
~
~
~
~
~
~
lines 1-27/27 (END)*

I'm looking forward for a solution. Thanks for your help in advance!

nobody avatar
gh flag
Please try following `sudo systemctl stop apparmor.service` then try again.
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.