FS#37588 - Nsd update to 4.0.0-1 causes nsd to fail to start and command nscd not present

Attached to Project: Arch Linux
Opened by Mike Cloaked (mcloaked) - Friday, 01 November 2013, 22:16 GMT
Last edited by Gaetan Bisson (vesath) - Saturday, 02 November 2013, 07:55 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: Updating nsd now gives a failure to start the daemon - but not clear what changes in the new package caused the problem.

Pacman output shows.
([2013-10-31 19:17] [ALPM] warning: directory permissions differ on /var/db/nsd/
filesystem: 700 package: 755
[2013-10-31 19:17] [PACMAN] upgraded nsd (3.2.16-1 -> 4.0.0-1)

changing the permissions to 755 causes the same failure and the same status output:

[root@home1 ~]# systemctl -l status nsd
nsd.service - NSD Name Server Daemon
Loaded: loaded (/usr/lib/systemd/system/nsd.service; enabled)
Active: failed (Result: exit-code) since Fri 2013-11-01 21:51:07 GMT; 17min ago
Process: 2003 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=1/FAILURE)
Process: 2000 ExecStart=/usr/bin/nsd -c /etc/nsd/nsd.conf (code=exited, status=1/FAILURE)
Main PID: 2000 (code=exited, status=1/FAILURE)

Nov 01 21:51:07 home1 systemd[1]: Started NSD Name Server Daemon.
Nov 01 21:51:07 home1 nsd[2001]: //var/db/nsd/nsd.db: Permission denied
Nov 01 21:51:07 home1 nsd[2001]: unable to open the database //var/db/nsd/nsd.db: Permission denied
Nov 01 21:51:07 home1 nsd[2001]: failed to unlink pidfile /run/nsd.pid: Permission denied
Nov 01 21:51:07 home1 nsd[2001]: server preparation failed, nsd could not be started
Nov 01 21:51:07 home1 nsd[2000]: did not get start signal from main
Nov 01 21:51:07 home1 systemd[1]: nsd.service: main process exited, code=exited, status=1/FAILURE
Nov 01 21:51:07 home1 kill[2003]: Usage:
Nov 01 21:51:07 home1 systemd[1]: nsd.service: control process exited, code=exited status=1
Nov 01 21:51:07 home1 systemd[1]: Unit nsd.service entered failed state.


[root@home1 ~]# ls -ld /var/db/nsd
drwxr-xr-x 2 nsd nsd 4096 Mar 12 2013 /var/db/nsd
[root@home1 ~]# ls -l /var/db/nsd
total 32
-rw-r--r-- 1 root root 26286 Mar 12 2013 nsd.db
-rw-r--r-- 1 nsd nsd 817 Nov 1 19:36 xfrd.state

Changing ownership of nsd.db to nsd gets a bit further but there is still a problem:

[root@home1 ~]# chown nsd:nsd /var/db/nsd/nsd.db
[root@home1 ~]# systemctl restart nsd
[root@home1 ~]# systemctl status nsd
nsd.service - NSD Name Server Daemon
Loaded: loaded (/usr/lib/systemd/system/nsd.service; enabled)
Active: active (running) since Fri 2013-11-01 22:13:45 GMT; 4s ago
Process: 2003 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=1/FAILURE)
Main PID: 2227 (nsd)
CGroup: /system.slice/nsd.service
├─2227 /usr/bin/nsd -c /etc/nsd/nsd.conf
├─2228 /usr/bin/nsd -c /etc/nsd/nsd.conf
└─2229 /usr/bin/nsd -c /etc/nsd/nsd.conf

Nov 01 22:13:45 home1 systemd[1]: Starting NSD Name Server Daemon...
Nov 01 22:13:45 home1 systemd[1]: Started NSD Name Server Daemon.
Nov 01 22:13:45 home1 nsd[2228]: //var/db/nsd/nsd.db: wrong type of file
Nov 01 22:13:45 home1 nsd[2228]: nsd started (NSD 4.0.0), pid 2227

It is unclear how to regenerate the nsd.db file since the nsdc command is no longer present or available.

There seems no changelog to indicate how to deal with these problems.

Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
This task depends upon

Closed by  Gaetan Bisson (vesath)
Saturday, 02 November 2013, 07:55 GMT
Reason for closing:  Fixed
Additional comments about closing:  nsd-4.0.0-2 in [community]
Comment by Mike Cloaked (mcloaked) - Friday, 01 November 2013, 22:19 GMT
Restarting the daemon again seems to get nsd running:

[root@home1 ~]# systemctl restart nsd
[root@home1 ~]# systemctl status nsd
nsd.service - NSD Name Server Daemon
Loaded: loaded (/usr/lib/systemd/system/nsd.service; enabled)
Active: active (running) since Fri 2013-11-01 22:17:34 GMT; 1s ago
Process: 2253 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 2256 (nsd)
CGroup: /system.slice/nsd.service
├─2256 /usr/bin/nsd -c /etc/nsd/nsd.conf
├─2257 /usr/bin/nsd -c /etc/nsd/nsd.conf
└─2258 /usr/bin/nsd -c /etc/nsd/nsd.conf

Nov 01 22:17:34 home1 systemd[1]: Started NSD Name Server Daemon.
Nov 01 22:17:34 home1 nsd[2257]: nsd started (NSD 4.0.0), pid 2256

However it is very unclear what has happened or why the problems occurred.
Comment by Gaetan Bisson (vesath) - Friday, 01 November 2013, 23:43 GMT
You can just remove everything under /var/db/nsd and nsd will just read the zone files from wherever they are. To have it read the again, just `systemctl reload` it (sends SIGHUP to the process). I'll push a fix for the nsd.pid issue soon. We can probably nuke /var/db/nsd entirely in our package but I'd like to get confirmation before doing that.

By the way, they new nsdc is nsd-control. See doc/UPGRADING in the nsd-4.0.0 release tarball.
Comment by Gaetan Bisson (vesath) - Friday, 01 November 2013, 23:47 GMT
Forget what I just said about the db not being used anymore. :)
Comment by Gaetan Bisson (vesath) - Friday, 01 November 2013, 23:58 GMT
Could you confirm that all your issues are fixed by:
- stopping any currently running nsd process
- removing all files under /var/db/nsd/
- upgrading to nsd-4.0.0-2
- starting nsd again

Thanks.
Comment by Mike Cloaked (mcloaked) - Saturday, 02 November 2013, 07:49 GMT
Thank you.

Yes removing all files /var/db/nsd/*
followed by
systemctl restart nsd
systemctl restart nsd

Gives a working system.

The first one still has the pid error.

console output after removing the contents of the /var/db/nsd/ driectory is as follows:

After first restart:
[root@home1 nsd]# systemctl restart nsd
[root@home1 nsd]# systemctl status nsd
nsd.service - NSD Name Server Daemon
Loaded: loaded (/usr/lib/systemd/system/nsd.service; enabled)
Active: active (running) since Sat 2013-11-02 07:44:20 GMT; 5s ago
Process: 1528 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 1532 (nsd)
CGroup: /system.slice/nsd.service
├─1532 /usr/bin/nsd -c /etc/nsd/nsd.conf
├─1533 /usr/bin/nsd -c /etc/nsd/nsd.conf
└─1534 /usr/bin/nsd -c /etc/nsd/nsd.conf

Nov 02 07:44:20 home1 systemd[1]: Starting NSD Name Server Daemon...
Nov 02 07:44:20 home1 systemd[1]: Started NSD Name Server Daemon.
Nov 02 07:44:20 home1 nsd[343]: failed to unlink pidfile /run/nsd.pid: Permission denied
Nov 02 07:44:20 home1 nsd[1533]: nsd started (NSD 4.0.0), pid 1532

Then after second restart:
[root@home1 nsd]# systemctl restart nsd
[root@home1 nsd]# systemctl status nsd
nsd.service - NSD Name Server Daemon
Loaded: loaded (/usr/lib/systemd/system/nsd.service; enabled)
Active: active (running) since Sat 2013-11-02 07:44:32 GMT; 1s ago
Process: 1539 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
Main PID: 1542 (nsd)
CGroup: /system.slice/nsd.service
├─1542 /usr/bin/nsd -c /etc/nsd/nsd.conf
├─1543 /usr/bin/nsd -c /etc/nsd/nsd.conf
└─1544 /usr/bin/nsd -c /etc/nsd/nsd.conf

Nov 02 07:44:32 home1 systemd[1]: Starting NSD Name Server Daemon...
Nov 02 07:44:32 home1 systemd[1]: Started NSD Name Server Daemon.
Nov 02 07:44:32 home1 nsd[1543]: nsd started (NSD 4.0.0), pid 1542

Then checking that the files in /var/db/nsd/ have been recreated:
[root@home1 nsd]# ls -l
total 348
-rw------- 1 nsd nsd 589824 Nov 2 07:44 nsd.db
-rw-r--r-- 1 nsd nsd 817 Nov 2 07:44 xfrd.state

Comment by Gaetan Bisson (vesath) - Saturday, 02 November 2013, 07:54 GMT
Good.

The issue on the first restart is because you have not updated your nsd.conf to use the new PID file location.

Loading...