[systemd-devel] Networkd fails to activate the device on boot

Tom Gundersen teg at jklm.no
Mon Aug 18 03:41:44 PDT 2014

On Sat, Aug 16, 2014 at 6:53 PM, Thomas Bächler <thomas at archlinux.org> wrote:
> Hello Tom,
> I am using systemd 215-4 from Arch Linux.
> I have the following configuration files in /etc/systemd/network:
> # 01-lan.network
> [Match]
> Name=enp3s0
> [Network]
> Address=
> Gateway=
> # 01-qemu.netdev
> [NetDev]
> MACAddress=1a:de:ad:be:ef:01
> Name=qemu
> Kind=tap
> # 01-qemu.network
> [Match]
> Name=qemu
> [Network]
> Address=
> I have two problems with this setup:
> 1) The enp3s0 interface does not activate on boot. I need to restart
> networkd manually to make it work.

Hm, that is decidedly uncool. It seems we are not aware of the link.
Could you try with Environment=SYSTEMD_LOG_LEVEL=debug in your service
file to get some more info (of course that may hide the bug)? Is this
reproducible with current git (I don't know of any fix to this, but
you never know).

> 2) The qemu interface does not have the correct MAC address. It gains a
> seemingly random address that is inconsistent across reboots.

Oh fun, I should have known that allowing tun/tap devices to be
special-cased would come back to bite us. The issue here is that we
create tun/tap devices using an ioctl rather than the standard rtnl
interface. This ioctl does not allow us to set MTU, mac address etc.
We would have to fix that up after creating the device (over rtnl).

I think the best solution would be to simply add support to the kernel
for creating persistent tun/tap links over rtnl (seems like it should
be very simple), so I don't think we should work around this in
networkd. In the meantime, I will add warnings/documentation to
networkd so people know that this won't work.

For those who need the functionality, a work-aronud is to do it by
dropping in a .link file, matching on the interface name.

> Here is an excerpt from the journal:
> [    2.356909] lije systemd[1]: Starting Network Service...
> [    2.377715] lije systemd-networkd[367]: rtnl: received address for a
> nonexistent link, ignoring
> [    2.377862] lije systemd-networkd[367]: rtnl: received address for a
> nonexistent link, ignoring
> [    2.377960] lije systemd-networkd[367]: qemu            : link configured
> [    2.379489] lije systemd[1]: Started Network Service.
> [   57.298036] lije systemd[1]: Stopping Network Service...
> [   57.298776] lije systemd-networkd[367]: Received SIGTERM from PID 1
> (systemd).
> [   57.364169] lije systemd[1]: Starting Network Service...
> [   57.451984] lije systemd-networkd[490]: lo              : gained carrier
> [   57.452133] lije systemd[1]: Started Network Service.
> [   57.492641] lije systemd-networkd[490]: qemu            : link configured
> [   57.492732] lije systemd-networkd[490]: enp3s0          : link configured
> [   59.074472] lije systemd-networkd[490]: enp3s0          : gained carrier
> Any ideas?

More information about the systemd-devel mailing list