[systemd-devel] Bug? Ordering services on device aliases

Malte Starostik lists at malte.homeip.net
Mon Jun 25 18:11:19 PDT 2012


Hi Dave,

Am Montag, 25. Juni 2012, 16:23:13 schrieb Dave Reisner:
> The premise is fairly simple, given the below unit:
> 
>   [Unit]
>   Description=dhcpcd on %I
>   Wants=network.target
>   Before=network.target
>   After=sys-subsystem-net-devices-%i.device
>   BindTo=sys-subsystem-net-devices-%i.device
> 
>   [Service]
>   Type=forking
>   PIDFile=/run/dhcpcd-%I.pid
>   ExecStart=/sbin/dhcpcd -A -q -w %I
>   ExecStop=/sbin/dhcpcd -k %I
> 
>   [Install]
>   Alias=multi-user.target.wants/dhcpcd at eth0.service
> 
> All I'm interested in is making sure that the device is available before
> starting dhcpcd for an interface. However, when I enable this unit, the
> device alias is inactive after booting:

not exactly answering your question, but dhcpcd 5.5.6 comes with this lean and 
clean unit:

[Unit]
Description=Lightweight DHCP client daemon
Wants=network.target
Before=network.target

[Service]
ExecStart=/sbin/dhcpcd --nobackground

[Install]
WantedBy=multi-user.target

apart from the preferable --nobackground, this starts dhcpcd on all available 
interfaces, including those that only gonna appear later on.  To fine-tune 
which devices to actually manage or ignore, you can then use /etc/dhcpcd.conf 
instead.  And you only need one dhcpcd process, not one per interface.  I even 
use that to assign static addresses and routes via dhcpcd, as I haven't found 
anything remotely as straighforward to setup the simplest of configs.

Just some food for considerations,
Malte



More information about the systemd-devel mailing list