Clone Ubuntu VMs in VirtualBox

Update: I found a permanent workaround for the udev ethernet interface problem. See this post.

I installed Ubuntu from mini.iso and I want to make several copies. What are the potential pitfalls? Well, the only real problem is that if we’re not careful they’ll all have the same MAC address. There’s a checkbox to avoid this in VirtualBox,

Reinitialize the MAC address checkbox

What a convenient checkbox!

which gets you halfway there, but when you boot your new system it will still remember that eth0 was that old MAC address. What’s worse is it will stall for over a minute while booting and tell you it’s waiting for network configuration…

Waiting up to 60 more seconds for network configuration

AAAAHHHHHHHHHHH!!!!

Update: I found a permanent workaround for the udev ethernet interface problem. See this post.

The easiest way to get through this is just to wait it out. Eventually you’ll get a login prompt. When you do, log in. Now you want to edit your udev rules so that you’re newly generated MAC address maps to eth0. That’ll fix everything.

sudo vi /etc/udev/rules.d/*-persistent-net.rules

Mine looks like this

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:11:7c:8b", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:03:8e:5a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

I’m just going to delete the old eth0 entry (the first one) and change the name of the new one to eth0.

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:03:8e:5a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

A quick reboot and everything’s shiny. :)

This entry was posted in VirtualBox and tagged , , , . Bookmark the permalink.

7 Responses to Clone Ubuntu VMs in VirtualBox

  1. Hey! Thanks for this tip. I actually have a VM I’ve placed into a flash drive that I plan to operate out of. This tip most likely saved my sanity. Now, I just have to figure out how to avoid having to delete the udev each time I close shop :/

  2. Pingback: Prevent Virtual Machines from Saving Network Interface udev Rules | splat operator

  3. Chema Gallego says:

    Great !! It works for me :)

    Thanks

  4. vijay says:

    thanks so much for this. saved me a lot of headache.

  5. Gokul says:

    Thank you so much … was getting frustrated with this as well. This post got me back on track.

  6. Alber says:

    thanks, works for as well

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>