Bug 421 - Does NSD need to change ownership of piddir?
Does NSD need to change ownership of piddir?
Product: NSD
Classification: Unclassified
Component: NSD Code
Other Linux
: P5 enhancement
Assigned To: NSD team
Depends on:
  Show dependency treegraph
Reported: 2011-11-30 09:34 CET by Matthijs Mekking
Modified: 2012-01-06 12:10 CET (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Matthijs Mekking 2011-11-30 09:34:15 CET
nsd[6775]: failed to unlink pidfile /var/run/nsd/nsd.pid: Permission denied

The daemon creates the pid as root, and "nsdc restart" has no root permission
to replace the pid file.

Because /var/run/nsd is owned by root.
Comment 1 Wouter Wijngaards 2011-11-30 13:40:20 CET
There is already a chown() of the pidfile itself.

If the directory permission does not allow removal, then NSD should not change that.  It is not ours (but the packagers' dir).

Can we do truncate("/var/run/nsd/nsd.pid", 0); when the unlink fails?  Does an empty pidfile hurt?  (does that give errors on restart?)

Best regards,
Comment 2 Matthijs Mekking 2011-11-30 15:34:23 CET
FTR: I agree, we should not change the ownership of the piddir.

Truncate might just work, as NSD will consider an empty pidfile as no pidfile exists.
Comment 3 Matthijs Mekking 2012-01-06 12:10:28 CET
Since r3495, in branches/NSD_3_2 we truncate the pidfile instead of unlink it. This way, the piddir does not have to fall under NSD ownership.