VMware Communities
adamsi
Contributor
Contributor

lost eth0 when using a copied ubuntu-server vm

Hi,

I installed an ubuntu-server 6.06 as guest os and every thing is fine. But when I copy the vm to another location on disk, the guest os were not able to find the network adapter and lost its eth0. I ran ifup eth0 but got a "No such device". copy it back to the original directory then everything is ok. I tried changing default vlance to intel pro/1000 and changing NAT to bridged networking, none of them worked. WinXP or Xubuntu desktop don't have this problem. What's wrong? Vmplayer's problem or ubuntu-server's ? Host os is ubuntu-desktop 6.06

Adam

Reply
0 Kudos
28 Replies
kingneutron
Expert
Expert

When vmplayer complained that the VM's location changed, did you click Keep or Create?

After moving/cloning a VM, you should Create a new MAC address for it. Also:

' less /var/log/messages ' and see if any errors come up with network drivers, eth0, etc.

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA
Reply
0 Kudos
adamsi
Contributor
Contributor

Thank you for your reply Smiley Happy

vmplayer didn't ask the "location changed" question. I've expected it to ask but nothing happened, the vm just started up.

Reply
0 Kudos
nick_couchman
Immortal
Immortal

On the guest, try "dmesg | grep eth0" and see if there are any messages about the Ethernet device. If not, try running "modprobe e1000" or "modprobe pcnet32" to see if you can manually load the driver. Finally, try "ifconfig -a" and see if eth0 is listed in the list of all available network interfaces on the machine.

Reply
0 Kudos
nome
Contributor
Contributor

I probably have the same issue.

Copied the guest to a new directory, opened it, created new uuid, and started the new guest.

Dmesg looks ok, eth0 is there (pcnet-something), it is in ifconfig, but can not ifup it.

I thought it could macaddress problem, changed it in the .vmx file, rebooted, and it came up as eth1.

I made another copy of the original, and changing eth0 to eth1 in /etc/network/interfaces made it work after ifup eth1. (probably with the same mac as original guest, if mac isnt changed at the same time as uuid.

host and guests are ubuntu 6.06 server.

host is standard install , but upgraded (current) yesterday

Reply
0 Kudos
nick_couchman
Immortal
Immortal

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.

Reply
0 Kudos
Stonekeeper
Contributor
Contributor

Here is a script that should sort you out. I ran into the same problem and this was my way of fixing it. I'm sure it's not the best, but it works. Save it (I called it "fixmac") and put into /usr/sbin/ on your "base machine". Then, after shutting down and copying your base machine, boot the new machine, log in, and execute "fixmac" as root. Reboot and your interface should start working.

\---- Start Script -


mac=`ifconfig -a | grep "HWaddr" | cut -d " " -f 11`

echo "eth0 mac $mac arp 1" > /etc/iftab

\---- End Script -


I hope that helps!

Reply
0 Kudos
Eric_B
Contributor
Contributor

I ran into the same problem after copying a Linux vmware image to another location. When I tried to enable the NIC, I received an error message like device eth0 has a different MAC address than expected. The fix was to edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file to update the HWADDR line to match the MAC address found in the image's VMX file (the MAC address can be found on the line ethernet0.address=XX:XX:XX:XX:XX:XX).

Reply
0 Kudos
AndyTakacs
Contributor
Contributor

Here is a script that should sort you out. I ran into

the same problem and this was my way of fixing it.

I'm sure it's not the best, but it works. Save it (I

called it "fixmac") and put into /usr/sbin/ on your

"base machine". Then, after shutting down and copying

your base machine, boot the new machine, log in, and

execute "fixmac" as root. Reboot and your interface

should start working.

---- Start Script ----

mac=`ifconfig -a | grep "HWaddr" | cut -d " " -f 11`

echo "eth0 mac $mac arp 1" > /etc/iftab

---- End Script ----

I hope that helps!

Quoted because this solution fixed a cold migration of an Ubuntu 6.06 (LAMP) server from ESX 2.52 --> ESX 3.0.1. Initially the server showed no known interfaces even after upgrading VMTools. After this script ran and the VM was rebooted eth0 was back up and running normally.

It did help, thank you!

Reply
0 Kudos
pjgi4d
Contributor
Contributor

I had this same problem after I downloaded and tried to start this appliance:

http://www.young-technologies.com/Software/Subversion-Virtual-Machine/

ifconfig only reported lo

ifconfig -a reported a eth1 and lo, but no eth0

By changing the MAC in /etc/iftab to match the new one generated when I opened the appliance (Stored as ethernet0.generatedAddress in the .vmx file), it worked after reboot.

Thanks so much for a concise and accurate solution.

pjgi4d

Reply
0 Kudos
RainerLfBS
Contributor
Contributor

Hi,

your problems sound exactly like the problem we ran into when cloning a Debian installation.

The root of the problem at our site was udev's handling of devices. Udev keeps a history of devices attached to the computer. What makes sense for i.e. USB sticks (that is, each USB stick you attach will be recorded and mounted to the same point when attached again at a later point in time), causes problems when systems are cloned.

There is a file /etc/udev/rules.d/z25_persistent-net.rules, where udev memorises, which hardware device should get named eth0. Here it looks like this:

\# PCI device 14xx:16xx (tg3)

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", SYSFS\{address}=="00:11:xx:xx:xx:xx", NAME="eth0"

When you run the image on another computer, the new network adapter is recognised on the PCI bus and a new entry in the above mentioned file is generated. "eth0" is already given to device 14xx:16xx, so the new device gets named "eth1".

If you delete this file, it will be rebuilt during the next system startup and your problem should go away.

Regards,

Rainer

Reply
0 Kudos
jjmateu
Enthusiast
Enthusiast

Hi:

Yoy need create a new mac address and the answer is here:

http://www.vmware.com/support/ws55/doc/ws_net_advanced_mac_address.html

After that, probably you must delete and create again the ethernet adapter in the guest and configure it using the hardware tool that provide by the Operating System.

Reply
0 Kudos
roeschu
Contributor
Contributor

just want to add that i had the same problem migrating a ubuntu guest from a vmware server to a esx server.

After migration the eth0 device was not present.

Solution was for me too, to see after the HW Adress in the new vmx file and write this HW Adress in /etc/iftab.

hope this helps other people too.

thx a lot + greets

Reply
0 Kudos
lilboy716
Contributor
Contributor

I have read through some of the previous posts and provided a step by step way to fix this.

I'm running Ubuntu, as guest & host

The Fix:

ifconfig -a

the "new" ethernet adapter may show up as eth1

write down the mac address: xx:xx:xx:xx:xx

cd /etc/

sudo vim iftab

change the existing mac address to your "new" ethernet adapter MAC address...

crossing my finger (I am writing this while I am making the changes)....

...

ping google.com

GREAT SUCCESS!

here are some other solutions to problem I've faced using VMWare Player

http://www.google.com/notebook/public/06509517885347462852/BDSrpIgoQ2vrxhvwh

Message was edited by:

lilboy716

Reply
0 Kudos
einjen
Contributor
Contributor

Thank you!

this is infact the REAL solution...... for debian at least

Reply
0 Kudos
metrolinux
Contributor
Contributor

For Ubuntu (6.06LTS) it's:

sudo cp /etc/udev/rules.d/25-iftab.rules /etc/udev/rules.d/25-iftab.old

sudo rm /etc/udev/rules.d/25-iftab.rules[/b]

Did the same trick. Thanks for helping point me in the right direction, Rainer !

Reply
0 Kudos
axl
Contributor
Contributor

If you delete this file, it will be rebuilt during

the next system startup and your problem should go

away.

rainer,

thank you very much; i ran into this problem several times (newer debian sarge and etch) and this solution works pretty well!

cu

axl

Reply
0 Kudos
cwheeler33
Contributor
Contributor

I had the same problem with Gentoo

The Debian solution was very close to what I needed. Here is what I had to do.

Edited the following file

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

changed the MAC address to that listed in the .vmx file.

If you delete the file instead, it will recreate the file and add the new MAC address but will assign it to eth1 after the reboot. You will then need to go into the file and change it to eth0 and then reboot again.

Reply
0 Kudos
mieslep
Contributor
Contributor

Just had a similar problem with RedHat Enterprise Linux 4 (RHEL4). These files don't exist, but I was able to determine that "/etc/init.d/network restart" solved my problem. My recollection from Ubuntu is that the method should work there too.

Reply
0 Kudos
gjstory
Contributor
Contributor

I ran into this today as well. ifconfig -a did not show eth0. I did some things based on earlier posts before I got to the removal suggestion of the /etc/udev/rules.d/25-iftab.rules file. I originally made changes to iftab and interfaces to reflect eth1 instead of eth0. That did work like a charm until I ran apt-get upgrade. I lost eth1. ifconfig -a showed eth0 had returned. I restored the backup of iftab and interfaces so eth0 was back. I also rename /etc/udev/rules.d/25-iftab.rules to /etc/udev/rules.d/25-iftab.rules.old. A reboot later and all is well. Thanks to everyone for their suggestions.

Reply
0 Kudos