Bug 163 - unable to read nsd.db file when chroot'ed
unable to read nsd.db file when chroot'ed
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
3.0.x
i386 Linux
: P2 minor
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-03 01:05 CET by Emre Besirik
Modified: 2007-12-12 16:21 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emre Besirik 2007-12-03 01:05:17 CET
[1196633427] nsd[30073]: error: ...stale pid file from process 29939
[1196633427] nsd[30073]: error: unable to load etc/nsd/nsd.db: No such file or directory
my config file is like this;

server:

database: "/var/named/chroot/etc/nsd/nsd.db"

logfile: "/var/named/chroot/var/log/nsd.log"
pidfile: "/var/named/chroot/var/run/nsd.pid"

chroot: "/var/named/chroot/"

username: named
zonesdir: "/var/named/chroot/var/named"
difffile: "/var/named/chroot/etc/nsd/ixfr.db"
xfrdfile: "/var/named/chroot/etc/nsd/xfrd.state"
include: "/var/named/chroot/etc/lxadmin.named.conf"

same config is actually working problem free with chroot commented
system is;
2.6.18-8.el5.028stab031.1 #1 SMP Fri Apr 27 20:08:01 MSD 2007 i686 i686 i386 GNU/Linux
tried both make & gmake at compile time
Comment 1 Wouter Wijngaards 2007-12-03 07:54:11 CET
What goes wrong is that NSD chdirs to the zonesdir (/var/named/chroot/var/named) and then tries to open nsd.db.
In the normal case it tries to open /var/named/chroot/etc/nsd/nsd.db
In the chroot case it tries to open etc/nsd/nsd.db
But the last name has no starting / and thus tries to open /var/named/chroot/var/named/etc/nsd/nsd.db which does not exist.

You can solve this by setting
chroot: "/var/named/chroot"  # no trailing /
At least, I think so. Does this work you you?

Or by changing the zonesdir to be equal to the chroot directory (which may not be handy for you).

Anyway, this is unexpected behaviour, and I think NSD should not do this.

Thanks for the report, Wouter
Comment 2 Emre Besirik 2007-12-03 11:16:52 CET
actually there is a
"/var/named/chroot/etc/nsd/nsd.db"
it exists in there...
BTW the other dir related things work just fine...
Comment 3 Emre Besirik 2007-12-03 12:17:29 CET
yes it worked, thank you but since all the other related dirs were working it would still be considered a minor bug maybe... :)
Comment 4 Matthijs Mekking 2007-12-12 16:21:41 CET
Fixed for the upcoming release 3.0.8