I just recently set up a development environment for Rails on Ubuntu 9.10 so that I could move towards using Apache and Passenger which would more closely resemble my production environment. After installing Ubuntu on a VM under Parallels Workstation 2.2 build 2222 I decided to clone that VM before configuring Apache and Passenger to match my production environment. That's when I ran into a little snag. After creating the clone of the fresh Ubuntu install I noticed that I didn't have a network connection. Unfortunately everything seemed fine until I tried to install the Rails gem and it complained.
Upon further investigation I noticed that the network interface was down. I tried running:
"sudo /etc/init.d/networking restart"
This displayed the error "
SIOCSIFADDR: No such device" referencing eth0.
(This of course means no network connection which in turns makes it bit more challenging to install the gems needed for my Rails applications.) In any event, I was able to locate several posts (see a couple references below) that ultimately lead me to a solution. It turns out that the clone has a new MAC address (as it should) and Ubuntu (or at least some part of it) was keeping track of what MAC address belongs to each interface. When I first had this problem I tried running "
ifconfig" to see what was going on. The only thing showing was the loopback connection.
One of the posts I read suggested running "
ifconfig -a" which actually shows all interfaces (up or down) and this tipped me towards the real problem.
NOTE: I'll be using the -a forever now. No point in seeing just half the picture.
These posts also suggested that a file located in the folder
/etc/udev/rules.d contains the persistence rules for the network interface. In my case that file was a file named "
70-persistent-net.rules". I removed that file, restarted the VM, and the problem was solved! That file was re-created with the correct MAC address for eth0. I suppose you could manually edit the file to contain the correct MAC address for eth0 and remove the eth1 entry but I didn't try it since the file is automatically created.
I hope this helps someone!
REFERENCES
http://ubuntuforums.org
http://www.amazium.com/blog