VMware Ubuntu image lost eth0 after moving it

Posted on Monday, March 26, 2012

So you just cloned or moved an Ubuntu machine using the VMware Converter or some other tools, and now it lost its access to the internet and you are wondering why?  After all it’s a clone it should be the same right?

According to this post http://communities.vmware.com/thread/46069 [1] answered by nick.couchman

Some of the newer Linux distributions have a tendency to tie ethernet devices to MAC addresses.  When you generate a new UUID, the MAC address changes, and the distribution doesn't know where to find the interface because the eth0 device that is loaded by the driver differs in MAC address from the device listed in the configuration.  You can try going to /etc/sysconfig/network or /etc/sysconfig/network-scripts and editing the eth0 configuration file.  If a MAC address is listed, compare the MAC address listed in the configuration with the one listed in the ifconfig output.  If they differ, try changing the one in the configuration to match the ifconfig output and reboot.

So now that you find yourself in this situation how do you fix it?

Confirming the problem

First let’s run some commands to confirm the problem

       > ifconfig

My result is

This is missing the eth0 link.

Now we can check to see which ethX is being used after the clone to do this run the following command

       >  sudo lshw -class network | grep “logical name”

Here you can see its now using eth1

Best way to fix this

On Ubuntu the best way to fix this is to remove the /etc/udev/rules.d/70-peristent-net.rules file and reboot.   I found some information on this at the following site http://muffinresearch.co.uk/archives/2008/07/13/vmware-siocsifaddr-no-such-device-eth0-after-cloning/ [2]

So run the following command

       >  sudo rm /etc/udev/rules.d/70-persitent-net.rules
       >  sudo reboot now

As a side note I recently had to do the same thing on a SUSE linux Enterprise 10
The file I had to remove for SUSE was
and reboot

After a reboot run this command to confirm its fixed

       >  ifconfig

Now it’s fixed.

Another Workaround

Another workaround is to edit the /etc/network/interfaces file

       >  sudo vi /etc/network/interfaces

Now update the eth0 to the ethX your system is using in my case it was eth1.

Then restart the network

       >  sudo /etc/init.d/networking restart

Then check to make sure it worked

       >  ifconfig

I show this as a just in case way to fix this.  The best way is to use the first method of removing /etc/udev/rules.d/70-peristent-net and rebooting the server.

Also, since I recently had to do the same thing on a SUSE linux Enterprise 10, I had to edit the SUSE interfaces file.  SUSE 10 does not have a /etc/network/interfaces file instead it has


Where XX is the specific mac address.  You may need to rename the files currently there as the mac address changed to see the mac address you can use the ifconfig -a command again.

In this file you can edit IPADDR= line like so

[1]        Lost eth0 when using a copied Ubuntu-server VM
                6/27/2006, Accessed 03/2012
[2]       Vmware: “SIOCSIFADDR:No such device eth0″ after cloning     
                8/2008, Accessed 03/2012

No comments:

Post a Comment