I'm using Ubuntu 12.04 LTS server edition and I am modifying /etc/udev/rules.d/70-persistent-net.rules
to define my own mappings of ethernet interfaces to MAC addresses; that file is initially generated by rules in /lib/udev/rules.d/75-persistent-net-generator.rules
at system installation time (or at the first boot, I actually don't know and it doesn't matter here).
How can I be sure that my edited version will never ever be overwritten by anything?
Removing the persistent-net-generator, as suggested on some websites, is not the Right Thing™ to do as told by comments in the file itself: it will be overwritten by any update of the udev
package. I'm looking for a more formally correct way to disable it.
Is it enough to just make sure that /etc/udev/rules.d/70-persistent-net.rules
does exist?
Maybe there are other events that could trigger its regeneration? (eg. adding or removing ethernet interfaces to the system?)
Best Answer
The correct way to disable the generator is to override it with an empty file. Any rules in
/etc/udev/rules.d
will take precedence over rules in/lib/udev/rules.d
, so simply create an empty file or symlink to/dev/null
:This is safe and future-proof.