dnscache installation

Does the default djbdns port do something funky with the paths?

I can't seem to get dnscache to work. This is all on 7.2-RELEASE-p1

Installing the djbdns port loaded:
djbdns-1.05_13
daemontools-0.76_12
ucspi-tcp-0.88_2

I followed the directions here:
http://www.bsdguides.org/guides/freebsd/networking/djbdns_dnscache.php

With help from these places when that didn't work:
http://cr.yp.to/djbdns/run-cache-x.html
http://www.howtoforge.com/dns_cache_with_djbdns

The problem is that the service never seems to properly start, and I'm not getting decent feedback as to why.

The most informative error message I can get is:
Code:
# svstat /var/service/dnscache
/var/service/dnscache: unable to chdir: file does not exist

/var/service does exist:
Code:
# cd /var
# ls -l ser*
lrwxr-xr-x  1 root  wheel  23 Jun 17 14:49 service -> /usr/local/etc/dnscache

I know I put dnscache in a nonstandard place, I tried all the default places too and didn't fare any better.

I'm a newbie to all djb stuff and I don't know much about how daemontools interacts with other things (putting soft links in a place and waiting for them to get auto-detected seems like madness to me), so I might have the source or the scope of the problem wrong, but this is where I am now.

Any help would be appreciated.
 
Sorry to double-post immediately, but I found some more clues. It looks like something is trying to happen.

Code:
# ps -aux | grep dns
dnslog 14844  0.0  0.0     0     0  ??  Z     3:55PM   0:00.00 <defunct>
root   14848  0.0  0.1  1660  1040  p0  D+    3:55PM   0:00.00 grep dns
# ps -aux | grep dns
dnslog 14885  0.0  0.0     0     0  ??  Z     3:56PM   0:00.00 <defunct>
root   14889  0.0  0.1  2312  1096  p0  D+    3:56PM   0:00.00 grep dns
# ps -aux | grep dns
dnslog 14896  0.0  0.0     0     0  ??  Z     3:56PM   0:00.00 <defunct>
root   14900  0.0  0.1  2312  1096  p0  D+    3:56PM   0:00.00 grep dns
Note that the "defunct" process number keeps changing.

Additionally:

Code:
# pwd
/usr/local/etc/dnscache/log/supervise
# ls -al
total 6
drwx------  2 root  wheel  512 Jun 17 15:58 .
drwxr-sr-x  4 root  wheel  512 Jun 17 14:52 ..
prw-------  1 root  wheel    0 Jun 17 14:52 control
-rw-------  1 root  wheel    0 Jun 17 14:52 lock
prw-------  1 root  wheel    0 Jun 17 14:52 ok
-rw-r--r--  1 root  wheel   18 Jun 17 15:58 status
# date
Wed Jun 17 15:58:59 EDT 2009
The status file also keeps changing.

Hope the extra info is helpful.

Seems like a simple protections or path issue, but with no idea of what it's supposed to look like when it's working, I'm not getting anywhere debugging.
 
Where should the log file be?

Nothing interesting in /usr/local/etc/dnscache/log:

Code:
spitfire# pwd
/usr/local/etc/dnscache/log
spitfire# ls -al
total 10
drwxr-sr-x  4 root    wheel    512 Jun 17 14:52 .
drwxr-sr-t  5 root    wheel    512 Jun 17 14:49 ..
drwxr-sr-x  2 dnslog  nofiles  512 Jun 17 14:52 main
-rwxr-xr-x  1 root    wheel     50 Jun 17 14:49 run
-rw-r--r--  1 dnslog  nofiles    0 Jun 17 14:49 status
drwx------  2 root    wheel    512 Jun 17 16:57 supervise
spitfire# ls -al */*
-rwxr--r--  1 dnslog  nofiles   0 Jun 17 14:52 main/current
-rw-------  1 dnslog  nofiles   0 Jun 17 14:52 main/lock
-rw-r--r--  1 dnslog  nofiles   0 Jun 17 14:52 main/state
prw-------  1 root    wheel     0 Jun 17 14:52 supervise/control
-rw-------  1 root    wheel     0 Jun 17 14:52 supervise/lock
prw-------  1 root    wheel     0 Jun 17 14:52 supervise/ok
-rw-r--r--  1 root    wheel    18 Jun 17 16:57 supervise/status

For what it's worth:
Code:
# cat run
#!/bin/sh
exec setuidgid dnslog multilog t ./main
 
I use dnscache on OpenBSD, installed by following the instructions of DJB.

The 'log/main' directory should have something like this
Code:
-rwxr--r--  1 Gdnslog  Gnofiles  98023 Jun 17 19:55 @400000004a392e2222b7a06c.s
-rw-r--r--  1 Gdnslog  Gnofiles  97876 Jun 17 23:17 current
-rw-------  1 Gdnslog  Gnofiles      0 Jun  9  2009 lock
-rw-r--r--  1 Gdnslog  Gnofiles      0 Mar 20 14:54 state

On the defunct BSDforums.org I have tried several times to help FreeBSD dnscache users, who installed through ports. Never really found out what was the issue ;)
 
Here's the entire contents for me:
Code:
-rwxr--r--  1 dnslog  nofiles  0 Jun 17 14:52 current
-rw-------  1 dnslog  nofiles  0 Jun 17 14:52 lock
-rw-r--r--  1 dnslog  nofiles  0 Jun 17 14:52 state

I still have no idea at what point things are failing.

That is, what file doesn't exist?

Here are the files that appear to be relevant from doing a ps:
Code:
root   35207  0.0  0.1  3128   824  ??  S     5:30PM   0:00.01 /usr/local/bin/svscan /var/service
root   35208  0.0  0.0  1376   480  ??  S     5:30PM   0:00.06 [readproctitle]
root   35209  0.0  0.1  1384   740  ??  S     5:30PM   0:00.10 supervise log
root   35210  0.0  0.1  1384   740  ??  S     5:30PM   0:00.11 supervise env
root   35211  0.0  0.1  1384   740  ??  S     5:30PM   0:00.11 supervise root
root   35826  0.0  0.0     0     0  ??  Z     5:33PM   0:00.00 <defunct>
dnslog 35827  0.0  0.0     0     0  ??  Z     5:33PM   0:00.00 <defunct>
root   35828  0.0  0.0     0     0  ??  Z     5:33PM   0:00.00 <defunct>
What should it look like?
 
Code:
30033 ??  I      23:47.34 supervise log
19605 ??  I      23:32.24 supervise log
 1047 ??  I      25:28.96 supervise dnscache
 5871 ??  I      23:08.15 supervise tinydns
26796 ??  I     422:36.40 /usr/local/bin/dnscache
 7334 ??  I       0:11.23 /usr/local/bin/tinydns
15154 ??  I     295:35.53 multilog t ./main
31260 ??  I       0:06.08 multilog t ./main
 8109 C0- I       0:00.01 /bin/sh /usr/local/bin/svscanboot /service
12130 C0- I      56:42.59 svscan /service
10281 C0- I       0:00.02 readproctitle service errors: ......................
I have 'dnscache' as well as 'tinydns' running. That is why I have double 'supervise log' and 'multilog t ./main' processes.
 
What should be in /usr/local/etc/dnscache (the directory you soft link to in service directory)?

Code:
# pwd
/usr/local/etc/dnscache
spitfire# ls -al
total 14
drwxr-sr-t   5 root  wheel  512 Jun 17 17:30 .
drwxr-xr-x  13 root  wheel  512 Jun 17 14:49 ..
drwxr-sr-x   3 root  wheel  512 Jun 17 14:52 env
drwxr-sr-x   4 root  wheel  512 Jun 17 14:52 log
drwxr-sr-x   5 root  wheel  512 Jun 17 14:52 root
-rwxr-xr-x   1 root  wheel  141 Jun 17 17:27 run
-rw-------   1 root  wheel  128 Jun 17 14:49 seed
Do you have dnscache and tinydns directories in there?

I just don't understand what this service business is about. It certainly makes debugging difficult. What would it take to launch dnscache manually? Any way to get more output, so I can see what it's looking for that it can't find?
 
My 'service' directory is in '/':
Code:
ls -l /service
lrwxr-xr-x  1 root  wheel  11 Jun  9  2009 dnscache -> /X/dnscache
lrwxr-xr-x  1 root  wheel  10 Jun  9  2009 tinydns -> /X/tinydns
Code:
ls -l /service/dnscache/
drwxr-sr-x  2 root  wheel  512 Jun  9  2009 env
drwxr-sr-x  4 root  wheel  512 Jun  9  2009 log
drwxr-sr-x  4 root  wheel  512 Jun  9  2009 root
-rwxr-xr-x  1 root  wheel  142 Jun  9  2009 run
-rw-------  1 root  wheel  128 Jun  9  2009 seed
[color=blue]drwx------  2 root  wheel  512 Mar 20 14:54 supervise[/color]
Code:
ls -l /service/dnscache/supervise
prw-------  1 root  wheel   0 Jun 11  2009 control
-rw-------  1 root  wheel   0 Jun  9  2009 lock
prw-------  1 root  wheel   0 Jun  9  2009 ok
-rw-r--r--  1 root  wheel  18 Mar 20 14:54 status

Does this dnscache port give some installation hints or suggestions?
 
A-HA!

OK, it's still not working, but now it's actually running.

The issue was with the /service directory. (FreeBSD suggests /var/service, although the "suggestion" is in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign on the door saying "Beware of the Leopard".)

Anyway, this directory had not been created (and the directions don't mention it), so all the softlinking would link /var/service directly to the dnscache folder. It made no sense, since this thing is supposed to be able to "supervise" various programs.

I thought the service softlink would somehow magically be interpreted by something else, which is why I thought it was madness.

Links to everything you want to run all together in a specific directory totally makes sense.

Thanks very much for your help. Now I can get on with it, no thanks to the docs!
 
Back
Top