From b97dfb8fbd4df0dcb67b69d23926ccc090e95176 Mon Sep 17 00:00:00 2001 From: Maksim Malchuk Date: Mon, 18 Apr 2022 21:08:16 +0300 Subject: [PATCH] Revert "Fallback to persistent netifs names with systemd" This reverts commit 840129097631611fe110bbe01b1707f9db000865. We are reverting this because some users may want to use predictable device names and may not even use Debian. However, after some investigation we have found a couple of bugs in dhcp-all-interfaces on Debuntu distros. The parent change corrects those bugs. Additionally new Linux kernels emit "move" events to udev when interfaces are renamed to their predictable name. Support this "move" in the dhcp-all-interfaces udev rules. Making these changes appaers to produce functional images for Debian users using predictable device names. If predictable device names are not desired turning them off is straightforward and release notes are updated to give users the info they need to do that outside of this element. Change-Id: I125f1a0c78a103b51bda961528c3e66c345bf604 Co-Authored-By: Clark Boylan Signed-off-by: Maksim Malchuk --- .../install.d/50-dhcp-all-interfaces | 1 - .../install.d/dhcp-all-interfaces-udev.rules | 2 +- .../install.d/udev-net-setup-link.rules | 0 ...erfaces-debian-issue-2ec7f1a5186f0b16.yaml | 20 +++++++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) delete mode 100644 diskimage_builder/elements/dhcp-all-interfaces/install.d/udev-net-setup-link.rules create mode 100644 releasenotes/notes/dhcp-all-interfaces-debian-issue-2ec7f1a5186f0b16.yaml diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index e2fa33ab..2b6e4ce6 100755 --- a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -72,7 +72,6 @@ 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 diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rules b/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rules index a8c3cf51..39835f1a 100644 --- a/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rules +++ b/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces-udev.rules @@ -1 +1 @@ -SUBSYSTEM=="net", KERNEL!="lo", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="dhcp-interface@$name.service" +SUBSYSTEM=="net", KERNEL!="lo", ACTION=="add|move", TAG+="systemd", ENV{SYSTEMD_WANTS}+="dhcp-interface@$name.service" diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/udev-net-setup-link.rules b/diskimage_builder/elements/dhcp-all-interfaces/install.d/udev-net-setup-link.rules deleted file mode 100644 index e69de29b..00000000 diff --git a/releasenotes/notes/dhcp-all-interfaces-debian-issue-2ec7f1a5186f0b16.yaml b/releasenotes/notes/dhcp-all-interfaces-debian-issue-2ec7f1a5186f0b16.yaml new file mode 100644 index 00000000..e2d46cf1 --- /dev/null +++ b/releasenotes/notes/dhcp-all-interfaces-debian-issue-2ec7f1a5186f0b16.yaml @@ -0,0 +1,20 @@ +issues: + - | + The dhcp-all-interfaces element attempts to work with "predictable + interface names". During boot the name of the interfaces is changed from + ethX to the new scheme, for example enpXsX; depending on the Linux kernel + this move may be captured by udev as an "add" or "move" event. The + dhcp-all-interfaces udev rule has been updated to match against both + possible events. If you prefer to not use predictable names your image + builds can set DIB_BOOTLOADER_DEFAULT_CMDLINE with net.ifnames=0 or mask + the default policy with `ln -s /dev/null /etc/systemd/network/99-default.link`. + This process is documented by systemd: + https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ + + Note that this update reverts previous changes to disable predictable + interface names completely when using dhcp-all-interfaces. Predictable + device names were disabled in an effort to make dhcp-all-interfaces + function on Debian Bullseye, but this broke any users that wished to + use predictable device names. Instaed we make predictable device names + work on Debian Bullseye and allow users to disable predictable device + names should they choose to.