New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition: interface renaming, udev vs. networkd #7293
Comments
uh? networkd does not consider network devices until udev reported they are available, and it does so only after all rules ran, and hence all interfaces got renamed fully. Are you sure it's udev itself that renames the links for you? maybe you have some other networking scripts in place that up the interface too early or so? |
journalctl sez:
I have de-installed ifupdown. The only other possible culprit is open-vm-tools, but its network config script prefers using |
Having same issue on Ubuntu 17.10 and Ubuntu 18.04 (development branch). Ubuntu uses netplan to create the .link and .network files under /run/systemd/network/ You get the interface name set or the ipaddress, not both. |
I just started seeing this update on Gentoo after updating from 233 to 236. Few scenarios I tested:
Workaround by @smurfix fixes it for me too. |
Umm, the "needs-reporter-feedback" tag seems no longer appropriate here. |
Looks like the udevadm settle fix does not work on all systems. For now I just created an unit which restarts systemd-networkd on multi-user target... journalctl output from the affected system (manual restart at 04:08:05):
|
Ran into this on Gentoo after upgrading to 236 (and still also after 238 as I decided to try that first). The udevadm settle ExecStartPre did not work, but I added a sleep 5 ExecStartPre as well, which does appear to allow systemd-networkd to start after devices have been renamed. This seems to indicate that udevadm settle returns before udev is finished processing its rules. When systemd-networkd sees a network device renamed, it doesn't seem to consider the configs for it with the new name, which puzzles me as well, unless it's an unfortunate consequence of timing. On my system, r8169 is a built-in, not a module, so I'm not sure if this makes any difference with the timing behavior. |
Likewise encountered this on gentoo (systemd 236). And this thread was super helpful. The one thing that threw me off (being new to systemd) was where to put the conf file. So for reference.
PS: the fileexist is a little program that just waits for up to 15 seconds for the /sys/class/net/enp5s0 to exist. As I felt that's better than just arbitrary sleep. But the idea is the same - wait for the rename to happen. |
ubuntu link: https://bugs.launchpad.net/netplan/+bug/1770082 |
So, is this still reproducible with v240+? If so, please provide relevant configs and logs. |
As already @poettering commented,
So, please check the rules or .link files in your initrd. I guess some contradiction with host's setting. Anyway, try to boot with |
Does this issue appear only on containers? Or does this appear also on bare systems? If only containers, then #11816 may help this issue. If you are interested the PR, please test it. Thank you. |
Seen on bare systems, but I'll test that PR anyway. |
Could you boot the system with |
I am not sure, but I hope #11881 helps this issue, and the PR is already merged. If the PR does not fix this issue, please paste the relevant logs I requested in the above, then I will reopen this. Thank you. |
@yuwata This issue bugged me for quite some time now, even though my network interface name did not change. But obviously some virtual devices created by docker would use the original name systemd version the issue has been seen with
WorkaroundSimilar to the workaround mentioned in the issue description I found another way to handle it by creating a drop-in file based upon NixOS/nixpkgs#39340: systemctl edit systemd-networkd.service and adding these lines: [Unit]
After=systemd-udev-settle.service Then after reloading the daemon via systemctl status systemd-networkd.service ● systemd-networkd.service - Network Service
Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/systemd-networkd.service.d
└─override.conf You can check the dependency tree via systemctl list-dependencies --after systemd-networkd systemd-networkd.service
● ├─-.mount
● ├─system.slice
● ├─systemd-journald.socket
● ├─systemd-networkd.socket
● ├─systemd-sysctl.service
● ├─systemd-sysusers.service
● ├─systemd-udev-settle.service
● ├─systemd-udevd.service
● └─network-pre.target
● ├─ip6tables.service
● ├─ipset.service
● └─iptables.service The Thus I believe there the race condition still applies here. |
No way. systemd-networkd is written to handle hotplug event properly, and udev-settle is a terrible hack for programs that don't understand hotplug. |
systemd-udev-settle is a terrible hack[1] and should never[2] ever[3] used, seriously it's very bad. It was used as a stop-gap solution for issue #39069, but thanks to PR #79532 it can be removed now. [1]: systemd/systemd#7293 (comment) [2]: #73095 [3]: #107341
Submission type
systemd version the issue has been seen with
Used distribution
In case of bug report: Expected behaviour you didn't see
In case of bug report: Unexpected behaviour you saw
In case of bug report: Steps to reproduce the problem
Reboot a couple of times. Sometimes the interface is renamed correctly. Sometimes it is not.
Workaround:
The text was updated successfully, but these errors were encountered: