You are not logged in.

#1 2017-11-12 13:35:54

Utini
Member
Registered: 2015-09-28
Posts: 218
Website

dnsmasq: failed to create listening socket for port 53: Address in use

I just wanted to setup dnsmasq on my HTPC (GNOME with NetworkManager) but dnsmasq fails to start:

● dnsmasq.service - A lightweight DHCP and caching DNS server
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2017-11-12 14:11:49 CET; 15min ago
     Docs: man:dnsmasq(8)
  Process: 1057 ExecStart=/usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file (code=exited, status=2)
  Process: 1056 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 1057 (code=exited, status=2)

Nov 12 14:11:49 HTPC systemd[1]: Starting A lightweight DHCP and caching DNS server...
Nov 12 14:11:49 HTPC dnsmasq[1056]: dnsmasq: syntax check OK.
Nov 12 14:11:49 HTPC dnsmasq[1057]: dnsmasq: failed to create listening socket for port 53: Address already in use
Nov 12 14:11:49 HTPC dnsmasq[1057]: failed to create listening socket for port 53: Address already in use
Nov 12 14:11:49 HTPC dnsmasq[1057]: FAILED to start up
Nov 12 14:11:49 HTPC systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 12 14:11:49 HTPC systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Nov 12 14:11:49 HTPC systemd[1]: Failed to start A lightweight DHCP and caching DNS server.

cat /etc/services | grep 53

domain             53/tcp
domain             53/udp

sudo netstat -putan | grep 53

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      693/dnsmasq         
udp        0      0 127.0.0.1:53            0.0.0.0:*                           693/dnsmasq         

According to netstat it seems like dnsmasq is already running?
According to systemctl it seems like dnsmasq has failed starting and is inactive?

/etc/NetworkManager/NetworkManager.conf

# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.

[main]
plugins=keyfile
dns=dnsmasq

/etc/dnsmasq.conf

no-resolv
listen-address=127.0.0.1
cache-size=1000
#conf-file=/usr/share/dnsmasq/trust-anchors.conf
#dnssec
#proxy-dnssec

/etc/NetworkManager/dnsmasq.d/cache.conf

cache-size=1000
no-resolv
#server=127.0.0.1#40
listen-address=127.0.0.1

/etc/resolv.conf

# Generated by resolvconf
#nameserver 192.168.1.1
nameserver 127.0.0.1

/etc/dhcpcd.conf

hostname
duid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
option interface_mtu
require dhcp_server_identifier
slaac private
noipv4ll
nohook resolv.conf

I also ran: chattr +i /etc/resolv.conf

So NetworkManager should start dnsmasq. And dnsmasq should start just fine. Neither are working :S
@edit: When checking with gnome's task manager then "dnsmasq" is actually running by user "nobody". Whats going on there? yikes
Any ideas?

Last edited by Utini (2017-11-12 13:38:42)


www.whymacsucks.com - Just the truth about why Mac sucks !

Setup: Dell XPS15 9530, 15.6" QHD Touchscreen - i7-4702HQ 2.2-3.2Ghz - 16GB RAM - NVIDIA GT 750M 2GB - Samsung SSD SM841 512GB
Accessories: Filco Majestouch Tenkeyless MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD600 + Audio-GD NFB-12.1

Offline

#2 2017-11-12 13:39:44

nesk
Member
Registered: 2011-03-31
Posts: 145

Re: dnsmasq: failed to create listening socket for port 53: Address in use

AFAIK NM doesn't start dnsmasq.service, it just runs dnsmasq binary as a daemon.
Stop and disable dnsmasq.service, check with ps if dnsmasq process is present on the system when you start NM.


My minimalist setup (WIP): TTY on second GPU + startx (no DM) + i3 + dunst

Offline

#3 2017-11-12 13:58:16

Utini
Member
Registered: 2015-09-28
Posts: 218
Website

Re: dnsmasq: failed to create listening socket for port 53: Address in use

Hmm nope.. not for me:

ps -A | grep dnsmasq -> not output

After manually starting dnsmasq (systemctl start dnsmasq.service):
ps -A | grep dnsmasq -> 1019 ? 00:00:00 dnsmasq

Btw, dnsmasq seems to start correctly when starting it manually. But no dns resolving possible:

dnsmasq.service - A lightweight DHCP and caching DNS server
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-11-12 14:54:50 CET; 2min 19s ago
     Docs: man:dnsmasq(8)
  Process: 1018 ExecStartPre=/usr/bin/dnsmasq --test (code=exited, status=0/SUCCESS)
 Main PID: 1019 (dnsmasq)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/dnsmasq.service
           1019 /usr/bin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file

Nov 12 14:54:50 HTPC systemd[1]: Starting A lightweight DHCP and caching DNS server...
Nov 12 14:54:50 HTPC dnsmasq[1018]: dnsmasq: syntax check OK.
Nov 12 14:54:50 HTPC systemd[1]: Started A lightweight DHCP and caching DNS server.
Nov 12 14:54:50 HTPC dnsmasq[1019]: started, version 2.78 cachesize 1000
Nov 12 14:54:50 HTPC dnsmasq[1019]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify
Nov 12 14:54:50 HTPC dnsmasq[1019]: DBus support enabled: connected to system bus
Nov 12 14:54:50 HTPC dnsmasq[1019]: warning: no upstream servers configured
Nov 12 14:54:50 HTPC dnsmasq[1019]: read /etc/hosts - 2 addresses

ping google.com

ping: google.com: Name or service not known

www.whymacsucks.com - Just the truth about why Mac sucks !

Setup: Dell XPS15 9530, 15.6" QHD Touchscreen - i7-4702HQ 2.2-3.2Ghz - 16GB RAM - NVIDIA GT 750M 2GB - Samsung SSD SM841 512GB
Accessories: Filco Majestouch Tenkeyless MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD600 + Audio-GD NFB-12.1

Offline

#4 2017-11-12 14:04:13

nesk
Member
Registered: 2011-03-31
Posts: 145

Re: dnsmasq: failed to create listening socket for port 53: Address in use

Utini wrote:

sudo netstat -putan | grep 53

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      693/dnsmasq         
udp        0      0 127.0.0.1:53            0.0.0.0:*                           693/dnsmasq         

According to netstat it seems like dnsmasq is already running?
According to systemctl it seems like dnsmasq has failed starting and is inactive?

NetworkManager doesn't use systemd to start dnsmasq. Looks like you don't have a problem.


My minimalist setup (WIP): TTY on second GPU + startx (no DM) + i3 + dunst

Offline

#5 2017-11-12 14:21:42

Utini
Member
Registered: 2015-09-28
Posts: 218
Website

Re: dnsmasq: failed to create listening socket for port 53: Address in use

nesk wrote:
Utini wrote:

sudo netstat -putan | grep 53

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      693/dnsmasq         
udp        0      0 127.0.0.1:53            0.0.0.0:*                           693/dnsmasq         

According to netstat it seems like dnsmasq is already running?
According to systemctl it seems like dnsmasq has failed starting and is inactive?

NetworkManager doesn't use systemd to start dnsmasq. Looks like you don't have a problem.


This was before a reboot.
After a reboot dnsmasq isn't present anymore.

Also I can't resolve any hostnames.


www.whymacsucks.com - Just the truth about why Mac sucks !

Setup: Dell XPS15 9530, 15.6" QHD Touchscreen - i7-4702HQ 2.2-3.2Ghz - 16GB RAM - NVIDIA GT 750M 2GB - Samsung SSD SM841 512GB
Accessories: Filco Majestouch Tenkeyless MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD600 + Audio-GD NFB-12.1

Offline

#6 2017-11-12 15:04:25

Utini
Member
Registered: 2015-09-28
Posts: 218
Website

Re: dnsmasq: failed to create listening socket for port 53: Address in use

Well, I got dnsmasq to correctly resolve hostnames again.
How ever, NetworkManager is not starting dnsmasq on its own.
If I enable dnsmasq.service then dnsmasq will start and resolve correctly.
dnscaching is working correctly as well.


www.whymacsucks.com - Just the truth about why Mac sucks !

Setup: Dell XPS15 9530, 15.6" QHD Touchscreen - i7-4702HQ 2.2-3.2Ghz - 16GB RAM - NVIDIA GT 750M 2GB - Samsung SSD SM841 512GB
Accessories: Filco Majestouch Tenkeyless MX-Brown Mini Otaku, Benq XL2420T (144Hz), Lo(w)gitech G400, Puretrak Talent, Sennheiser HD600 + Audio-GD NFB-12.1

Offline

Board footer

Powered by FluxBB