Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 556602 - systemd services accessing /etc/resolv.conf need to run after systemd-resolved.service
Summary: systemd services accessing /etc/resolv.conf need to run after systemd-resolve...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-03 21:33 UTC by Reuben Martin
Modified: 2015-08-03 22:39 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reuben Martin 2015-08-03 21:33:16 UTC
If doing things the systemd way and using it's resolver service, /etc/resolv.conf is supposed to be a soft link to /run/systemd/resolve/resolv.conf.

However, if the resolver service has not yet had time to generated its resolv.conf file, the softlink doesn't resolve (no word play intended) to anything. Any service trying to access that file will fail in different ways to load correctly. For some services it might simply result in an inert error msg, for others it alters functionality.

Such services need to have the following added to the "[Unit]" section of their service file:

After=systemd-resolved.service

There may be others, but currently I'm aware of two services so far that need this:
nscd.service (sys-libs/glibc)
avahi-daemon.service (net-dns/avahi)

The added line to the service files should be harmless to anybody not using systemd's resolver service.

Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2015-08-03 21:51:03 UTC
nss-lookup.target seems like a better fit for this.

       nss-lookup.target
           A target that should be used as synchronization point for all
           host/network name service lookups. Note that this is independent of
           user/group name lookups for which nss-user-lookup.target should be
           used. All services for which the availability of full host/network
           name resolution is essential should be ordered after this target,
           but not pull it in. systemd automatically adds dependencies of type
           After= for this target unit to all SysV init script service units
           with an LSB header referring to the "$named" facility.

However, systemd-resolved.service is not ordered before nss-lookup.target, so this seems to be broken.

That's an issue you might want to ask about upstream.
Comment 2 Reuben Martin 2015-08-03 22:16:10 UTC
filed upstream:

https://github.com/systemd/systemd/issues/848
Comment 3 Mike Gilbert gentoo-dev 2015-08-03 22:39:35 UTC
Re-reading this, I guess we should distinguish between programs that directly access resolv.conf and those that simply do hostname lookups via glibc.

For the former, After=systemd-resolved.service may indeed be a better choice.