Fix001-ERROR: Ubuntu 12.04 udev changed eth0 to eth1 - PROBLEM SOLVED

ERROR MESSAGES: "network autoconfiguration failed"
"eth0: ERROR while getting interface flags: No such device"
"eth0: error fetching interface information: Device not found"
dmesg "udev: renamed network interface eth0 to eth1"
-PROBLEM SOLVED

Contents:
-Initial problem description
-Initial Solution
-Extended problem description
-Extended Solution
-Further Thoughts
-Footnotes

Initial problem description ↑

When upgrading my Ubuntu 10.04 desktop OS to 12.04 I encountered the following problem: on reboot the network would not automatically configure. Further analysis revealed that my static ip setup on eth0 (ethernet network device number 0 normally viewable when running the command ifconfig from the command line) which is configured in the file - /etc/network/interfaces would only generate error messages when I tried to bring it up with a >sudo ifup -a command from the command line. (NB: the switch '-a' for all network devices but one could simply use eth0 instead of -a for this one device).

Initial solution ↑

After searching for possible solutions I hit upon one person's suggestion to enable the eth1 interface by removing the "#" comment mark in the "#iface eth1 inet dhcp" line in /etc/network/interfaces and rerun sudo ifup -a 1

Voila eth1 came up and I had internet access again. Whew ... a sigh of relief was heard uttered from the captain sitting in his command post ;-)

Further analysis even revealed I could set eth1 up as my static ip2, but this still didn't answer my question ... why eth0 would not come up either as a dhcp (dynamically assigned ip address) or as a static ip ... #$%...!?

Extended problem description ↑

Further internet searching revealed the following intriguing piece of the puzzle: if I grepped (i.e. searched for) 'eth0' in the dmesg bootlog ( >dmesg | grep eth0 ) it revealed that "udev: renamed network interface eth0 to eth1" .....!!!!3 What the... I said?!

Extended solution ↑

Further analysis revealed that the source of this change was udev -the universal device manager which takes the naming of devices out of the hands of the kernel and allows for the hot plugging of new devices. Apparently udev allows for the consistent naming of hardware devices across machines. In my case, I had switched the hard disk from a box with a dead motherboard and put it back in another working box. This switch, if I understand correctly, meant that udev encountered a different ethernet Network Interface Card (NIC) and therefore renamed eth0 identified by the old card's MAC address to eth1 with the new card's MAC address. What is not clear to me is why the network continued to function normally under Ubuntu 10.4 but failed to autoconfigure correctly after the upgrade to Ubuntu 12.04? My best guess is that it is probably due to some changes in the network stack in 12.04.

The source of this eth0 to eth1 change was found in the udev rules config file:

/etc/udev/rules.d/70-persistent-net.rules

and that by either a) deleting this file to have it regenerated by udev on the next boot or by b) commenting4 out the line which renamed eth0 to another MAC address and renaming eth1 to eth0 in the line which assigned eth1 our new hardware MAC address, all would return to normal.

After modifying the above file, when I rebooted eth0 came up as expected with the static address I had declared in /etc/network/interfaces Whew ... another sigh of relief was heard exclamed from the captain sitting in his command post ;-)

Further thoughts ↑

I see that this problem occurs in other linux distros as well that are not debian based, such as Arch and Fedora so it seems the problem was somewhat a result of my own unique Ubuntu 10.04 installation and likely does not affect the general population of Ubuntu users. Nevertheless, in the interest of documenting my fixes for future reference, here is this post.

A bon entendeur ... salut! (A rough translation from french: A word to the wise is hopefully all that will be necessary. ;-)

Michael Wells - 06 May 2013


Footnotes ↑

  1. http://askubuntu.com/questions/146076/network-is-not-working-anymore-ubuntu-12-04  ↑
  2. http://ubuntu-for-humans.blogspot.gr/2009/11/configure-network-interfaces-in-ubuntu.html  ↑
  3. http://starnixhacks.blogspot.gr/2010/09/udev-renamed-network-interface-eth0-to.html  ↑
  4. http://linuxmoz.com/udev-renamed-network-interface-eth0-to-eth1/  ↑
URL: http://michaelwells.org/fix001_udev_eth0_to_eth1.html was last modified: 06 May 2013
Copyright 2005-2024 - Michael Wells - Server time is: Saturday, 21 December 2024 16:39:38 EET