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

Lennart Poettering lennart at poettering.net
Mon Jul 9 15:32:18 PDT 2012


On Mon, 25.06.12 16:23, Dave Reisner (d at falconindy.com) wrote:

>   $ systemctl -t device --full --all --no-pager | grep net
>   sys-devices-pci0000:00-0000:00:03.0-virtio0-net-eth0.device loaded active
>   sys-subsystem-net-devices-eth0.device                       loaded
>   inactive

Hmm,  if you do "systemctl show
sys-devices-pci0000:00-0000:00:03.0-virtio0-net-eth0.device", do you see
the alias name listed in Names=? Do you see the name listed properly for
other network devices?

> 
> The device node itself looks just fine, according to udev:
> 
>   $ udevadm info -q property /devices/pci0000:00/0000:00:03.0/virtio0/net/eth0
>   DEVPATH=/devices/pci0000:00/0000:00:03.0/virtio0/net/eth0
>   ID_BUS=pci
>   ID_MODEL_FROM_DATABASE=Virtio network device
>   ID_MODEL_ID=/sys/devices/pci0000:00/0000:00:03.0/virtio0
>   ID_VENDOR_FROM_DATABASE=Red Hat, Inc
>   ID_VENDOR_ID=0x1af4
>   IFINDEX=2
>   INTERFACE=eth0
>   SUBSYSTEM=net
>   SYSTEMD_ALIAS=/sys/subsystem/net/devices/eth0
>   TAGS=:systemd:
>   USEC_INITIALIZED=95201
> 
> Meanwhile, this of course means that dhcpcd at eth0.service is sitting
> idle:
> 
>   $ systemctl status dhcpcd at eth0.service
>   dhcpcd at eth0.service - dhcpcd on eth0
>       Loaded: loaded (/etc/systemd/system/dhcpcd at .service; enabled)
>       Active: inactive (dead)
>       CGroup: name=systemd:/system/dhcpcd at .service/eth0
> 
> As soon as I reboot without the After=/BindTo= ordering on dhcpcd at .service,
> the alias shows as active:
> 
>   $ systemctl status sys-subsystem-net-devices-eth0.device
>   sys-devices-pci0000:00-0000:00:03.0-virtio0-net-eth0.device - Virtio network device
>       Loaded: loaded
>       Active: active (plugged) since Mon, 25 Jun 2012 16:16:52 -0400; 46s ago
>       Device: /sys/devices/pci0000:00/0000:00:03.0/virtio0/net/eth0
> 
> Were device aliases not intended to be used this way? If not, what's the
> purpose? How can I order a network service against a device to ensure
> it's started properly?

It shoul definitely work. But there might be a bug with the logic
actually, i.e. instead of actually adding this stuff as alias, we
probably need to implement this via the "follows" logic, simply because
such an alias name might refer to a different .device unit over time,
and aliases never change.

I will have a look into this.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list