cloning linux and the missing eth0

To save some time today, I made a clone copy of an existing Slackware 12.0 installation. I basically booted the Slackware 12.0 host from a Slackware install CD and then did a tar to tar copy to an external USB drive. It all went pretty well. I set up lilo on the new disk and put the disk into the other machine (with an identical hardware spec) and booted it up.

It booted up OK, but I noticed eth0 was missing. I did a ‘dmesg|grep eth’ and sure enough it had found the e1000 network interface on this machine and configured it as eth0. However if I did a ‘ifconfig eth0’, I got:

SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device

Hmmm, very odd. Eventually I did a ‘ifconfig eth2’ and that worked. In this case eth2 was the e1000 network interface on this machine. dmesg did not seem to mention anything about eth2. It only mentioned eth0.

Eventually, I found this post about cloning a virtual machine. Basically it’s all to do this newish udev stuff on most recent linux distro’s. There’s some rule under /etc/udev/rules.d that caches the MAC address of the eth0 interface. On Slackware the file is 75-network-devices.rules. Basically there is a line in that file that says that eth0 has a MAC address of aa:bb:cc:dd:ee:ff. On my new machine, the MAC address is obviously different, so it moves eth0 to the next free interface eth2 (on the old machine eth1 was a wifi card).

So to fix this I just edited /etc/udev/rules.d/75-network-devices.rules, removed the the two old lines relating to eth0 and eth1, and modified the line containing my new MAC address to make sure it says ‘eth0’. Reboot and it’s all fixed.