FS#35224 - [netctl] Problem with netctl-ifplugd@.service and udev/systemd network device naming

Attached to Project: Arch Linux
Opened by Wilhelm Schuster (wlhlm) - Sunday, 12 May 2013, 18:41 GMT
Last edited by Jouke Witteveen (jouke) - Saturday, 01 June 2013, 14:10 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
There is a problem with the netctl systemd-unit `netcl-ifplugd@.service` in conjunction with udev. Originally, my network device is named `enp0s7` and systemd creates a unit file `sys-subsystem-net-devices-enp0s7.device` for it. Udev changes the name to `eth1` later on. So, in the end the network adapter is known as eth1 to the system, but the systemd-device file doesn't change. To monitor whether a cable is plugged into my network adapter, I have to start ifplugd at `eth1`, but in `netctl-ifplugd@.service` under `[Unit]` there are also these lines:

BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

The problem here is, that there is no device file for `eth1`, only for `enp0s7`.

Trying to start the netctl-ifplugd@eth1.service gives an error, since I start ifplugd at eth1 which is the correct name, but the is no systemd-device for it. `journalctl -xn`-output is in the attached file "jorunalctl.txt".

The udev-rule, that changes the network device name looks like this:
$ cat /etc/udev/rules.d/network_persistent.rules
SUBSYSTEM=="net", ATTR{address}=="...", NAME="eth0"
SUBSYSTEM=="net", ATTR{address}=="...", NAME="eth1"

(The file has been created automatically)


$ ip link
1: lo: ...
2: eth1: ...
3. eth0: ...


$ systemctl list-units --type=device
...
sys-subsystem-net-devices-enp0s7.device loaded active plugged MCP61 Ethernet
sys-subsystem-net-devices-enp1s8.device loaded active plugged RTL-8139/8139C/8139C+
...

Additional info:
I switched from netcfg to netctl.
- package version(s):
* netctl-1.0-1
* systemd-203-2
This task depends upon

Closed by  Jouke Witteveen (jouke)
Saturday, 01 June 2013, 14:10 GMT
Reason for closing:  Works for me
Additional comments about closing:  At least it works in the case of persistent naming.
Comment by Wilhelm Schuster (wlhlm) - Tuesday, 28 May 2013, 16:03 GMT
Apparently, systemd's network device naming scheme has changed in version 197 to be more predictable:

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

I guess, on newer arch installations, network devices will get these new names and everything should work as expected.
Simply deleting the file `/etc/udev/rules.d/network_persistent.rules` fixed it for me (be sure to check whether there are any daemons, that explicitly bind to a specific device name).
Comment by Jouke Witteveen (jouke) - Friday, 31 May 2013, 22:15 GMT
I don't really get it: on my system, interfaces are called eth0 and the like and then changed to something a little more cryptic by udev. Are you stacking name-changes? It seems to work for me both with and without udev changing the interface name.
Comment by Wilhelm Schuster (wlhlm) - Saturday, 01 June 2013, 11:35 GMT
I'm not explicitly stacking name-changes. systemd creates *.device unit files for each network adapter (you can list them with `systemctl list-units --type=device`).
These unit files are named like `sys-subsystem-net-devices-NETWORK_ADAPTER.device`, in which "NETWORK_ADAPTER" is a persistent device name, so for example I had the file `sys-subsysten-net-devices-enp0s7.device`.

I also had a udev rule in `/etc/udev/rules.d/network_persistent` which looked like that:
SUBSYSTEM=="net", ATTR{address}=="<mac_address>", NAME="eth0"

I guess, on start-up systemd gives the network adapter a persistent name (like `enp0s7`) and after that the udev rule kicks in and renames this adapter to `eth0`.

In that configuration I had a network device known to the system as `eth0`, but systemd created a device file for this adapter, naming it `enp0s7`. This conflicts with netctl-ifplugd@.service, which assumes that the system name of the adapter and the name of the device file are the same.

I'm not shure, but I think the udev rule in `/etc/udev/rules.d/network_persistent` has been created by the archboot installer, which I used to setup my system.
Comment by Jouke Witteveen (jouke) - Saturday, 01 June 2013, 13:56 GMT
It does look like you're stacking name-changes to me. On my system, there is a file /usr/lib/udev/rules.d/80-net-name-slot.rules which is responsible for the persistent naming. I have it masked out with an empty /etc/udev/rules.d/80-net-name-slot.rules.
Comment by Wilhelm Schuster (wlhlm) - Saturday, 01 June 2013, 14:08 GMT
This network adapter renaming through the udev rule has been created automatically maybe through an update or as I said throught archboot. But as I described earlier, I just deleted the udev rule so that my network adapter keeps its persistent name (`enp0s7`) and there is no conflict anymore with the device unit file. With that I could enable the service with `systemctl enable netctl-ifplugd@enp0s7.service` without problems and it solved the issue.

Loading...