What is the correct way to restart udev in Ubuntu?

Posted by zerkms on Ask Ubuntu See other posts from Ask Ubuntu or by zerkms
Published on 2011-11-25T00:57:46Z Indexed on 2011/11/25 2:18 UTC
Read the original article Hit count: 333

Filed under:
|

I've changed the name of my eth1 interface to eth0. How to ask udev now to re-read the config?

service udev restart

and

udevadm control --reload-rules

don't help. So is there any valid way except of rebooting? (yes, reboot helps with this issue)

UPD: yes, I know I should prepend the commands with sudo, but either one I posted above changes nothing in ifconfig -a output: I still see eth1, not eth0.

UPD 2: I just changed the NAME property of udev-rule line. Don't know any reason for this to be ineffective.

There is no any error in executing of both commands I've posted above, but they just don't change actual interface name in ifconfig -a output. If I perform reboot - then interface name changes as expected.

UPD 3: let I explain all the case better ;-)

For development purposes I write some script that clones virtual machines (VirtualBox-driven) and pre-sets them up in some way.

So I perform a command to clone VM, start it and as long as network interface MAC is changed - udev adds the second rule to network persistent rules. Right after machine is booted for the first time there are 2 rules:

  • eth0, which does not exist, as long as it existed in the original VM image MAC
  • eth1, which exists, but all the configuration in all files refers to eth0, so it is not that good for me

So I with sed delete the line with eth0 (it is obsolete and useless in cloned image) and replace eth1 with eth0. So currently I have valid persistent rule, but there is still eth1 in /dev.

The issue: I don't want to reboot the machine (it will take another time, which is not good thing on building-VM-stage) and just want to have my /dev rebuilt with some command so I have ready-to-use VM without any reboots.

© Ask Ubuntu or respective owner

Related posts about networking

Related posts about udev