Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AutoYaST: network interface naming tests
BOOTPROTO='dhcp'
STARTMODE='auto'
BOOTPROTO='dhcp'
STARTMODE='auto'
BOOTPROTO='dhcp'
STARTMODE='auto'
BOOTPROTO='dhcp'
STARTMODE='auto'

Summary

Issue bnc#787296.
Some discussion at github.

Issue description

Udev rules used to be written at the end of stage1.
  1. Original idea was to fix bnc#303916 - interface name change between stage1 and stage2. The fix introduced net-udev section and allowed user to rename interfaces during the installation process.
  2. Users started to use net-udev section for renaming interfaces in target system. However the implementation lead to bug bnc#578760 as a direct consequence of above fix. Implemented fix for this bug was "search new interface name according its MAC".
  3. Eventually, bug bnc#787296 has roots in both fixes [1], [2]. Firstly, it fails in searching new device name (see [2]). Secondly, it fails due to the fact that udev rules are written at the end of stage1 (see [1]) - it is wrong because when network service is disabled during installation then installer do not call save_network, so no udev rules are written.

Proposed fix

move renaming interfaces according user's profile to stage2. Fix for [1] was redesigned and uses MAC based udev rules, but without user supplied interface name. Udev rules based on user's profile are written during stage1.

Tested scenarios

  1. AutoYaST profile without net configuration.
  2. AutoYaST profile with basic interface configuration.
  3. AutoYaST profile with interface configuration including renaming interface. Renaming is ID based.
All scenarios were tested for DVD and PXE installation source. To test the fix properly you need to run installer with [a] driver update (fix stage1) even [b] update target system at the end of stage1 (fix for stage2). [a] was achieved using targeted info files, [b] was achieved using

mount /dev/sda2 /mnt
wget http://idontknow.suse.cz/install/net.rpm
rpm --root /mnt -Uv net.rpm --nodeps --ignorearch

Results

Virtual machine with 2 NICs, installation over eth0 (renamed one)
 Sourcev.2.17.181 (new)v.2.17.171 (old)
Scenario 1DVD   udev after stage1
udev after stage2
sysconfig
 PXE
Scenario 2DVD udev after stage1
udev after stage2
sysconfig
ifcfg-eth0
udev after stage1
udev after stage2
sysconfig
ifcfg-eth0
 PXE
Scenario 3DVD udev after stage1
udev after stage2
sysconfig
ifcfg-eth99
udev after stage1
udev after stage2
sysconfig
ifcfg-eth99
 PXEudev after stage1
udev after stage2
sysconfig
ifcfg-eth99

NOTE:Not so obvious part of buggy case scenario 3 / DVD source / v2.17.171 - it is impossible to finish using ssh install. Interface will not be available at the beginning of stage 2.

TODO: Virtual machine with 2 NICs, installation over eth1 (eth0 present, but no net access)

TODO: Virtual machine with 2 NICs, installation over eth0, both NICs swap their MAC between stage1 and 2 (emulate differend order of interface detection)

Conclusions

Control flow during installation could be simplified due to removing couple of lines of code.

config
dhcp
if-down.d
if-up.d
ifcfg-lo
ifcfg.template
ifroute-lo
providers
scripts
config
dhcp
if-down.d
if-up.d
ifcfg-eth0
ifcfg-lo
ifcfg.template
ifroute-lo
providers
routes
scripts
config
dhcp
if-down.d
if-up.d
ifcfg-eth0
ifcfg-lo
ifcfg.template
ifroute-lo
providers
routes
scripts
config
dhcp
if-down.d
if-up.d
ifcfg-eth99
ifcfg-lo
ifcfg.template
ifroute-lo
providers
routes
scripts
config
dhcp
if-down.d
if-up.d
ifcfg-eth99
ifcfg-lo
ifcfg.template
ifroute-lo
providers
routes
scripts
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<networking>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth99</device>
<startmode>auto</startmode>
</interface>
</interfaces>
<net-udev config:type="list">
<!-- This table is used for MACDB in setup_hana. Do not change the syntax here. -->
<!-- 1 gbit (GSPB) -->
<rule>
<name>eth99</name>
<rule>ID</rule>
<value>0000:02:01.0</value>
</rule>
</net-udev>
</networking>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>password</user_password>
<username>root</username>
</user>
</users>
<software>
<patterns config:type="list">
<pattern>base</pattern>
</patterns>
<packages config:type="list">
<package>dialog</package>
<package>yast2-bootloader</package>
<package>yast2-ncurses</package>
</packages>
</software>
</profile>
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<networking>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>auto</startmode>
</interface>
</interfaces>
</networking>
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>password</user_password>
<username>root</username>
</user>
</users>
<software>
<patterns config:type="list">
<pattern>base</pattern>
</patterns>
<packages config:type="list">
<package>dialog</package>
<package>yast2-bootloader</package>
<package>yast2-ncurses</package>
</packages>
</software>
</profile>
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>password</user_password>
<username>root</username>
</user>
</users>
<software>
<patterns config:type="list">
<pattern>base</pattern>
</patterns>
<packages config:type="list">
<package>dialog</package>
<package>yast2-bootloader</package>
<package>yast2-ncurses</package>
</packages>
</software>
</profile>
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ad:f7:91", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ad:f7:87", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:8e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:0c:98", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="0000:02:01.0", NAME="eth99"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:ad:f7:91", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.