You are not logged in.

#1 2025-11-10 23:29:11

ryanbarillos
Member
Registered: 2023-11-29
Posts: 51

[SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

In a nutshell, my error is one-to-one identical to this forum post from 2022, except it now happens to me in 2025.

And it bothers me... so, so much.

Every time I want to run one of my QEMU VMs, I always get this error:

Error starting domain: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 67, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb
    callback(*args, **kwargs)
    ~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1446, in startup
    self._backend.create()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/libvirt.py", line 1390, in create
    raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory

And the only way to fix this error every, single time I boot my computer is typing this following command:

sudo systemctl disable libvirtd && sudo systemctl enable --now libvirtd

And I don't know where to start solving the root cause of my issue.

Based on the error messages I get, it's both the issues of dnsmasq and libvirt legacy monolithic daemon:

[user@arch ~]$ systemctl status libvirtd
○ libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled)
     Active: inactive (dead) since Tue 2025-11-11 01:51:13 +03; 18min ago
   Duration: 9min 29.601s
 Invocation: 36576747ee114ec4a0fc2e54ddeb3643
TriggeredBy: ○ libvirtd.socket
             ○ libvirtd-ro.socket
             ○ libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/
    Process: 840 ExecStart=/usr/bin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 840 (code=exited, status=0/SUCCESS)
      Tasks: 2 (limit: 32768)
     Memory: 32.4M (peak: 47M)
        CPU: 527ms
     CGroup: /system.slice/libvirtd.service
             ├─980 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>
             └─981 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>

Nov 11 01:41:44 arch dnsmasq[980]: read /etc/hosts - 4 names
Nov 11 01:41:44 arch dnsmasq[980]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 names
Nov 11 01:41:44 arch dnsmasq-dhcp[980]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Nov 11 01:41:48 arch dnsmasq[980]: reading /etc/resolv.conf
Nov 11 01:41:48 arch dnsmasq[980]: using nameserver 192.168.124.167#53
Nov 11 01:51:13 arch systemd[1]: Stopping libvirt legacy monolithic daemon...
Nov 11 01:51:13 arch systemd[1]: libvirtd.service: Deactivated successfully.
Nov 11 01:51:13 arch systemd[1]: libvirtd.service: Unit process 980 (dnsmasq) remains running after unit stopped.
Nov 11 01:51:13 arch systemd[1]: libvirtd.service: Unit process 981 (dnsmasq) remains running after unit stopped.
Nov 11 01:51:13 arch systemd[1]: Stopped libvirt legacy monolithic daemon.
lines 1-29/29 (END)

After restarting libvirtd service, the problem is gone!

[user@arch~]$ sudo systemctl disable libvirtd && sudo systemctl enable --now libvirtd
[sudo] password for user: 
Removed '/etc/systemd/system/multi-user.target.wants/libvirtd.service'.
Removed '/etc/systemd/system/sockets.target.wants/virtlockd.socket'.
Removed '/etc/systemd/system/sockets.target.wants/virtlogd.socket'.
Removed '/etc/systemd/system/sockets.target.wants/libvirtd.socket'.
Removed '/etc/systemd/system/sockets.target.wants/libvirtd-ro.socket'.
Removed '/etc/systemd/system/sockets.target.wants/libvirtd-admin.socket'.
Removed '/etc/systemd/system/sockets.target.wants/virtlockd-admin.socket'.
Removed '/etc/systemd/system/sockets.target.wants/virtlogd-admin.socket'.
Disabling 'libvirtd.service', but its triggering units are still active:
libvirtd-admin.socket, libvirtd.socket, libvirtd-ro.socket
Created symlink '/etc/systemd/system/multi-user.target.wants/libvirtd.service' → '/usr/lib/systemd/system/libvirtd.service'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlockd.socket' → '/usr/lib/systemd/system/virtlockd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlogd.socket' → '/usr/lib/systemd/system/virtlogd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd.socket' → '/usr/lib/systemd/system/libvirtd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-ro.socket' → '/usr/lib/systemd/system/libvirtd-ro.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-admin.socket' → '/usr/lib/systemd/system/libvirtd-admin.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlockd-admin.socket' → '/usr/lib/systemd/system/virtlockd-admin.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlogd-admin.socket' → '/usr/lib/systemd/system/virtlogd-admin.socket'.
[user@arch ~]$ ^C
[user@arch ~]$ ^C
[user@arch ~]$ ^C
[user@arch ~]$  systemctl status libvirtd
● libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-11-11 02:12:03 +03; 1min 59s ago
 Invocation: 1570704ee0c74b58b4eb06c915962ba3
TriggeredBy: ● libvirtd-ro.socket
             ● libvirtd.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/
   Main PID: 23427 (libvirtd)
      Tasks: 23 (limit: 32768)
     Memory: 44.4M (peak: 47M)
        CPU: 437ms
     CGroup: /system.slice/libvirtd.service
             ├─  980 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/lib>
             ├─  981 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/lib>
             └─23427 /usr/bin/libvirtd --timeout 120

Nov 11 02:12:03 arch systemd[1]: Starting libvirt legacy monolithic daemon...
Nov 11 02:12:03 arch systemd[1]: Started libvirt legacy monolithic daemon.
Nov 11 02:12:03 arch dnsmasq[980]: read /etc/hosts - 4 names
Nov 11 02:12:03 arch dnsmasq[980]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 names
Nov 11 02:12:03 arch dnsmasq-dhcp[980]: read /var/lib/libvirt/dnsmasq/default.hostsfile
~
~
~
~
~
~
lines 1-23/23 (END)

I just don't know why. I know this isn't normal behavior, and I'm looking to know how to fix this.

As for other info regarding my system:
- I've already set QEMU network to autostart on-boot with virt-manager -> Edit -> Connection Details -> toggle Autostart On Boot
- I have Waydroid (Android on Linux + full Wayland support) installed on my system, which as a hard dependency on dnsmasq for it to run (IDK why it'll show up on libvirtd's messages)
- I haven't tried re-installing qemu-full package (which I use to have QEMU, though it's updated to the latest version 10.1.2-2)

Any help is appreciated!
Cheers.

Last edited by ryanbarillos (2025-11-12 11:29:05)

Offline

#2 2025-11-11 10:49:17

ryanbarillos
Member
Registered: 2023-11-29
Posts: 51

Re: [SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

Looking through my journal after a fresh boot, it gives me the following:

[user@arch ~]$ journalctl -xb | grep libvirt
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt locking daemon socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt locking daemon admin socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt logging daemon socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt logging daemon admin socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt QEMU daemon socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt QEMU daemon admin socket.
Nov 11 12:17:05 arch systemd[1]: Listening on libvirt QEMU daemon read-only socket.
Nov 11 12:17:06 arch systemd[1]: Starting libvirt legacy monolithic daemon...
░░ Subject: A start job for unit libvirtd.service has begun execution
░░ A start job for unit libvirtd.service has begun execution.
Nov 11 12:17:06 arch systemd[1]: Started libvirt legacy monolithic daemon.
░░ Subject: A start job for unit libvirtd.service has finished successfully
░░ A start job for unit libvirtd.service has finished successfully.
Nov 11 12:17:07 arch dnsmasq[996]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 names
Nov 11 12:17:07 arch dnsmasq-dhcp[996]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Nov 11 12:17:53 arch systemd[1]: Stopping libvirt legacy monolithic daemon...
░░ Subject: A stop job for unit libvirtd.service has begun execution
░░ A stop job for unit libvirtd.service has begun execution.
Nov 11 12:17:53 arch systemd[1]: libvirtd.service: Deactivated successfully.
░░ The unit libvirtd.service has successfully entered the 'dead' state.
Nov 11 12:17:53 arch systemd[1]: libvirtd.service: Unit process 996 (dnsmasq) remains running after unit stopped.
Nov 11 12:17:53 arch systemd[1]: libvirtd.service: Unit process 997 (dnsmasq) remains running after unit stopped.
Nov 11 12:17:53 arch systemd[1]: Stopped libvirt legacy monolithic daemon.
░░ Subject: A stop job for unit libvirtd.service has finished
░░ A stop job for unit libvirtd.service has finished.
Nov 11 12:17:53 arch systemd[1]: Starting libvirt QEMU daemon...
Nov 11 12:17:53 arch systemd[1]: Started libvirt QEMU daemon.
Nov 11 12:17:54 arch virtqemud[5478]: libvirt version: 11.9.0
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 11 12:17:54 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 11 12:17:56 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:19:31 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:19:36 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:28:11 arch sudo[16139]:    user : TTY=pts/0 ; PWD=/run/libvirt ; USER=root ; COMMAND=/usr/bin/pacman -Rns nftables
Nov 11 12:43:14 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 11 12:47:48 arch virtqemud[5478]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
[user@arch ~]$ 

Checking the files from this directory outputs the following:

[user@arch ~]$ ls -l /var/run/libvirt/
total 0
drwx------ 2 root  root  60 Nov 11 12:17 common
drwxr-xr-x 2 root  root  40 Nov 11 12:17 hostdevmgr
drwx------ 2 root  root  40 Nov 11 12:17 interface
drwxr-xr-x 2 root  root  60 Nov 11 12:17 lxc
drwxr-xr-x 2 root  root 120 Nov 11 12:17 network
drwx------ 2 root  root  40 Nov 11 12:17 nodedev
drwx------ 2 root  root  40 Nov 11 12:17 nwfilter
drwx------ 2 root  root  40 Nov 11 12:17 nwfilter-binding
drwxr-xr-x 7 user kvm  180 Nov 11 12:17 qemu
drwx------ 2 root  root  40 Nov 11 12:17 secrets
drwxr-xr-x 2 root  root  60 Nov 11 12:17 storage
srw------- 1 root  root   0 Nov 11 12:17 virtlockd-admin-sock
srw------- 1 root  root   0 Nov 11 12:17 virtlockd-sock
srw------- 1 root  root   0 Nov 11 12:17 virtlogd-admin-sock
srw------- 1 root  root   0 Nov 11 12:17 virtlogd-sock
srw------- 1 root  root   0 Nov 11 12:17 virtqemud-admin-sock
srw-rw-rw- 1 root  root   0 Nov 11 12:17 virtqemud-sock
srw-rw-rw- 1 root  root   0 Nov 11 12:17 virtqemud-sock-ro
[user@arch ~]$ 

Not sure if it helps, but it's something.

Also poked around online, and found this from libvirt wiki page:

(the important parts are "dnsmasq" and "exit status 2") then the problem is most likely a systemwide dnsmasq instance that is already listening on libvirt's bridge (thus preventing libvirt's own dnsmasq instance from doing so).

Although I don't see an "exit status 2" in my systemctl logs (or journalctl logs), I'm wondering if Waydroid using dnsmasq is interfering with Libvirt/QEMU starting up its network.


But doing the following shows that Libvirt network is available, but status is down

[user@arch ~]$ ip addr
... [Other entries have been hidden to prevent a DDOS to myself] ...
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc htb state DOWN group default qlen 1000
    link/ether 52:54:00:6f:32:4e brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
[user@arch ~]$

These are all the info I've found so far. Not sure where to go from here.

Offline

#3 2025-11-11 12:05:56

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,951

Re: [SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

A possible cause is conflicting services, please post the output of

find /etc/systemd -type l -exec test -f {} \; -print | sort

For testing purposes disable libvirtd .
After the system has booted up, run systemctl start libvirtd .

Do things work this way ?

Last edited by Lone_Wolf (2025-11-11 12:06:19)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2025-11-11 22:12:30

ryanbarillos
Member
Registered: 2023-11-29
Posts: 51

Re: [SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

Lone_Wolf wrote:

A possible cause is conflicting services, please post the output of

find /etc/systemd -type l -exec test -f {} \; -print | sort

For testing purposes disable libvirtd .
After the system has booted up, run systemctl start libvirtd .

Do things work this way ?

I've disabled libvirtd before restarting.

I'm now on a fresh reboot of my system, and the terminal output is as such:

[user@arch ~]$ sudo systemctl enable libvirtd
[sudo] password for user: 
Created symlink '/etc/systemd/system/multi-user.target.wants/libvirtd.service' → '/usr/lib/systemd/system/libvirtd.service'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlockd.socket' → '/usr/lib/systemd/system/virtlockd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlogd.socket' → '/usr/lib/systemd/system/virtlogd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd.socket' → '/usr/lib/systemd/system/libvirtd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-ro.socket' → '/usr/lib/systemd/system/libvirtd-ro.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-admin.socket' → '/usr/lib/systemd/system/libvirtd-admin.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlockd-admin.socket' → '/usr/lib/systemd/system/virtlockd-admin.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtlogd-admin.socket' → '/usr/lib/systemd/system/virtlogd-admin.socket'.

[user@arch ~]$ find /etc/systemd -type l -exec test -f {} \; -print | sort
/etc/systemd/system/bluetooth.target.wants/bluetooth.service
/etc/systemd/system/dbus-org.bluez.service
/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service
/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service
/etc/systemd/system/dbus-org.freedesktop.timesync1.service
/etc/systemd/system/display-manager.service
/etc/systemd/system/flatpak-update.service
/etc/systemd/system/flatpak-update.timer
/etc/systemd/system/getty.target.wants/getty@tty1.service
/etc/systemd/system/getty.target.wants/supergfxd.service
/etc/systemd/system/graphical.target.wants/power-profiles-daemon.service
/etc/systemd/system/multi-user.target.wants/cups.path
/etc/systemd/system/multi-user.target.wants/cups.service
/etc/systemd/system/multi-user.target.wants/firewalld.service
/etc/systemd/system/multi-user.target.wants/libvirtd.service
/etc/systemd/system/multi-user.target.wants/NetworkManager.service
/etc/systemd/system/multi-user.target.wants/nvidia-powerd.service
/etc/systemd/system/multi-user.target.wants/reflector.service
/etc/systemd/system/multi-user.target.wants/remote-fs.target
/etc/systemd/system/multi-user.target.wants/waydroid-container.service
/etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service
/etc/systemd/system/printer.target.wants/cups.service
/etc/systemd/system/sockets.target.wants/cups.socket
/etc/systemd/system/sockets.target.wants/libvirtd-admin.socket
/etc/systemd/system/sockets.target.wants/libvirtd-ro.socket
/etc/systemd/system/sockets.target.wants/libvirtd.socket
/etc/systemd/system/sockets.target.wants/systemd-userdbd.socket
/etc/systemd/system/sockets.target.wants/virtlockd-admin.socket
/etc/systemd/system/sockets.target.wants/virtlockd.socket
/etc/systemd/system/sockets.target.wants/virtlogd-admin.socket
/etc/systemd/system/sockets.target.wants/virtlogd.socket
/etc/systemd/system/sockets.target.wants/virtqemud-admin.socket
/etc/systemd/system/sockets.target.wants/virtqemud-ro.socket
/etc/systemd/system/sockets.target.wants/virtqemud.socket
/etc/systemd/system/sysinit.target.wants/systemd-boot-update.service
/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service
/etc/systemd/system/systemd-hibernate.service.wants/nvidia-hibernate.service
/etc/systemd/system/systemd-hibernate.service.wants/nvidia-resume.service
/etc/systemd/system/systemd-suspend.service.wants/nvidia-resume.service
/etc/systemd/system/systemd-suspend.service.wants/nvidia-suspend.service
/etc/systemd/system/systemd-suspend-then-hibernate.service.wants/nvidia-resume.service
/etc/systemd/system/timers.target.wants/flatpak-update.timer
/etc/systemd/system/timers.target.wants/fstrim.timer
/etc/systemd/system/timers.target.wants/reflector.timer
/etc/systemd/user/graphical-session-pre.target.wants/xdg-user-dirs.service
/etc/systemd/user/pipewire.service.wants/wireplumber.service
/etc/systemd/user/pipewire-session-manager.service
/etc/systemd/user/sockets.target.wants/gnome-keyring-daemon.socket
/etc/systemd/user/sockets.target.wants/p11-kit-server.socket
/etc/systemd/user/sockets.target.wants/pipewire-pulse.socket
/etc/systemd/user/sockets.target.wants/pipewire.socket
/etc/systemd/user/sockets.target.wants/speech-dispatcher.socket
[user@arch ~]$ 

Offline

#5 2025-11-12 11:04:46

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,951

Re: [SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

Please use multiple [ code ] [ /code] blocks to keep such outputs readable .
See https://bbs.archlinux.org/help.php#bbcode for the options this forum software supports.



sudo systemctl enable libvirtd

I asked you to start the service, not enable it.
The services output does show some potential conflicts .

/etc/systemd/system/multi-user.target.wants/firewalld.service
/etc/systemd/system/multi-user.target.wants/libvirtd.service
/etc/systemd/system/multi-user.target.wants/NetworkManager.service

/etc/systemd/system/multi-user.target.wants/waydroid-container.service

firewalld and libvirtd both change nftables/iptables rules, it's also very common for container services to change such rules.
Then there's the possibility networkmanager hasn't finished initialising the network when the other services try to use it .

disable firewalld , libvirtd and waydroid-container services,
Boot up to multi-user target to reduce the number of services started.
Don't start the gui, login as root to tty .
run ip a to ensure everything network related has been setup completely .

Then start libvirtd .
if that fails, firewalld and waydroid-container are not involved .
In case it succeeds,

reboot and try starting firewalld before libvirtd.
if that fails libvirtd and firewalld clash.
Incase it succeeds,
reboot and start firewalld and waydroid-container before libvirtd .

Last edited by Lone_Wolf (2025-11-12 11:06:35)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#6 2025-11-12 11:27:42

ryanbarillos
Member
Registered: 2023-11-29
Posts: 51

Re: [SOLVED] [QEMU] Troubles with VMs not working due to libvirt issues

So I kinda found a solution to my problem—and it's not related to dnsmasq!

I stumbled upon this StackOverflow post that pointed me to a Fedora wiki page titled Changes/LibvirtModularDaemons, which explains the following:

Historically all libvirt functionality was provided in the monolithic libvirtd daemon. Upstream has developed a new modular architecture for libvirt where each driver is run in its own daemon. Primarily this provides better robustness as a flaw in a secondary daemon will not affect the QEMU daemon and vica-versa. It should also have slightly lower host startup overhead, because only the installed hypervisor daemon(s) will need to be fully started on boot, the other daemons can be socket activated on demand.
...
The intended change is to remove libvirtd.service and instead add [the following:]

 virtqemud.service
 virtxend.service
 virtlxcd.service
 virtinterfaced.socket
 virtnetworkd.socket
 virtnodedevd.socket
 virtnwfilterd.socket
 virtproxyd.socket
 virtsecretd.socket
 virtstoraged.socket

This gave me the idea: All of these are SystemD services!
And the big reason why I keep getting the Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock' is because they're not enabled!

So I checked virtqemud.service:

user@arch ~]$ systemctl status virtqemud
● virtqemud.service - libvirt QEMU daemon
     Loaded: loaded (/usr/lib/systemd/system/virtqemud.service; disabled; preset: disabled)
     Active: active (running) since Wed 2025-11-12 13:35:34 +03; 14min ago
 Invocation: ed413d82c79a47c7ae5fd783dacf72c5
TriggeredBy: ● virtqemud.socket
             ● virtqemud-admin.socket
             ● virtqemud-ro.socket
       Docs: man:virtqemud(8)
             https://libvirt.org/
   Main PID: 6037 (virtqemud)
      Tasks: 20 (limit: 32768)
     Memory: 28.2M (peak: 30.9M)
        CPU: 1.725s
     CGroup: /system.slice/virtqemud.service
             └─6037 /usr/bin/virtqemud --timeout 120

Nov 12 13:47:54 arch su[26235]: (to user) root on none
Nov 12 13:47:54 arch su[26235]: pam_unix(su:session): session opened for user user(uid=1004) by (uid=0)
Nov 12 13:47:54 arch su[26235]: pam_unix(su:session): session closed for user user
Nov 12 13:47:55 arch virtqemud[6037]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 12 13:47:55 arch virtqemud[6037]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 12 13:47:55 arch virtqemud[6037]: Failed to connect socket to '/var/run/libvirt/virtnetworkd-sock': No such file or directory
Nov 12 13:47:55 arch virtqemud[6037]: Unable to release network device '<null>'
Nov 12 13:47:58 arch su[26273]: (to user) root on none
Nov 12 13:47:58 arch su[26273]: pam_unix(su:session): session opened for user user(uid=1004) by (uid=0)
Nov 12 13:47:58 arch su[26273]: pam_unix(su:session): session closed for user user
[user@arch ~]$ 

And I turned virtnetworkd.socket on:

[user@arch ~]$ systemctl status virtnetworkd.socket
○ virtnetworkd.socket - libvirt network daemon socket
     Loaded: loaded (/usr/lib/systemd/system/virtnetworkd.socket; disabled; preset: disabled)
     Active: inactive (dead)
   Triggers: ● virtnetworkd.service
     Listen: /run/libvirt/virtnetworkd-sock (Stream)

[user@arch ~]$ sudo systemctl enable --now virtnetworkd.socket
[sudo] password for user: 
Created symlink '/etc/systemd/system/sockets.target.wants/virtnetworkd.socket' → '/usr/lib/systemd/system/virtnetworkd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtnetworkd-ro.socket' → '/usr/lib/systemd/system/virtnetworkd-ro.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/virtnetworkd-admin.socket' → '/usr/lib/systemd/system/virtnetworkd-admin.socket'.
[user@arch ~]$ systemctl status virtnetworkd.socket
● virtnetworkd.socket - libvirt network daemon socket
     Loaded: loaded (/usr/lib/systemd/system/virtnetworkd.socket; enabled; preset: disabled)
     Active: active (listening) since Wed 2025-11-12 13:51:06 +03; 5s ago
 Invocation: d7f1c2f872194213ad62bab81c5d3802
   Triggers: ● virtnetworkd.service
     Listen: /run/libvirt/virtnetworkd-sock (Stream)

Nov 12 13:51:06 arch systemd[1]: Listening on libvirt network daemon socket.
[user@arch ~]$ 

After a reboot, all my QEMU VMs now run without needing to manually disabling & enabling libvirtd.service!
Now to enable all the other VirtQEMU modular services, as seen in systemctl logs:

[user@arch ~]$ systemctl status virtqemud
● virtqemud.service - libvirt QEMU daemon
     Loaded: loaded (/usr/lib/systemd/system/virtqemud.service; disabled; preset: disabled)
     Active: active (running) since Wed 2025-11-12 13:58:19 +03; 13s ago
 Invocation: 4d366ebff6ca4e1aadefc7fcc8a9543e
TriggeredBy: ● virtqemud.socket
             ● virtqemud-ro.socket
             ● virtqemud-admin.socket
       Docs: man:virtqemud(8)
             https://libvirt.org/
   Main PID: 5740 (virtqemud)
      Tasks: 19 (limit: 32768)
     Memory: 14.3M (peak: 15.7M)
        CPU: 141ms
     CGroup: /system.slice/virtqemud.service
             └─5740 /usr/bin/virtqemud --timeout 120

Nov 12 13:58:19 arch systemd[1]: Started libvirt QEMU daemon.
Nov 12 13:58:19 arch virtqemud[5740]: libvirt version: 11.9.0
Nov 12 13:58:19 arch virtqemud[5740]: hostname: arch
Nov 12 13:58:19 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtnodedevd-sock': No such file or directory
Nov 12 13:58:20 arch virtqemud[5740]: Failed to connect socket to '/var/run/libvirt/virtstoraged-sock': No such file or directory
[user@arch ~]$ 

Reading further on the Fedora wiki page, it seems the transition is done manually for all existing [Fedora] Linux installs:

Existing Fedora installs using libvirtd will be unaffected by the change in presets and will continue to use monolithic libvirtd. To opt-in to using the new modular daemons follow instructions at https://libvirt.org/daemons.html#switch … ar-daemons

New Fedora installs will get modular daemons instead of libvirtd. This is intended to be functionally transparent to applications using libvirt APIs.
...
At some point in the future it is intended that the monolithic libvirtd will be entirely removed by libvirt upstream. This is predicated on prolonged successful deployment of the modular daemons in one or more major distros. Thus the likely timeframe is Fedora 37 at the earliest (i.e. min 1 year from successful usage of modular daemons in a distro).

Kinda a bummer. Oh, well.

Offline

Board footer

Powered by FluxBB