Fallback to persistent netifs names with systemd

The dhcp-all-interfaces element does not work with the predictable names
scheme, fallback to the persistent names scheme as workaround.

Bug: 1960301

Change-Id: I117964a60615a5b7e9984f52f02cd018d1a48ed0
This commit is contained in:
Riccardo Pittau 2022-02-08 10:58:06 +01:00
parent b713c7fe6c
commit 8401290976
3 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,7 @@ elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules
sed -i "s/TimeoutStartSec=DIB_DHCP_TIMEOUT/TimeoutStartSec=$(( ${DIB_DHCP_TIMEOUT:-30} * 2 ))s/" /usr/lib/systemd/system/dhcp-interface@.service
install -D -g root -o root -m 0644 ${SCRIPTDIR}/udev-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules
elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces
update-rc.d dhcp-all-interfaces defaults

View File

@ -0,0 +1,12 @@
---
fixes:
- |
The dhcp-all-interfaces element does not work correctly with the new
"predictable names" scheme for network interfaces.
During boot the name of the interfaces is changed from ethX to the new
scheme, for example enpXsX; this name change is not detected by udev de
facto making the udev rule of the dhcp-all-interfaces element useless;
this causes the machine booted with the image including the dhcp-all-interfaces
element to not get any ip and so being unreachable from the network.
This patch includes a workaround to fallback to the "persistent names"
scheme allowing the dhcp-all-interfaces element to work again as intended.