Generate udev rules files to rename devices #31
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to a systemd issue[1], using link files to rename interfaces doesn't work as expected. Link files will not rename an interface if it was already renamed, and interfaces are renamed in initrd, so set-name will often not work as expected when rebooting.
However, rules files will cause a renaming, even if the interface has been renamed in initrd.
So, while we sort out whether the systemd-udev behaviour is broken or not, we can simply generate udev rules files with appropriate renaming info in /run/udev/rules.d/70-netplan-.rules
A file will be created for non-virtual interfaces with both a
set-name
and adriver
or amacaddress
in the match stanza. (Renaming from name to name doesn't work.)This is at least a temporary fix to LP: #1770082.
As far as testing goes, test successful
set-name:
generations, and a few cases where we expect no files to be generated.[1] https://github.com/systemd/systemd#9006