While trying to sort out some problems with my gitlab runners, I noticed a peculliar error message I’d not seen before:
Dec 14 21:41:09 somehostname systemd-udevd: vethd123bdc: Could not generate persistent MAC: No data available
I paraphrased it below, but the following tldr should get you the needful.
This is a harmless error, caused by a missed expectation of
systemd when creating virtual interfaces.
To ensure consistency of ethernet address names, the systemd attribute
MACAddressPolicy=persistent is selected by default. The feature expects the net driver to provide an attribute to seed the random-but-consistent device name… However the necessary attribute isn’t present, thus the error.
The MAC address policy is specified in the
/lib/systemd/network/99-default.link file (on my nodes)
The fix is to add a
systemd policy entry, excluding certain network drivers from the default mac address policy behavior.
I did this on my ubuntu hosts with the following file:
- Reboot yer node.
- examine journal output to verify the noise is no longer generated
- get on with your life.
When a system is setup with bridges and bonds, the following may be written to the journal.log.
This can be observed by:
journalctl -b0 -u systemd-udevd | grep MAC
For interfaces that doesn’t have a persistent MAC address (most hardware should) a new MAC address is generated which is guaranteed to be the same on > every boot for the given machine and the given device, but which is otherwise random. The option
MACAddressPolicy=persistentenables this by default in
/usr/lib/systemd/network/99-default.link. This feature depends on ID_NET_NAME_* properties to exist for the link. On virtual interfaces (such as bridges, bonds, etc…) these properties are not set hence the generation of a persistent MAC address will fail with:
Could not generate persistent MAC address for $name: No such file or directory
The message is harmless, it will not break anything. But to make the system not write the messages anymore. The following workaround can be used.
- Create a
systemd link2 file called
- Which matches on drivers and set the
ethtool -i <device>to expose the driver.
In this example the file will look as follows: server15:~ # cat /etc/systemd/network/98-default.link [Match] Driver=bonding bridge
man systemd.link: https://man7.org/linux/man-pages/man5/systemd.link.5.html “View the systemd.link manpage” ↩︎