Bug 52580

Summary: device alias doesn't work in BindTo/After
Product: systemd Reporter: rodrigo <rodrigorivascosta>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: d, Felix.Braun, freedesktop, rodrigorivascosta, tuxce.net, uhrmar, vmlinuz386
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:

Description rodrigo 2012-07-27 09:59:29 UTC

I've been trying to write a unit template to configure the network (systemd version: 187):

File: net-static@.service

Description=Static interface


Now, if I uncomment any of the lines that make a reference to the device alias, then the alias itself disappears!

When I say that the alias disappears, I mean that it is no longer an alias of the real device, instead it looks like systemd believes it is a proper unit in its own, and I can see it in the output of `systemctl --all`: loaded inactive dead, without meaningful description.

If the BindTo is uncommented, that means that this unit cannot start: it tries to start the sys-subsystem-net-devices-eth0.device unit, and it times out.

If only the After is uncommented, then this unit is started anyway.

However, if I write the BindTo/After using the full name of the device (BindTo=sys-devices-pci0000:00-0000:00:03.0-net-eth0.device) then it works as expected). But that's not so useful, because I'm writing a template so I really need to use the alias.

Is my unit expected to work or am I totally misunderstanding aliases?

Comment 1 Dave Reisner 2012-09-09 17:26:36 UTC
Yeah, this is definitely a bug -- it breaks ordering for DHCP clients and wpa_supplicant. The only workaround I know of at the moment is to explicitly load the module in /etc/modules-load.d to give the interface a better chance of existing when your unit runs.

I reported this a while ago, as well:


It's still valid in 189.
Comment 2 Markus Uhr 2012-10-02 07:39:16 UTC
This bug also affects me. In my case, it's a USB-to-Ethernet adaptor that gets different USB addresses assigned by the kernel (usb7-7\x2d3-7\x2d3:1.0 or usb3-3\x2d3-3\x2d3:1.0). Since I can't use the device alias, as a work-around, I have to rewrite my service file upon every second reboot.

Fixing this bug would be greatly appreciated.

Comment 3 Eelco Dolstra 2012-10-15 14:56:56 UTC
I've posted a patch on the systemd-devel list that should fix this problem:

Comment 4 Dave Reisner 2012-10-21 13:09:47 UTC
Thanks Eelco, I pulled your patch for inclusion in the next release.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.