Azure / Azure/WALinuxAgent

Use proper way to disable 75-persistent-net-generator.rules

Open
#1,750 2 comments 0 reactions 0 assignees View on GitHub
provisioning
Dominant language
Python
Stars
581
Forks
397
Avg merge
2d 15h
Merged PRs (30d)
9

Description

The default for an SLES/RHEL server is to generate a file which hardcodes MAC to interface names.
This is bad if you want to use snapshots which get new MAC but config binds to old interface name.
To avoid this, the udev rules 75-persistent-net-generator.rules and 80-net-name-slot.rules needs to be disabled.

The WALinuxAgent does this already by deleting those files.
(see ./azurelinuxagent/common/osutil/default.py, ./bin/waagent2.0)
This is not the proper way because
- An Update of the udev package will install the file again
- The RPM database is inconsistent on SLES/RHEL

Example:

publisher = "SUSE"
offer = "SLES-BYOS"
sku = "12-SP4"
version = "2019.06.17"

Check that RPM database is incosistent:
:~> rpm -q udev -Vv | grep missing
missing /usr/lib/udev/rules.d/75-persistent-net-generator.rules

The proper way: Create symlinks to /dev/null in /etc/udev/rules.d/. See [1]
/etc/udev/rules.d/75-persistent-net-generator.rules -> /dev/null
/etc/udev/rules.d/80-net-name-slot.rules -> /dev/null

Additional information
- 80-net-name-slot.rules does only exist on RHEL, 75-persistent-net-generator.rules only exist on SLES, but it does not matter to disable both on both operating systems)
- If you boot an SLES12, you will see that /etc/udev/rules.d/75-persistent-net-generator.rules -> /dev/null will exist. This is because Suse netconfig creates it as well. It does not matter if the WALinuxAgent does it as well.

[1] man udev
~~~
RULES FILES
The udev rules are read from the files located in the system rules directory /usr/lib/udev/rules.d,
the volatile runtime directory /run/udev/rules.d and the local administration directory
/etc/udev/rules.d. All rules files are collectively sorted and processed in lexical order,
regardless of the directories in which they live. However, files with identical filenames replace
each other. Files in /etc have the highest priority, files in /run take precedence over files with
the same name in /usr/lib. This can be used to override a system-supplied rules file with a local
file if needed; a symlink in /etc with the same name as a rules file in /usr/lib, pointing to
/dev/null, disables the rules file entirely. Rule files must have the extension .rules; other
extensions are ignored.
~~~

Contributor guide

Open the contributing guide

Research direction

Read azurelinuxagent/common/osutil/default.py and bin/waagent2.0 to trace the existing deletion of the udev rules, then consult the referenced udev rules-file behavior. Done means the agent disables 75-persistent-net-generator.rules and 80-net-name-slot.rules through /etc/udev/rules.d symlinks to /dev/null without deleting package-owned files.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.