[nsd-users] logging error on /etc/nsd/nsd.log

Simon Deziel simon at sdeziel.info
Mon Jun 20 17:49:39 UTC 2022


I run a different OS so I first create a Debian VM:

$ lxc launch images:debian/sid sid-nsd --vm
$ lxc shell sid-nsd

Now inside the VM:

# get systemd-resolved out of the way
echo DNSStubListener=no >> /etc/systemd/resolved.conf
systemctl restart systemd-resolved

# install NSD
apt-get update
apt-get install -y nsd

# simulate `systemctl edit nsd`
mkdir -p /etc/systemd/system/nsd.service.d
cat << EOF > /etc/systemd/system/nsd.service.d/override.conf
[Service]
# Allow file logging to dedicated dir
ReadWritePaths=/var/log/nsd
EOF
systemctl daemon-reload

# setup logging to file
mkdir -p /var/log/nsd
chown nsd: /var/log/nsd
sed -i 's|log-only-syslog: yes$|logfile: "/var/log/nsd/nsd.log"|' \
     /etc/nsd/nsd.conf
systemctl restart nsd

# have NSD create the log file
nsd-control stats

And it works:
root at sid-nsd:~# ls -l /var/log/nsd/
total 0
-rw-r--r-- 1 nsd nsd 0 Jun 20 17:48 nsd.log

HTH,
Simon

On 2022-06-20 13:16, Mukul Shukla via nsd-users wrote:
> Dear Simon
> 
> Please list down the exact steps.
> 
> Thank you.
> 
> Mukul
> 
> On Mon, Jun 20, 2022 at 6:22 PM Simon Deziel via nsd-users <
> nsd-users at lists.nlnetlabs.nl> wrote:
> 
>> On Debian Sid with NSD 4.5.0 deb + the `systemctl edit` it works for me
>> so there must be something else going on.
>>
>> Simon
>>
>> On 2022-06-19 08:33, Mukul Shukla via nsd-users wrote:
>>> Problem persists, just for the information to the others.
>>>
>>> Thanks.
>>>
>>> Mukul
>>>
>>> On Sun, Jun 19, 2022 at 1:31 AM Mukul Shukla <mukulmanet at gmail.com>
>> wrote:
>>>
>>>> Shifting to another distribution will solve the problem indeed.
>>>> This seems to be a long pending problem in Debian, it seems.
>>>>
>>>> It has been discussed thoroughly  before in this forum, but I could not
>>>> see any helpful solution.
>>>>
>>>> https://www.mail-archive.com/nsd-use
>>>>
>>>>
>> https://forums.raspberrypi.com/viewtopic.php?t=247931rs@nlnetlabs.nl/msg00082.html
>>>> https://www.mail-archive.com/nsd-users@nlnetlabs.nl/msg00082.html
>>>>
>>>> What to share the whole story, I dont know. Very simple "cannot write
>> logs
>>>> to /var/long/nsd.log" with the error message I have posted in the first
>>>> instance. Whats the whole story in this case?
>>>>
>>>> Thanks.
>>>>
>>>> Mukul
>>>>
>>>> On Sun, Jun 19, 2022 at 1:06 AM Ondřej Surý <ondrej at sury.org> wrote:
>>>>
>>>>> No, that’s not the problem. Shifting to another distribution will not
>>>>> help you if you don’t know what you are doing.
>>>>>
>>>>> The user under nsd is running has no write permissions to the location
>>>>> listed and it could be more things - non-matching permissions on the
>>>>> log-file, non-matching permissions on the directory, AppArmor profile,
>>>>> SELinux profile, chroot/jail.
>>>>>
>>>>> You are not sharing the whole story, just tiny bits, so it’s really
>> hard
>>>>> to help you.
>>>>>
>>>>> Ondrej
>>>>> --
>>>>> Ondřej Surý <ondrej at sury.org> (He/Him)
>>>>>
>>>>>> On 18. 6. 2022, at 21:22, Mukul Shukla via nsd-users <
>>>>> nsd-users at lists.nlnetlabs.nl> wrote:
>>>>>>
>>>>>> I think,just to make Debian able to write logs to a file is a big
>>>>> issue. Better to shift to another distribution,
>>>>>> Can anybody confirm if this is not an issue on Centos or OpenBSD?
>>>>>
>>>>>
>>>
>>>
>>> _______________________________________________
>>> nsd-users mailing list
>>> nsd-users at lists.nlnetlabs.nl
>>> https://lists.nlnetlabs.nl/mailman/listinfo/nsd-users
>>
>> _______________________________________________
>> nsd-users mailing list
>> nsd-users at lists.nlnetlabs.nl
>> https://lists.nlnetlabs.nl/mailman/listinfo/nsd-users
>>
> 
> 
> _______________________________________________
> nsd-users mailing list
> nsd-users at lists.nlnetlabs.nl
> https://lists.nlnetlabs.nl/mailman/listinfo/nsd-users



More information about the nsd-users mailing list