Skip to content

Commit

Permalink
fix(network): correct network device naming (bsc#1192986)
Browse files Browse the repository at this point in the history
Make the rule for persistent net device naming default in SLES.
Keep the predictable names as fallback if 70-persistent-net.rules is not
present but a network module is added to the initrd.
Make sure that either persistent or predictable naming is applied, but never
both.
  • Loading branch information
tblume committed Oct 23, 2023
1 parent dcb9bdb commit b9e04ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions modules.d/35network-legacy/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ installkernel() {
install() {
local _arch

#Adding default link
if dracut_module_included "systemd"; then
# Add default link if there is no persistent network device naming
if [ ! -e /etc/udev/rules.d/70-persistent-net.rules ] &&\
dracut_module_included "systemd"; then

inst_multiple -o "${systemdutildir}/network/99-default.link"
[[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"
fi
Expand Down
9 changes: 6 additions & 3 deletions modules.d/35network-manager/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ install() {
inst_simple "$moddir"/nm-initrd.service "$systemdsystemunitdir"/nm-initrd.service
inst_simple "$moddir"/nm-wait-online-initrd.service "$systemdsystemunitdir"/nm-wait-online-initrd.service

# Adding default link
inst_multiple -o "${systemdutildir}/network/99-default.link"
[[ $hostonly ]] && inst_multiple -H -o "${systemdsystemconfdir}/network/*.link"
# Add default link if there is no persistent network device naming
if [ ! -e /etc/udev/rules.d/70-persistent-net.rules ]; then

inst_multiple -o "${systemdutildir}/network/99-default.link"
[[ $hostonly ]] && inst_multiple -H -o "${systemdnetworkconfdir}/*.link"
fi

$SYSTEMCTL -q --root "$initdir" enable nm-initrd.service
fi
Expand Down
13 changes: 10 additions & 3 deletions modules.d/95udev-rules/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ install() {
61-persistent-storage-edd.rules \
64-btrfs.rules \
70-uaccess.rules \
70-persistent-net.rules \
71-seat.rules \
73-seat-late.rules \
75-net-description.rules \
Expand All @@ -55,8 +54,16 @@ install() {
inst_rules 91-permissions.rules
# eudev rules
inst_rules 80-drivers-modprobe.rules
# legacy persistent network device name rules
[[ $hostonly ]] && inst_rules 70-persistent-net.rules

# only include persistent network device name rules if network is set up
# in the initrd
# Avoid interference with systemd predictable network device naming
if dracut_module_included "network" || dracut_module_included "network-manager"; then
if [ -e /etc/udev/rules.d/70-persistent-net.rules ] && \
! dracut_module_included "systemd-networkd"; then
[[ $hostonly ]] && inst_rules 70-persistent-net.rules
fi
fi

{
for i in cdrom tape dialout floppy; do
Expand Down

0 comments on commit b9e04ac

Please sign in to comment.