[systemd-devel] /sys/subsystem device dependency not working

Albert Strasheim fullung at gmail.com
Fri Aug 19 07:48:49 PDT 2011

Hello again

On Thu, Aug 18, 2011 at 10:03 PM, Albert Strasheim <fullung at gmail.com> wrote:
> I am trying to use systemd-26 to configure a network device.
> I've decided to try this instead of the standard Fedora init scripts
> because I want the network configuration to depend on a kernel command
> line argument (which should be possible as soon as
> ConditionKernelCommandLine=foo=bar gets fixed) and some files that are
> generated during bootup.
> I spotted the following in /lib/udev/rules.d/99-systemd.rules:
> SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd",
> ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/%k"

I have done some debugging with gdb.

When the initial device gets added, with a name like


everything works fine and unit_add_name calls unit_add_to_dbus_queue.

I can see that systemd picks up the SYSTEMD_ALIAS from udev and calls
device_add_escaped_name(u, alias) in device_update_unit.

After that the alias is added, with a name like


it does a goto fail at this point:

151 if ((r = hashmap_put(u->meta.manager->units, s, u)) < 0) {
(gdb) n
152 set_remove(u->meta.names, s);
(gdb) n
153 goto fail;

where s = strdup(text), and text contains the alias string.

This is the only obvious difference I can see in the code that adds
the original device and its alias.

Any thoughts?




More information about the systemd-devel mailing list