NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: chrooted named kills syslogd?

At Tue, 24 Nov 2009 17:54:45 -0500, Jan Schaumann 
<> wrote:
Subject: Re: chrooted named kills syslogd?
> Matthias Scheler <> wrote:
> > 
> > On 23 Nov 2009, at 22:58, Jan Schaumann wrote:
> > > I have a named running in named_chrootdir="/var/chroot/named"; it
> > > appears that if this named is running, syslogd hangs:
> > 
> > It works fine on two systems I look after. Can you describe your
> > configuration more precisely, please? What version of NetBSD are you
> > using on what platform?
> NetBSD 5.0 NetBSD 5.0 (PANIX-VC) #0: Tue Apr 28
> 20:51:45 EDT 2009
> amd64
> This is a domU.  There's nothing out of the ordinary (that I'm aware of)
> in this build -- ie, that should be a plain vanilla 5.0 build.

The most obvious thing to do would be to find/build the debug version of
syslogd corresponding to the version you're having trouble with, and
then when it hangs attach to it with GDB and see where it's hung and
what state its variables are in.

You could try ktrace, but that may be a bit too fine-grained.

You could also just try running syslogd in the foreground ("-f"),
possibly along with "-d" to enable verbose debugging, and see what it
says just before it stops logging.

However I note that from a very high-level naive glance at the code that
the logerror() function could fail to ever report fatal errors due to
its attempt to avoid doing anything if it seems to have been called
recursively.  This might be mitigated a wee bit for foreground debugging
if the following change were applied such that debugging messages can be
printed before logmsg() is attempted, which is the culprit which might
recursively call logerror() again:

Index: usr.sbin/syslogd/syslogd.c
RCS file: /cvs/master/m-NetBSD/main/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.84
diff -u -r1.84 syslogd.c
--- usr.sbin/syslogd/syslogd.c  13 Nov 2006 20:24:00 -0000      1.84
+++ usr.sbin/syslogd/syslogd.c  25 Nov 2009 20:57:41 -0000
@@ -1586,12 +1586,12 @@
                (void)snprintf(buf, sizeof(buf), "syslogd: %s", tmpbuf);
-       if (daemonized) 
-               logmsg(LOG_SYSLOG|LOG_ERR, buf, LocalHostName, ADDDATE);
        if (!daemonized && Debug)
                dprintf("%s\n", buf);
        if (!daemonized && !Debug)
                printf("%s\n", buf);
+       if (daemonized) 
+               logmsg(LOG_SYSLOG|LOG_ERR, buf, LocalHostName, ADDDATE);
        logerror_running = 0;

                                                Greg A. Woods
                                                Planix, Inc.

<>       +1 416 218 0099

Attachment: pgpabs7_ZkxLx.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index