# I'm a little confused about systemd unit dependencies

**URL:** <https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534>\
**Category:** Rocky Linux Help & Support\
**Tags:** rocky-linux-8\
**Created:** [August 20, 2024, 5:40pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534 "2024-08-20T17:40:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sweh](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sweh/32/1287_2.png) [@sweh](https://forums.rockylinux.org/u/sweh)\
**Post date:** [August 20, 2024, 5:40pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534/1 "2024-08-20T17:40:08Z")

</div>

I see `named.service` (from the `bind` package) has the following

```auto
[Unit]
Description=Berkeley Internet Name Domain (DNS)
Wants=nss-lookup.target
...
Before=nss-lookup.target

```

Isn’t this contradictory? How can something both run before _and_ have a dependency on another unit?

---

<div class="post-metadata">

**Author:** ![tjdoyle](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/tjdoyle/32/500_2.png) [@tjdoyle](https://forums.rockylinux.org/u/tjdoyle)\
**Post date:** [August 20, 2024, 5:49pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534/2 "2024-08-20T17:49:24Z")

</div>

Hi,

A quick google found this:-

> <https://unix.stackexchange.com/questions/507702/before-and-want-for-the-same-systemd-service>

Regards Tom.

---

<div class="post-metadata">

**Author:** ![Ritov](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@Ritov](https://forums.rockylinux.org/u/Ritov)\
**Post date:** [August 20, 2024, 6:04pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534/3 "2024-08-20T18:04:21Z")

</div>

“_… a (wants) requirement dependencies do not influence the order in which services are started or stopped._” Therefore → Before

---

<div class="post-metadata">

**Author:** ![sweh](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sweh/32/1287_2.png) [@sweh](https://forums.rockylinux.org/u/sweh)\
**Post date:** [August 20, 2024, 9:17pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534/4 "2024-08-20T21:17:56Z")

</div>

Ah, I think it’s slightly more complicated. In this case it’s a “special target” which doesn’t itself do anything. So when named starts up it causes the “nss-lookup” target to be triggered.

Hmm, personally I think this might be a misconfig; why would an authoritative server that’s not listed in resolv.conf (or elsewhere) cause this target to be triggered. I could see it for a device that uses itself (and systemd-resolved), but not in this case. Fortunately I think it’s harmless (it might impact rpc.statd startup).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [October 19, 2024, 9:18pm UTC](https://forums.rockylinux.org/t/im-a-little-confused-about-systemd-unit-dependencies/15534/5 "2024-10-19T21:18:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
