netctl is lame

Download this article as an e-bookDownload this article as an e-book

One morning not long ago I installed a different graphics card and my machine no longer connected to the network upon startup.
The interface was not coming up and this being Arch Linux, it was netctl wouldn’t start, but it was being catty about why.

Having written about systemd before, I thought this might be a piece of cake to figure out, so I rolled up my sleeves.

I know that after a bunch of checks it just calls /usr/lib/network start eth, so I called it and found that my onboard network card had been renamed enp3s0 instead of enp2s0, so I changed the reference in /etc/system/eth to Interface=enp3s0.

Now /usr/lib/network start eth would get me online, but the machine would still not bring the interface up on boot! Netctl still wasn’t satisfied:

[root@wir ~]# systemctl status netctl
‚óŹ netctl.service - (Re)store the netctl profile state
   Loaded: loaded (/usr/lib/systemd/system/netctl.service; enabled; vendor preset: disabled)
      Active: active (exited) since Sat 2015-10-10 12:53:55 CEST; 6min ago
        Process: 1027 ExecStart=/usr/bin/netctl restore (code=exited, status=1/FAILURE)
         Main PID: 1027 (code=exited, status=1/FAILURE)
            CGroup: /system.slice/netctl.service

            Oct 10 12:53:55 wir systemd[1]: Starting (Re)store the netctl profile state...
            Oct 10 12:53:55 wir systemd[1]: Started (Re)store the netctl profile state.

Lets try netctl directly:

# netctl start eth
# "failed, refer to journald -xn"

Wah.


Oct 10 12:56:37 wir systemd[1]: sys-subsystem-net-devices-enp2s0.device: Job sys-subsystem-net-devices-enp2s0.device/start timed out.
Oct 10 12:56:37 wir systemd[1]: Timed out waiting for device sys-subsystem-net-devices-enp2s0.device.
-- Subject: Unit sys-subsystem-net-devices-enp2s0.device has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit sys-subsystem-net-devices-enp2s0.device has failed.
-- 
-- The result is timeout.
Oct 10 12:56:37 wir systemd[1]: Dependency failed for A basic dhcp ethernet connection.
-- Subject: Unit netctl@eth.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit netctl@eth.service has failed.
-- 
-- The result is dependency.
Oct 10 12:56:37 wir systemd[1]: netctl@eth.service: Job netctl@eth.service/start failed with result 'dependency'.
Oct 10 12:56:37 wir polkitd[762]: Unregistered Authentication Agent for unix-process:2441:16689 (system bus name :1.13, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (discon
Oct 10 12:56:37 wir systemd[1]: sys-subsystem-net-devices-enp2s0.device: Job sys-subsystem-net-devices-enp2s0.device/start failed with result 'timeout'.

Now I had no idea where to find sys-subsystem-net-devices-enp2s0.device, and started poking around in /lib/systemd/system,
/usr/lib/systemd/system and /etc/systemd/system. Finally I found /etc/systemd/system/netctl@eth.service which seems to be the failing service, and sure enough, it refers to the device, so I changed it:

[Unit]
Description=A basic dhcp ethernet connection
BindsTo=sys-subsystem-net-devices-enp3s0.device
After=sys-subsystem-net-devices-enp3s0.device

After that netctl would boot again.

stair warning

I just wanted to say that this problem is lame. I was under the impression that the (already lame) predictable network card renaming from eth0 to enpXsY was supposed to be stable to avoid this problem.
Furthermore, systemd and netctl made a very long line of breadcrums to finally solve this, instead of being obvious.
Note that the netctl@eth.service file was created by netctl and not me, so I had no prior knowledge of its existence.

And yes, clearly I should have just called `netctl reenable eth`
but that begs the question how should I have known about this without consulting the arch wiki?

Another thing I could have done to save me troubles was to disasble predictable network card renaming entirely, by booting the kernel with `net.ifnames=0`.

But then I would not be learning.

Download this article as an e-bookDownload this article as an e-book

Leave a Reply