You are not logged in.

#1 2024-07-23 01:20:29

Soultrigger
Member
From: Brazil
Registered: 2021-11-04
Posts: 107

[Solved] libvirtd error - dnsmasq - socket/address already in use

The issue is that its been a while I dont use my VMs, and I wanted to use it again. Virt-Manager/Libvirtd fails completely to start network connection.

The error I get is:

Não foi possível completar a instalação: "Operação requisitada não é válida: network 'default' is not active"

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 72, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/createvm.py", line 2008, in _do_async_install
    installer.start_install(guest, meter=meter)
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 695, in start_install
    domain = self._create_guest(
             ^^^^^^^^^^^^^^^^^^^
  File "/usr/share/virt-manager/virtinst/install/installer.py", line 637, in _create_guest
    domain = self.conn.createXML(initial_xml or final_xml, 0)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/libvirt.py", line 4545, in createXML
    raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: Operação requisitada não é válida: network 'default' is not active

The output of "systemctl status libvird"

libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; preset: disabled)
     Active: inactive (dead) since Mon 2024-07-22 21:46:50 -03; 20min ago
   Duration: 2min 99ms
 Invocation: 1085ee8870bc4321990642bcb43308ca
TriggeredBy: ● libvirtd-ro.socket
             ● libvirtd.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/
    Process: 826 ExecStart=/usr/bin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS)
   Main PID: 826 (code=exited, status=0/SUCCESS)

jul 22 21:44:50 soul systemd[1]: Starting libvirt legacy monolithic daemon...
jul 22 21:44:50 soul systemd[1]: Started libvirt legacy monolithic daemon.
jul 22 21:44:50 soul dnsmasq[918]: failed to create listening socket for 192.168.122.1: Address already in use
jul 22 21:44:50 soul dnsmasq[918]: FAILED to start up
jul 22 21:44:50 soul libvirtd[826]: libvirt version: 10.5.0
jul 22 21:44:50 soul libvirtd[826]: hostname: soul
jul 22 21:44:50 soul libvirtd[826]: erro interno: Processo filho (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) inesperado >
                                    dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use
jul 22 21:46:50 soul systemd[1]: libvirtd.service: Deactivated successfully.

Output of "systemctl status dnsmasq"

systemctl status dnsmasq                                                                                                                                                                             

● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; preset: disabled)
     Active: active (running) since Mon 2024-07-22 21:44:50 -03; 27min ago
 Invocation: 85d8425a580f4afa8b1a67e5f0c98c67
       Docs: man:dnsmasq(8)
    Process: 825 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
   Main PID: 835 (dnsmasq)
      Tasks: 1 (limit: 19039)
     Memory: 1.5M (peak: 2.7M)
        CPU: 49ms
     CGroup: /system.slice/dnsmasq.service
             └─835 /usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file

jul 22 21:44:50 soul dnsmasq[835]: read /etc/hosts - 4 names
jul 22 21:44:53 soul dnsmasq[835]: reading /etc/resolv.conf
jul 22 21:44:53 soul dnsmasq[835]: using nameserver 8.8.8.8#53
jul 22 21:44:53 soul dnsmasq[835]: using nameserver 8.8.4.4#53
jul 22 21:44:53 soul dnsmasq[835]: using nameserver 1.1.1.1#53
jul 22 21:44:54 soul dnsmasq[835]: reading /etc/resolv.conf
jul 22 21:44:54 soul dnsmasq[835]: using nameserver 8.8.8.8#53
jul 22 21:44:54 soul dnsmasq[835]: using nameserver 8.8.4.4#53
jul 22 21:44:54 soul dnsmasq[835]: using nameserver 1.1.1.1#53
jul 22 21:44:54 soul dnsmasq[835]: using nameserver fe80::da36:5fff:fefc:b9cb%eno1#53

Output of "brctl show" is nothing, it seems I dont have any bridge up and I cant even remove the virbr0 (what seems to be the standard for libvirtd network)

Output of "sudo virsh net-list --all"

sudo virsh net-list --all                                                                                                                                                                                     
[sudo] senha para soultrigger: 
 Nome      Estado    Auto-iniciar   Persistente
-------------------------------------------------
 default   inativo   sim            sim

Outuput of "sudo virsh net-start default"

sudo virsh net-start default                    
erro:Falha ao iniciar a rede default
erro:erro interno: Processo filho (VIR_BRIDGE_NAME=virbr0 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper) inesperado status de saída 2: 
dnsmasq: failed to create listening socket for 192.168.122.1: Address already in use

It must be some miss configuration in some file that I may have altered someday. The "/etc/dnsmasq.conf" is all comented with #.

It also seems to be trying to listen to address 192.168.122.1 and my lan works with 192.168.200.x, and my machine is always 192.168.200.5....

I accept any tips on what to research or where to go from here. I did read lots of random issues, but didnt seem like any of them were really similar to my issue.

Last edited by Soultrigger (2024-07-27 00:26:52)

Offline

#2 2024-07-23 01:27:48

Soultrigger
Member
From: Brazil
Registered: 2021-11-04
Posts: 107

Re: [Solved] libvirtd error - dnsmasq - socket/address already in use

My Vms are on /mnt/vm and the folder permission is root user and libvirt-qemu group.

All qcow2 files are owned by my user and libvirt-qemu group.

If it matters.

Offline

#3 2024-07-23 12:43:51

croxymoc
Member
Registered: 2024-07-19
Posts: 8

Re: [Solved] libvirtd error - dnsmasq - socket/address already in use

Do you by chance have systemd-resolved also running?

Offline

#4 2024-07-23 21:19:59

Soultrigger
Member
From: Brazil
Registered: 2021-11-04
Posts: 107

Re: [Solved] libvirtd error - dnsmasq - socket/address already in use

croxymoc wrote:

Do you by chance have systemd-resolved also running?

ystemctl status systemd-resolved                                                                                                                                                                                  ✔  18:18:04 
○ systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:systemd-resolved.service(8)
             man:org.freedesktop.resolve1(5)
             https://systemd.io/WRITING_NETWORK_CONFIGURATION_MANAGERS
             https://systemd.io/WRITING_RESOLVER_CLIENTS

I think it is disabled, but I am not sure since the outupt left me confused.

Offline

#5 2024-07-27 00:26:28

Soultrigger
Member
From: Brazil
Registered: 2021-11-04
Posts: 107

Re: [Solved] libvirtd error - dnsmasq - socket/address already in use

The Solution - TLDR Stop/Disable dnsmasq

I reinstalled my system just to make sure, but the issue kept going on.

Usually virt-manager/libvirt/qemu works out of the box on Arch Linux, but it seems I was using an old installation guide (I didnt update my guide for like 10 years haha), and I always enbaled the dnsmasq service and it worked...

But after reading a lot of things, someone pointed out that we shouldnt enable dnsmasq service because libvirt enables it whenever he needs it, and when I stopped and disabled it, libvirt could work flawlesly without messing with any configurations...

Offline

#6 2024-09-03 11:55:26

sipak
Member
Registered: 2019-02-03
Posts: 10

Re: [Solved] libvirtd error - dnsmasq - socket/address already in use

I don't think this is right. 
libvirtd should not interfere with whatever else dns service is running in the system.
I need and have been running my own dnsmasq+dnscrypt with libvirtd without any problems for years. Not it suddenly decides to use port 53 on host instead of using whatever interface or port libvirtd had been using since forever.

Smells like a bug.... or somebody who thought this was a wonderful idea and I hope not somebody too hard to change their mind.

Offline

Board footer

Powered by FluxBB