Dnsmasq crashing everyday

Hello!

I'm a new user of OpenWrt, great project team!

After having run with no problem for about a month, now every morning when I try to use the internet I can't get a dhcp lease. I've identified the problem as dnsmasq becoming inactive on the router. Starting dnsmasq solves the issue.

However this is quite annoying and I do want to know the cause of this crash. Sadly log doesn't show anything helpful. What I see though is a strange ssh connexion to frpc server on docker0.IPv4 and start of a samba service... And I use neither frpc, samba or docker. Am I victim of foulplay?

Here is an extract of the logread output:

Wed Nov 20 15:25:53 2024 daemon.err smbd[3351]:   Copyright Andrew Tridgell and the Samba Team 1992-2023
Wed Nov 20 15:25:53 2024 user.notice dockerd-init: Drop traffic from br-wan to docker0
Wed Nov 20 15:25:53 2024 daemon.notice procd: /etc/rc.d/S99dockerd: Ignoring deprecated --wait-interval option.
Wed Nov 20 15:25:53 2024 user.notice firewall: Reloading firewall due to ifup of wan (br-wan)
Tue Nov 26 04:01:42 2024 user.notice nlbwmon: Reloading nlbwmon due to ifup of wan (br-wan)
Tue Nov 26 04:01:42 2024 daemon.err block: /dev/mmcblk1p2 is already mounted on /
Tue Nov 26 04:01:42 2024 daemon.info frpc[4168]: 2024/11/26 04:01:42 [I] [root.go:220] start frpc service for config file [/var/etc/frpc.ini]
Tue Nov 26 04:01:42 2024 daemon.info frpc[4168]: 2024/11/26 04:01:42 [W] [service.go:133] login to server failed: dial tcp 127.0.0.1:7000: connect: connection refused
Tue Nov 26 04:01:42 2024 daemon.info frpc[4168]: 2024/11/26 04:01:42 [I] [root.go:236] frpc service for config file [/var/etc/frpc.ini] stopped
Tue Nov 26 04:01:43 2024 daemon.info frps[4230]: 2024/11/26 04:01:43 [I] [root.go:204] frps uses config file: /var/etc/frps.ini
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:3819] N: ttyd 1.7.3 (libwebsockets 4.3.3-unknown)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:3824] N: tty configuration:
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:3826] N:   start command: /bin/login
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:3828] N:   close signal: SIGHUP (1)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:3829] N:   terminal type: xterm-256color
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4275] N:    /usr/lib/libwebsockets-evlib_uv.so
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4278] N: lws_create_context: LWS: 4.3.3-unknown, NET CLI SRV H1 H2 WS ConMon IPV6-off
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4281] N: elops_init_pt_uv:  Using foreign event loop...
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4283] N: __lws_lc_tag:  ++ [wsi|0|pipe] (1)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4284] N: __lws_lc_tag:  ++ [vh|0|netlink] (1)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4286] N: __lws_lc_tag:  ++ [vh|1|default|br-lan|br-lan|7681] (2)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4300] N: [vh|1|default|br-lan|br-lan|7681]: lws_socket_bind: source ads 192.168.0.254
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4308] N: __lws_lc_tag:  ++ [wsi|1|listen|default|br-lan|7681] (2)
Tue Nov 26 04:01:43 2024 daemon.notice ttyd[4500]: [2024/11/26 04:01:43:4309] N:  Listening on port: 7681
Tue Nov 26 04:01:43 2024 user.notice ddns-scripts[4760]: myddns_ipv4: PID '4760' started at 2024-11-26 04:01
Tue Nov 26 04:01:43 2024 user.warn ddns-scripts[4760]: myddns_ipv4: Service section disabled! - TERMINATE
Tue Nov 26 04:01:43 2024 user.warn ddns-scripts[4760]: myddns_ipv4: PID '4760' exit WITH ERROR '1' at 2024-11-26 04:01
Tue Nov 26 04:01:44 2024 daemon.err apcupsd[1858]: apcupsd FATAL ERROR in smartsetup.c at line 152 PANIC! Cannot communicate with UPS via serial port. Please make sure the port specified on the DEVICE directive is correct, and that your cable specification on the UPSCABLE directive is correct.
Tue Nov 26 04:01:44 2024 daemon.err apcupsd[1858]: apcupsd error shutdown completed
Tue Nov 26 04:01:45 2024 daemon.info frps[4230]: 2024/11/26 04:01:45 [I] [service.go:206] frps tcp listen on 0.0.0.0:7000
Tue Nov 26 04:01:45 2024 daemon.info frps[4230]: 2024/11/26 04:01:45 [I] [root.go:213] frps started successfully
Tue Nov 26 04:01:47 2024 daemon.info procd: - init complete -
Tue Nov 26 04:01:47 2024 daemon.info frpc[5157]: 2024/11/26 04:01:47 [I] [root.go:220] start frpc service for config file [/var/etc/frpc.ini]
Tue Nov 26 04:01:47 2024 daemon.info frps[4230]: 2024/11/26 04:01:47 [I] [service.go:539] [9d1469d922401594] client login info: ip [127.0.0.1:37440] version [0.51.3] hostname [] os [linux] arch [arm64]
Tue Nov 26 04:01:47 2024 daemon.info frpc[5157]: 2024/11/26 04:01:47 [I] [service.go:301] [9d1469d922401594] login to server success, get run id [9d1469d922401594]
Tue Nov 26 04:01:47 2024 daemon.info frpc[5157]: 2024/11/26 04:01:47 [I] [proxy_manager.go:150] [9d1469d922401594] proxy added: [ssh]
Tue Nov 26 04:01:47 2024 daemon.info frps[4230]: 2024/11/26 04:01:47 [I] [tcp.go:81] [9d1469d922401594] [ssh] tcp proxy listen port [6000]
Tue Nov 26 04:01:47 2024 daemon.info frps[4230]: 2024/11/26 04:01:47 [I] [control.go:497] [9d1469d922401594] new proxy [ssh] type [tcp] success
Tue Nov 26 04:01:47 2024 daemon.info frpc[5157]: 2024/11/26 04:01:47 [I] [control.go:172] [9d1469d922401594] [ssh] start proxy success
Tue Nov 26 04:01:51 2024 daemon.info avahi-daemon[2320]: Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1.
Tue Nov 26 04:01:51 2024 daemon.info avahi-daemon[2320]: New relevant interface docker0.IPv4 for mDNS.
Tue Nov 26 04:01:51 2024 daemon.info avahi-daemon[2320]: Registering new address record for 172.17.0.1 on docker0.IPv4.
Tue Nov 26 04:01:52 2024 daemon.info acpid: starting up with netlink and the input layer
Tue Nov 26 04:01:52 2024 daemon.info acpid: 1 rule loaded
Tue Nov 26 04:01:52 2024 daemon.info acpid: waiting for events: event logging is off
Tue Nov 26 04:01:56 2024 daemon.warn odhcpd[1813]: No default route present, overriding ra_lifetime to 0!
Tue Nov 26 04:02:03 2024 daemon.err dockerd[4074]: time="2024-11-26T04:02:03.124454093-05:00" level=warning msg="WARNING: No swap limit support"
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]: [2024/11/26 04:02:03.149795,  0] ../../source3/nmbd/nmbd_become_lmb.c:398(become_local_master_stage2)
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]:   *****
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]:
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]:   Samba name server OPENWRT is now a local master browser for workgroup WORKGROUP on subnet 192.168.0.254
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]:
Tue Nov 26 04:02:03 2024 daemon.err nmbd[3352]:   *****
Tue Nov 26 04:02:12 2024 daemon.warn odhcpd[1813]: No default route present, overriding ra_lifetime to 0!
Tue Nov 26 04:06:20 2024 daemon.warn odhcpd[1813]: No default route present, overriding ra_lifetime to 0!
Tue Nov 26 04:10:27 2024 daemon.warn odhcpd[1813]: No default route present, overriding ra_lifetime to 0!
Tue Nov 26 04:16:07 2024 daemon.warn odhcpd[1813]: No default route present, overriding ra_lifetime to 0!

The last error repeats ad infinitum even when all is working fine, I have to investigate if this is a related issue.

Thanks for any help!
Joris

Hey, there is no dnsmasq in your log.
Could you help with output of

ubus call system board
logread -e dnsmasq
cat /etc/config/dhcp
cat /etc/config/network
cat /etc/config/firewall

Obviously cutting off last half og MAC/IP addresses and editing away passwords and keys.

1 Like

Hey, thanks for your reply.

Here's the info requested. Note that there are no dnsmasq messages in log until I start it manually. When I installed openWrt I left the default docker bridge in place, perhaps I should remove it? In the meantime I have disabled the docker0 interface in LuCI; also stopped and disabled both frps and frpc.

root@OpenWrt:~# ubus call system board
{
        "kernel": "6.1.112-ophub",
        "hostname": "OpenWrt",
        "system": "ARMv8 Processor rev 4",
        "model": "Oranth Tanix TX3 Mini",
        "board_name": "oranth,tx3-mini",
        "rootfs_type": "btrfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "R2024.10.01",
                "target": "armsr/armv8",
                "description": "OpenWrt SNAPSHOT r0-7e972fe"
        }
}

root@OpenWrt:~# logread -e dnsmasq
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: started, version 2.90 cachesize 1000
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: compile time options: IPv6 GNU-getopt no-DBus UBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP conntrack no-ipset nftset auth cryptohash DNSSEC no-ID loop-detect inotify dumpfile
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: UBus support enabled: connected to system bus
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCP, IP range ***REDACTED*** -- ***REDACTED***, lease time 1d
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCP, sockets bound exclusively to interface br-lan
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using nameserver ***REDACTED***#53
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for test
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for local
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: reading /tmp/resolv.conf.d/resolv.conf.auto
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using nameserver ***REDACTED***#53
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using nameserver ***REDACTED***#53
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using nameserver ***REDACTED***#53
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using nameserver ***REDACTED***#53
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for test
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for onion
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for localhost
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for local
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for invalid
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for bind
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: using only locally-known addresses for lan
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: read /etc/hosts - 27 names
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 0 names
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCPDISCOVER(br-lan) ***REDACTED***
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) ***REDACTED***
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) ***REDACTED***
Tue Nov 26 10:21:23 2024 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) ***REDACTED***
Tue Nov 26 10:21:59 2024 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) ***REDACTED***
Tue Nov 26 10:21:59 2024 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) ***REDACTED***
Tue Nov 26 11:15:26 2024 daemon.info dnsmasq[1]: read /etc/hosts - 27 names
Tue Nov 26 11:15:26 2024 daemon.info dnsmasq[1]: read /tmp/hosts/dhcp.cfg01411c - 2 names
Tue Nov 26 11:15:26 2024 daemon.info dnsmasq[1]: read /tmp/hosts/odhcpd - 1 names

root@OpenWrt:~# cat /etc/config/dhcp

config dnsmasq
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option expandhosts '1'
        option cachesize '1000'
        option leasefile '/tmp/dhcp.leases'
        option localservice '1'
        option ednspacket_max '1232'
        list interface 'lan'
        option stripsubnet '1'
        option dhcpleasemax '50'
        list notinterface 'wan'
        option authoritative '1'
        list server '***REDACTED***'

config dhcp 'lan'
        option interface 'lan'
        option start '0'
        option limit '50'
        option leasetime '24h'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

root@OpenWrt:~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdb2:17e1:d4a8::/48'
        option packet_steering '1'
        option steering_flows '256'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '***REDACTED***'
        option netmask '***REDACTED***'
        option ip6assign '60'
        list dns '***REDACTED***'

config interface 'wan'
        option proto 'dhcp'
        option device 'br-wan'
        option hostname '*'

config interface 'docker'
        option device 'docker0'
        option proto 'none'
        option auto '0'

config device
        option type 'bridge'
        option name 'docker0'

config device
        option type 'bridge'
        option name 'br-wan'
        list ports 'eth1'

root@OpenWrt:~# cat /etc/config/firewall

config defaults
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option synflood_protect '1'

config zone
        option name 'lan'
        list network 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'

config zone
        option name 'wan'
        list network 'wan'
        list network 'wan6'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-IPSec-ESP'
        option src 'wan'
        option dest 'lan'
        option proto 'esp'
        option target 'ACCEPT'

config rule
        option name 'Allow-ISAKMP'
        option src 'wan'
        option dest 'lan'
        option dest_port '500'
        option proto 'udp'
        option target 'ACCEPT'

config zone 'docker'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'ACCEPT'
        option name 'docker'
        list network 'docker'

config zone
        option name 'vpnfirewall'
        option input 'REJECT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        option mtu_fix '1'
        list network 'nordvpntun'

config forwarding
        option src 'lan'
        option dest 'wan'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'forward_to_pihole'
        option src 'lan'
        option src_dport '53'
        option dest_ip '***REDACTED***'
        option dest_port '53'
        option src_ip '!***REDACTED***'
        option enabled '0'

config nat
        option name 'NAT_pihole'
        list proto 'tcp'
        list proto 'udp'
        option src 'lan'
        option src_port '53'
        option dest_ip '***REDACTED***'
        option dest_port '53'
        option target 'MASQUERADE'
        option enabled '0'

config redirect
        option dest 'lan'
        option target 'DNAT'
        option name 'fwd_deluge_to_demeter'
        option src 'wan'
        option src_dport '49152-65525'
        option dest_ip '***REDACTED***'


It appears you are using firmware that is not from the official OpenWrt project.

When using forks/offshoots/vendor-specific builds that are "based on OpenWrt", there may be many differences compared to the official versions (hosted by OpenWrt.org). Some of these customizations may fundamentally change the way that OpenWrt works. You might need help from people with specific/specialized knowledge about the firmware you are using, so it is possible that advice you get here may not be useful.

You may find that the best options are:

  1. Install an official version of OpenWrt, if your device is supported (see https://firmware-selector.openwrt.org).
  2. Ask for help from the maintainer(s) or user community of the specific firmware that you are using.
  3. Provide the source code for the firmware so that users on this forum can understand how your firmware works (OpenWrt forum users are volunteers, so somebody might look at the code if they have time and are interested in your issue).

If you believe that this specific issue is common to generic/official OpenWrt and/or the maintainers of your build have indicated as such, please feel free to clarify.

2 Likes

First thing first - You are not using OpenWRT, so help here will be just to say how OpenWRT should work under your setup, which may not always beam to device manufacturer fork setup.

Your DNSMASQ works perfectly.

Your eth1 port goes down at times, without exploring reasons you can add option to save restarting all network services when that happens

config device
        option type 'bridge'
        option name 'br-wan'
        list ports 'eth1'
        option bridge_empty '1'

Thanks I will try this out. In my setup eth1 is a usb network adapter, perhaps it goes into sleep at some point.

Indeed I'm using OpenWrt-Box, a fork targetted to run on TV boxes. I thougth general openwrt function would apply here but I'll try and post on a forum relevant to that distribution.

Thanks for your help!

Here is the difference, your forking tv distribution added a killer powersave.

That's quite possible, we'll see tomorrow if the problem persists.

I'm still uneasy about the ssh connection to frpc though, but that is probably a different issue altogether.

Thanks!

You have different support channel for their system breaking changes. At superfluous OpenWRT level one problem spotted, thats all here.