Ubuntu 14.04 server: Change em1 to eth0 - no /etc/udev/rules.d/70-persistent-net.rules file
EDIT: After a small troubleshooting session with OP I'm modifying the answer to remove the quotes for "biosdevname"
Edit the following lines in /etc/default/grub
:
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
To:
GRUB_CMDLINE_LINUX_DEFAULT=biosdevname=0
GRUB_CMDLINE_LINUX=biosdevname=0
Next, run sudo update-grub
and then reboot.
After this, you should have the udev
rules persisted in /etc/udev/rules.d/70-persistent-net.rules
and you can edit them as necessary.
Make sure you're changing the right interface by comparing MAC address information properly, e.g. via ifconfig -a
.
Related videos on Youtube
lchristina26
I am a software developer working primarily in C, also completing a graduate degree in computer science with a focus on computer security.
Updated on September 18, 2022Comments
-
lchristina26 over 1 year
I am trying to rename one of my network interfaces from
em1
toeth0
. I do not have /etc/udev/rules.d/70-persistent-net.rules. I have tried to regenerate this file by running these commands:udevadm trigger udevadm trigger --action=add udevadm trigger --action=change
I tested each command individually, rebooted, looked for the 70-persistent file, before trying the next. None of the commands work, as the file is still not there, even after reboot.
I have also tried manually running the /lib/udev/write_net_rules and I get this error:
Cannot lock /etc/udev/rules.d/70-persistent-net.rules!
This is what is in my /etc/network/interfaces file (nothing else):
auto lo iface lo inet loopback
My ifconfig output results in no eth0 interface, but I have an em1 interface that I need to change to eth0. I don't know how to do this without re-creating the 70-persistent file. Any help in either recreating this file or changing em1 to eth0, or both, would be greatly appreciated!
-
lchristina26 over 8 yearsWhen I add that to grub and run
sudo update-grub
I get the error:biosdevname=0: not found
. Am I missing a package or other file? -
Audioz over 8 yearsTry
sudo apt-get install biosdevname
and then runsudo update-initramfs -u
-
lchristina26 over 8 yearsThat did not work, I still get the same error. In full it is :
/usr/sbin/grub-mkconfig: 12: /etc/default/grub: biosdevname=0: not found
-
Audioz over 8 yearsAnd this is after you ran
sudo apt-get install biosdevname
and thensudo update-initramfs - u
? -
lchristina26 over 8 yearsYes. Do I need to reboot after running
sudo update-initramfs - u
and then do ```sudo update-grub`` and reboot again? -
Audioz over 8 yearsYes, you'll need to reboot after installing biosdevname and updating the initramfs
-
Audioz over 8 yearsLet us continue this discussion in chat.
-
lchristina26 over 8 yearsThis solution worked, thanks John Jensen!