Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What's going on with dnsmasq?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Sun Nov 11, 2012 11:19 pm    Post subject: What's going on with dnsmasq? Reply with quote

While trying to figure out why NetworkManager is so horribly slow, I came across another tool that's behaving in funny ways. Any explanations?
Code:

localhost ~ # /etc/init.d/dnsmasq stop
 * Stopping dnsmasq ...
 * start-stop-daemon: 1 process refused to stop
 * Failed to stop dnsmasq                                                                                                                              [ !! ]
 * ERROR: dnsmasq failed to stop
localhost ~ # grep dnsmasq /var/log/messages|tail -2
Nov 11 23:11:16 jeanie /etc/init.d/dnsmasq[7788]: start-stop-daemon: 1 process refused to stop
Nov 11 23:11:16 jeanie /etc/init.d/dnsmasq[7780]: ERROR: dnsmasq failed to stop
localhost ~ #     

The changes to the default config are quite limited.
Code:

domain-needed
bogus-priv
resolv-file=/etc/dnsmasq-resolv.conf
interface=lo
conf-file=/etc/dnsmasq-conf.conf

It is possible this only started with version 2.63, but I don't remember when exactly I noticed this first.
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Mon Nov 12, 2012 6:33 am    Post subject: Reply with quote

I can't replicate the error. It stops and starts fine for me. I'm using 2.63.

See what happens when you try:
Code:
/etc/init.d/dnsmasq --nodeps stop

_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Mon Nov 12, 2012 1:37 pm    Post subject: Reply with quote

I've been having troubles with dnsmasq on one of my home systems. The problems appear to be intermittent, but they really drive mythbackend nuts. For the time being, I've shut it down on that system. I'm still using it on other systems with no problems. I haven't had time to diagnose further or debug.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Mon Nov 12, 2012 7:30 pm    Post subject: Reply with quote

I've been using it to manage a two-subnet LAN for four years without any problems. I've never considered using it on a single end-user machine.
_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Mon Nov 12, 2012 8:13 pm    Post subject: Reply with quote

I've used it for years without problems, this is recent.

Once I've kill -KILL'd dnsmasq, I can start, stop and restart it with no problems. But the behaviour I described is somehow related to the interaction with (the train wreck that is) NetworkManager. E.g. when I open, use and close a vpn connection through NM, it becomes un-stoppable after.

Code:

Nov 12 20:01:52 loalhost dnsmasq[11179]: using nameserver 192.168.1.254#53
Nov 12 20:01:52 loalhost NetworkManager[3001]: <info> Clearing nscd hosts cache.
Nov 12 20:01:52 loalhost NetworkManager[3001]: <info> VPN plugin state changed: started (4)
Nov 12 20:01:52 loalhost dbus[2950]: [system] Activating service name='org.freedesktop.nm_dispatcher' (using servicehelper)
Nov 12 20:01:52 loalhost dbus[2950]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Nov 12 20:01:53 loalhost ntpd[3395]: Listen normally on 10 tun0 172.16.123.45 UDP 123
Nov 12 20:01:53 loalhost ntpd[3395]: 46.51.185.173 interface 192.168.1.20 -> 172.16.123.45
Nov 12 20:01:53 loalhost ntpd[3395]: 46.137.159.146 interface 192.168.1.20 -> 172.16.123.45
Nov 12 20:01:53 loalhost ntpd[3395]: 193.1.193.157 interface 192.168.1.20 -> 172.16.123.45
Nov 12 20:01:53 loalhost ntpd[3395]: 134.226.32.57 interface 192.168.1.20 -> 172.16.123.45
Nov 12 20:01:53 loalhost ntpd[3395]: peers refreshed
Nov 12 20:01:57 loalhost NetworkManager[3001]: <info> Policy set 'Auto eth0' (eth0) as default for IPv4 routing and DNS.
Nov 12 20:01:57 loalhost NetworkManager[3001]: <info> ((null)): writing resolv.conf to /sbin/resolvconf
Nov 12 20:02:02 loalhost /etc/init.d/dnsmasq[11279]: start-stop-daemon: 1 process refused to stop
Nov 12 20:02:02 loalhost /etc/init.d/dnsmasq[11273]: ERROR: dnsmasq failed to stop
Nov 12 20:02:02 loalhost dnsmasq[11179]: reading /etc/dnsmasq-resolv.conf
Nov 12 20:02:02 loalhost dnsmasq[11179]: using nameserver 192.168.1.254#53
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Mon Nov 12, 2012 8:19 pm    Post subject: Reply with quote

My main use has been to redirect DNS requests when my VPN to my employer is active. Regular DNS is a rather either/or kind of thing, either I can resolve my LAN or my work network. With dnsmasq I can get both.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Mon Nov 12, 2012 8:59 pm    Post subject: Reply with quote

Did you check your configuration with:
Code:
sudo dnsmasq --test
, the problem you're having may not be a syntax error, so try to start dnsmasq manually in debug mode(no daemon, stderr logging, no fork and so on)
Code:
sudo dnsmasq -d


HTH
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Tue Nov 13, 2012 8:48 am    Post subject: Reply with quote

It passes the syntax check.

Running it in debug mode, vpn fails, no matter whether launched through NM or vpnc directly, and there is no output after the attempt to launch vpn. /var/log/messages says:
Code:

Nov 13 08:42:48 localhost NetworkManager[3001]: <warn> /sys/devices/virtual/net/tun0: couldn't determine device driver; ignoring...

Interesting. I have no idea why NM gets involved even when I run vpnc directly.
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Tue Nov 13, 2012 11:18 am    Post subject: Reply with quote

So dnsmasq started correctly right? if the problem is not solved, it's probably wise to start all over again and explain what your problem really is, cause, you've just started dnsmasq in debug mode and the only output you showed in your post was something unrelated to dnsmasq. We can't really help you here!
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Tue Nov 13, 2012 8:53 pm    Post subject: Reply with quote

Running dnsmasq in debug mode gives me no additional information. When I run dnsmasq in debug mode and attempt to use vpn, vpn doesn't work, and all I get is the log I posted.
Back to top
View user's profile Send private message
mirekm
Apprentice
Apprentice


Joined: 12 Feb 2004
Posts: 210
Location: Gliwice

PostPosted: Thu Nov 15, 2012 4:21 pm    Post subject: Reply with quote

If you use NetworkManager, why start dnsmasq via rc script?
Just remove the dnsmasq from your runlevels, and edit file
/etc/NetworkManager/NetworkManager.conf

Put in it following contents:

[main]
dns=dnsmasq


And then after restat, NetworkManager will start/stop dnsmasq by itself on activation/deactivation of connection.
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1611
Location: U.S.A.

PostPosted: Thu Nov 15, 2012 4:56 pm    Post subject: Reply with quote

A better question might be "why use NetworkManager, at all?" :P
_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Fri Nov 16, 2012 10:58 pm    Post subject: Reply with quote

That's a good point.

I switched to it a few years back for the convenience of having easy access to all networking functions on the desktop. Unfortunately, in the past year or so, it seems design decisions have been made in the software that, at least for me, had detrimental impact on my system. If there was a feature-compatible replacement, I'd certainly give it a try.
Back to top
View user's profile Send private message
Hypnos
Advocate
Advocate


Joined: 18 Jul 2002
Posts: 2889
Location: Omnipresent

PostPosted: Sat Nov 17, 2012 1:49 am    Post subject: Reply with quote

I have been using wicd quite effectively since switching from GNOME to XFCE a few years back. It handles Ethernet and WiFi, which is all I need.
_________________
Personal overlay | Simple backup scheme
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Mon May 04, 2015 11:00 pm    Post subject: Reply with quote

Reviving old thread since problem remains unsolved.

Networkmanager does something funny with dnsmasq. When vpn is not being used, via networkmanager-vpnc, dnsmasq terminates normally on shutdown, and indeed can be terminated normally through its init script. If a vpn connection is established via networkmanager, and then terminated, the dnsmasq process cannot be killed with the init script.

I have verified that networkmanager restarts dnsmasq when vpn is invoked. I.e. the pid changes. And I've verified that /run/dnsmasq.pid is updated along with it, as it should. So it's not a matter of the init script trying to kill an outdated pid.

The init script for dnsmasq has no stop function, so I assume that, under openrc, start-stop-daemon is being used? When I try start-stop-daemon -v -K /usr/sbin/dnsmasq, at first a signal 15 is sent, and then 250 times signal 0. 15 = SIGTERM, and 0 is just a check whether the process exists. Then it exists with "1 process refused to stop".

SIGQUIT works (signal 3). There's no useful information gained from netstat -anp |grep dnsmasq, or strace -p `cat /run/dnsmasq.pid` while invoking the init script.

All this, btw., with a default configuration of dnsmasq. Removing it from runlevel default altogether and adding it to NetworkManager.conf, as suggested, has the effect that dnsmasq never gets killed on shutdown, vpn or not. As a networkmanager child process, it should get killed.

At a guess, networkmanager gets the signal handling wrong for dnsmasq processes launched from it. Maybe it wrongfully traps SIGTERM. I don't think I have the knowledge to figure out whether this speculation has merit by looking at the NM sources.

The environment: network-manager-1.0.0, dnsmasq-2.72, networkmanager-vpnc-0.9.10.0 (1.0.0 doesn't work, full stop).
Back to top
View user's profile Send private message
e3k
Guru
Guru


Joined: 01 Oct 2007
Posts: 513
Location: Inner Space

PostPosted: Sun Nov 01, 2015 8:14 pm    Post subject: Reply with quote

got some strange issue today too. all pages opened by a browser (ff, links) did resolve very slow. dig was working normally. when i tried to restart dnsmasq it said it could not be restarted. did not respond to SIGTERM. after sending SIGKILL and restarting the service everything went back to normal. v2.72-r2
----
the only strange thing i have found was a double entry of the nameserver in /etc/resolve.conf:
Code:

# Generated by dhcpcd from net0.dhcp
nameserver 127.0.0.1
domain lan
nameserver 192.168.1.1
nameserver 192.168.1.1

_________________

Flux & Contemplation - Portrait of an Artist in Isolation

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum