Repeated problems with kresd

knot
dns

#1

Since some time I’m having troubles with my omnia. Since 3.11.1 it even got worse.

my log is full with messages like this (several thousand lines) they occur 30secs up to 3-4 mins they look like this and it’s just an excerpt:
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format ‘/mnt/ssd/kresd/hints.tmp’ in host file 192.168.10.57 Grandstream-HT503_2.lan

2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class ‘socket.error’>,[Errno 111] Connection refused

2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format '/mnt/ssd/kresd/hints.tmp' in host file 192.168.10.58 Raspberry_PI_3.lan
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format '/mnt/ssd/kresd/hints.tmp' in host file 192.168.10.59 Raspberry_PI_3_WLAN.lan
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format '/mnt/ssd/kresd/hints.tmp' in host file 192.168.10.61 Samsung_TV.lan
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format '/mnt/ssd/kresd/hints.tmp' in host file 192.168.10.67 openHABian.lan
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Wrong host format '/mnt/ssd/kresd/hints.tmp' in host file 192.168.10.62 echo_dot.lan
2019-01-05 20:09:02 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused

It seems that all hosts that get reportes are in the ‘.lan’ domain which is configure in foris to be the domain for local machines. I have ~30 of them and oll of them are in the /mnt/ssd/kresd/hints.tmp file. If I rename it, it get’s recreated with the same contents. It’s actually just consisting of ‘ip’‘hostname’ and even if it’s auto-created kresd complains about it. Whats broken here?

also theres another file ‘/tmp/dhcp.leases.dynamic’ which causes the exact same errors (interestingly also only for ".lan’ hosts.

2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Wrong host format '/tmp/dhcp.leases.dynamic' in host file 192.168.10.52 Grandstream-HT503.lan
2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Wrong host format '/tmp/dhcp.leases.dynamic' in host file 192.168.10.38 Diskstation.lan
2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused
2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Wrong host format '/tmp/dhcp.leases.dynamic' in host file 192.168.10.170 iPadvonikeRisse.lan
2019-01-05 23:20:03 err dhcp_host_domain_ng.py[]: Kresd socket failed:<class 'socket.error'>,[Errno 111] Connection refused

Here’s the contents of the ‘/mnt/ssd/kresd/hints.tmp:

192.168.10.34 Desktop.lan
192.168.10.52 Grandstream-HT503.lan
192.168.10.37 Brother_HL_3150CDW.lan
192.168.10.38 Diskstation.lan
192.168.10.39 FreePBX.lan
192.168.10.43 iTach_IP2IR.lan
192.168.10.46 RX-V675.lan
192.168.10.50 nuctux.lan
192.168.10.51 KMTronic_Webrelay.lan
192.168.10.44 ReadyNAS2.lan
192.168.10.49 Zappiti.lan
192.168.10.53 ReadyNAS3.lan
192.168.10.54 Raspberry_PI.lan
192.168.10.55 Raspberry_PI_WLAN.lan
192.168.10.48 Mede8er-X3D.lan
192.168.10.56 NTP_WIFI_TIME_SYNC.lan
192.168.10.36 Remoteboot.lan
192.168.10.57 Grandstream-HT503_2.lan
192.168.10.58 Raspberry_PI_3.lan
192.168.10.59 Raspberry_PI_3_WLAN.lan
192.168.10.61 Samsung_TV.lan
192.168.10.67 openHABian.lan
192.168.10.62 echo_dot.lan
192.168.10.63 Diskstation_LAN2.lan
192.168.10.64 Raspberry_Pi_Desktop.lan
192.168.10.65 Raspberry_Pi_Desktop_LAN.lan
192.168.10.60 odroid.lan
192.168.10.66 Raspberry_Pi_Scanner.lan
192.168.10.68 Raspberry_Pi_W.lan
192.168.10.69 Raspberry_Pi_ModMyPi.lan
192.168.10.175 Portal.lan
192.168.10.70 Galaxy_S8.lan
192.168.10.71 Galaxy_S9.lan
192.168.10.50 ad1.ad.shadowsrealm.ch.lan
192.168.10.59 aircontrol.lan
192.168.10.1 turris.lan
192.168.10.175 portal.lan
192.168.10.64 ccu2.lan

The other file with the same problem /tmp/dhcp.leases.dynamic looks like this:

192.168.10.151 android-4a56d7f20694a042.lan
192.168.10.39 FreePBX.lan
192.168.10.60 odroid.lan
192.168.10.46 RX-V675.lan
192.168.10.53 ReadyNAS3.lan
192.168.10.132 DS600-19C0C7.lan
192.168.10.175 Portal.lan
192.168.10.134 S850A-GO.lan
192.168.10.155 Chromecast.lan
192.168.10.52 Grandstream-HT503.lan
192.168.10.38 Diskstation.lan
192.168.10.170 iPadvonikeRisse.lan

The /tmp/kresd.config looks like this:

–Automatically generated file; DO NOT EDIT
modules = {
‘hints > iterate’
, ‘policy’
, ‘stats’
, predict = {
window = 30 – 30 minutes sampling window
, period = 24*(60/30) – track last 24 hours
}
}
hints.use_nodata(true)
cache.ns_tout(5000)
hints.config(’/mnt/ssd/kresd/hints.tmp’)
net.bufsize(4096)
net.ipv4=true
net.ipv6=false
cache.open(1*GB)
policy.add(policy.all(policy.FORWARD({
‘54.93.173.153’,
‘81.17.17.170’,
})))

— Included custom configuration file from: —
— /etc/kresd/custom-forwarding.conf
local ad_rule = policy.add(policy.suffix(policy.STUB(‘192.168.10.50’), {todname(‘ad.shadowsrealm.ch’)}))
policy.del(ad_rule.id)
table.insert(policy.rules, 1, ad_rule)
local lan_rule = policy.add(policy.suffix(policy.STUB(‘127.0.0.1@5353’), policy.todnames({‘lan’,‘168.192.in-addr.arpa’})))
policy.del(lan_rule.id)
table.insert(policy.rules, 1, lan_rule)

as you might gess I have dnsmasq running on port 5353 for local resolution. Interestingly when I restart kresd I get an error ‘uci:entry_not_found’. This is the output of /etc/init.d/resolver restart:

Called /etc/init.d/kresd stop
set dhcp script
Called /etc/init.d/kresd start
set dhcp script
uci: Entry not found
Called /etc/resolver/dhcp_host_domain_ng.py

And since 3.11.1 it even got that worse that the dns check in ‘foris’ is now broken as well. No matter what config I select there and if it’s fowarding or not I get 2 red cross icons as “DNS: failed” and “DNSSEC: failed” but as router is more or less working normally (except those thousands lines of errors) I don’t know why foris thinks that dns is failing.

Any help here would be greatly appreciated as I think writing thousands of lines of code is really a bad sign and I would like to get foris dns check up and working again and maybe also fix this ‘uci: entry not found’ error. I’m really out of ideas and I couldn’t find any solution here in the forum. There was another case reported here with 3.11 but no solution given. It also seemed that it was fixed with 3.11.1 whereas my situation got worse with foris dns check no failing as well.

UPDATE:
It seems the culprit of all this is “/etc/resolver/dhcp_host_domain_ng.py”. It causes the ‘uci: not found’ call if you don’t have all values set in /etc/config/resolver for static & dynamic leases. And it also causes kresd to fail to add the hints. It makes a call “hints.add_hosts(’/mnt/ssd/kresd/hints.tmp’)” which creates all this log-output because kresd doesn’t seem to like this file. So either file format with just ip & hostname is wrong or the command. Would be great to find out.

And can someone please post the latest version of “/etc/resolver/dhcp_host_domain_ng.py” for 3.11.1. I have the feeling that mine might be outdated or why else do other people not have these problems?

UPDATE2:
Turns out that if I disable dynamic leases option in /etc/config/resolver the errors disappear because the whole python script is not called anymore. So it seems that dynamic leases are badly broken as this scripts does nothing then bullshit, but I still would like to know what actually went wrong. Why does the add_hosts command fail so badly?

UPDATE3:
This option is actually set by ‘foris’ when you opt to have a custom domain for local devices. It then sets the dynamic leases option to ‘1’ causing all this errors

REMAINING: Still have the problem that dns check in foris reports 2 x fail for whatever reason.


Kresd eats file handles for breakfast, lunch and dinner
DNS broken after factory reset and update to 3.11.1
#2

Should be merged into the other collecting thread for DNS/kresd- issues.
Actually that didn’t start with 3.11.1 but with 3.11.