Bug 1374077

Summary: nscd does not pick up /etc/resolv.conf
Product: [Fedora] Fedora Reporter: JM <igeorgex>
Component: glibcAssignee: glibc team <glibc-bugzilla>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 24CC: arjun.is, codonell, dj, fweimer, jakub, law, mfabian, pfrankli, siddhesh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-08 17:11:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description JM 2016-09-07 21:46:45 UTC
After an upgrade from Fedora 23 to Fedora 24 nscd does not pick up "/etc/resolv.conf". My workaround is to add in 

/etc/systemd/system/nscd.service.d/override.conf:

[Unit]
After=network-online.target
Wants=network-online.target

This way nscd respects "/etc/resolv.conf". Btw. someone in bug #1346082 had a similar problem.

Comment 1 Carlos O'Donell 2016-09-07 22:38:49 UTC
(In reply to JM from comment #0)
> After an upgrade from Fedora 23 to Fedora 24 nscd does not pick up
> "/etc/resolv.conf". My workaround is to add in 
> 
> /etc/systemd/system/nscd.service.d/override.conf:
> 
> [Unit]
> After=network-online.target
> Wants=network-online.target
> 
> This way nscd respects "/etc/resolv.conf". Btw. someone in bug #1346082 had
> a similar problem.

While nscd uses inotify to detect changes in /etc/resolv.conf to invalidate the hosts database, it doesn't reload the resolver state which reads /etc/resolv.conf at process startup.

It may be indeed true that we need the changes you suggest, but better yet would be to implement resolv.conf dynamic reloading as we are looking at doing upstream.

Florian, Do we have a bug for resolv.conf dynamic reloading? Is that what's going on here?

Comment 2 Florian Weimer 2016-09-08 06:15:07 UTC
(In reply to Carlos O'Donell from comment #1)
> (In reply to JM from comment #0)
> > After an upgrade from Fedora 23 to Fedora 24 nscd does not pick up
> > "/etc/resolv.conf". My workaround is to add in 
> > 
> > /etc/systemd/system/nscd.service.d/override.conf:
> > 
> > [Unit]
> > After=network-online.target
> > Wants=network-online.target
> > 
> > This way nscd respects "/etc/resolv.conf". Btw. someone in bug #1346082 had
> > a similar problem.
> 
> While nscd uses inotify to detect changes in /etc/resolv.conf to invalidate
> the hosts database, it doesn't reload the resolver state which reads
> /etc/resolv.conf at process startup.

This isn't true.  nss_files should register an inotify listener for /etc/resolv.conf, in nss/nss_files/files-init.c.  In fact, running nscd has been our long-standing recommendation to react to /etc/resolv.conf changes (at least for NSS).

This is caused by something else.

> Florian, Do we have a bug for resolv.conf dynamic reloading? Is that what's
> going on here?

There is an upstream bug:

  https://sourceware.org/bugzilla/show_bug.cgi?id=984

A high-quality implementation (which also respects in-process configuration through _res, not simply overwriting any such changes) is fairly involved.

But this bug here has a different cause.  It looks more like bug 1367565.

Comment 3 JM 2016-09-08 08:26:48 UTC
Well I can't tell you if it is bug #1367565 or not only that

[Unit]
After=network-online.target
Wants=network-online.target

fixed the problem for me. I tried it several times, without the modifications nscd has problems to resolve hosts (after system startup) but after the modifications it works.

Fedora 23 works without problems (our department has several systems with Fedora 23 and no problems with /etc/resolv.conf), but after the upgrade to Fedora 24 I had problems to resolve hosts when nscd runs.

- nscd-2.23.1-10.fc24.x86_64
- systemd-229-13.fc24.x86_64
- glibc-2.23.1-10.fc24.x86_64
- NetworkManager-1.2.4-2.fc24.x86_64

Comment 4 Carlos O'Donell 2016-09-08 09:59:40 UTC
(In reply to Florian Weimer from comment #2)
> (In reply to Carlos O'Donell from comment #1)
> > (In reply to JM from comment #0)
> > > After an upgrade from Fedora 23 to Fedora 24 nscd does not pick up
> > > "/etc/resolv.conf". My workaround is to add in 
> > > 
> > > /etc/systemd/system/nscd.service.d/override.conf:
> > > 
> > > [Unit]
> > > After=network-online.target
> > > Wants=network-online.target
> > > 
> > > This way nscd respects "/etc/resolv.conf". Btw. someone in bug #1346082 had
> > > a similar problem.
> > 
> > While nscd uses inotify to detect changes in /etc/resolv.conf to invalidate
> > the hosts database, it doesn't reload the resolver state which reads
> > /etc/resolv.conf at process startup.
> 
> This isn't true.  nss_files should register an inotify listener for
> /etc/resolv.conf, in nss/nss_files/files-init.c.  In fact, running nscd has
> been our long-standing recommendation to react to /etc/resolv.conf changes
> (at least for NSS).

You are right, that's exactly what we recommend, I forgot CRINIT is 1 for host database which means res_init() is called again when invalidation occurs.

> This is caused by something else.

Agreed.

> > Florian, Do we have a bug for resolv.conf dynamic reloading? Is that what's
> > going on here?
> 
> There is an upstream bug:
> 
>   https://sourceware.org/bugzilla/show_bug.cgi?id=984
> 
> A high-quality implementation (which also respects in-process configuration
> through _res, not simply overwriting any such changes) is fairly involved.

We should have a Fedora Rawhide bug for this so we can track the upstream status and allow developers to use this. Could you file a Rawhide RFE please?
 
> But this bug here has a different cause.  It looks more like bug 1367565.

Agreed.

I reviewed bug 1367565 and think it might be bug 1374228?

Comment 5 Florian Weimer 2016-09-08 10:07:49 UTC
(In reply to Carlos O'Donell from comment #4)
> We should have a Fedora Rawhide bug for this so we can track the upstream
> status and allow developers to use this. Could you file a Rawhide RFE please?

This is now bug 1374239.

Comment 6 Fedora End Of Life 2017-07-25 22:54:04 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2017-08-08 17:11:13 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.