Network issue with cloning a CentOS 6 VM

As a mentioned in previous posts I have created a simple script that would clone/configure a KVM guest based on existing templates. The scripts can be found in my github https://github.com/mrdimka/kvm-scripts . When I tried to launch a CentOS 6 VM I ve noticed that eth0 was not configured and was failing.

I ‘ve logged on the VM and started debugging what might be wrong.
First I tried to start network with executing

# /etc/init.d/network restart
Shutting down loopback interface:
Bringing up loopback interface:
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.
RTNETLINK answers: File exists

I ‘ve researched and found that the problem was caused by udev rules defined in file /etc/udev/rules.d/70-persistent-net.rules
I mounted my template image and removed the 70-persistent-net.rules file with the following commands

# kpartx -a centos6-default.img
# mount /dev/mapper/loop0p1 /mnt/sdb/mounts/tmpkvm
# rm -rf /mnt/sdb/mounts/tmpkvm/etc/udev/rules.d/70-persistent-net.rules
# umount /mnt/sdb/mounts/tmpkvm
# kpartx -a /dev/mapper/loop0p1
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s