You are not logged in.

#1 2026-10-28 09:24:25

quayasil
Member
Registered: 2008-11-09
Posts: 117

Starting a daemon after an interface has been configured via DHCP

Yes I've read:

https://wiki.archlinux.org/title/System … work_is_up

But it says that additional dedicated service has to be enabled for NetworkManager, netctl or systemd-networkd.

I'm not using any of those but simply dhcpcd@eth0.service. In my situation:
- I don't need any additional dedicated services,
- I have to switch to one of the solutions mentioned above,
- I should do sth else (what?)
?

Thanks,
regards,
Marek

Offline

#2 2026-10-28 09:59:28

-thc
Member
Registered: 2017-03-15
Posts: 1,223

Re: Starting a daemon after an interface has been configured via DHCP

Since dhcpcd AFAIK keeps running I don't expect an "After" target for dhcpcd to work.
You could try to use the dhcpcd-run-hook for the event "REBOOT": https://man.archlinux.org/man/dhcpcd-run-hooks.8.en

Last edited by -thc (2026-10-28 14:49:50)

Offline

#3 2026-10-28 11:00:46

cryptearth
Member
Registered: 2024-02-03
Posts: 2,379

Re: Starting a daemon after an interface has been configured via DHCP

well, the three services listed in the wiki have -wait.service which get used in combination with network-online.target
according to its source https://gitlab.archlinux.org/archlinux/ … type=heads the same mechanism works for dhcpcd
so you can use the example from the wiki 5.3 1-to-1: depend on network-online.target - dhcpcd does the rest already the same as the others do

ok, my bad - failed to recognize that in order for some service to work with network-online.target it has to be in the WantedBy= in the [Install] section ... which is NOT true for dhcpcd

Last edited by cryptearth (2026-10-28 11:30:36)

Offline

#4 2026-10-28 11:14:09

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,531

Re: Starting a daemon after an interface has been configured via DHCP

I doubt that will work.

wiki wrote:

The network wait service of the network manager in use must also be enabled so that network-online.target properly reflects the network status.

$ pacman -Ql dhcpcd | grep wait
$ 

Using the dhcpcd-run-hook as mentioned by -thc looks like an reasonable option to me that should work fine and doesn't depend on external stuff that only works on a certain PID 1.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2026-10-28 11:33:17

cryptearth
Member
Registered: 2024-02-03
Posts: 2,379

Re: Starting a daemon after an interface has been configured via DHCP

Lone_Wolf wrote:

that only works on a certain PID 1.

subtle
but as i know others: it depends on support - then it becomes merely a personal preference

Offline

Board footer

Powered by FluxBB