Posts Tagged ‘imaging’

Set up SLES/SuSE for imaging or as a virtual machine

No Comments »

I test software on SLES/SLED machines and it is always a pain trying to prepare images for re-use in other locations. SuSE uses hardware specific IDs for booting and configuring network interfaces by default so if you try to make an image and use it on another machine you are out of luck. Also, making VMWare images and cloning them creates all new hardware IDs as well so no cloning of the VMs either. Today I finally found a good way to fix all these problems so that network interfaces are set up automatically upon boot for DHCP and GRUB won’t boot using the /dev/disks/by-id/ location but just the /dev/sdaX location.

I found these tips on the Novell Cool Solutions page. One from http://www.novell.com/communities/node/1516/imaging-sled-10-sp1-workstation and another from http://www.novell.com/communities/node/5789/automatic-network-configuration-and-edirectory-configuration-bootable-vmware-images.

There are just two general steps that need to take place. First, make it so GRUB boots using the device name and not the device ID. To do this:

  1. Open Yast
  2. Navigate to System -> Partitioner
  3. For each partition that will be mounted click Edit, Fstab Options, and select Device name rather than Device ID
  4. Apply those settings
  5. Now open Yast -> System -> Bootloader
  6. For each entry click edit and for the root device select the proper device name
  7. Apply those settings and you are done

The second issue has to do with the device ID of the network card changing and so it is not configured for DHCP on boot. To make all your network interfaces configure automatically with DHCP on boot you need to be able to generate ifcfg-eth-id network configuration files for the interfaces on boot. To do this

  1. Download this buildeth0 script from (This was taken from a set of scripts on the second Novell link above)
    1. If you are running SLES/SLED 11 then download this script and rename it to buildeth0
  2. Copy the script buildeth0 to /etc/init.d/. Be sure to chmod 755 the script so it will execute.
  3. Now, add the script to the default run-levels rc3 and rc5 by running “chkconfig -a buildeth0″

This script requires that the persistent names are enforced and generated when your machine boots. This is already on by default in SLES/SLED. When the machine boots it will check all the devices connected and create persistent names for any ethernet device in /etc/udev/rules.d/30-net_persistent_names.rules. The script will check that file for any entries. It will then check to see if each of those entries have configuration information setup in /etc/sysconfig/network/ifcfg-eth-id-… if not it will generate that file automatically and configure the interface with DHCP. When the network is setup it will see the configuration there and configure the interface with DHCP.

To prepare for taking an image you should remove all the configuration information already setup for your machine so that when the new device boots it doesn’t wait for non-existing interfaces to be set up.

  1. rm /etc/sysconfig/network/ifcfg-eth-id*
  2. Edit /etc/udev/rules.d/30-net_persistent_names.rules and remove any SUBSYSTEM==”net” lines. (Don’t just comment them out)

That’s it, just shutdown and take a snapshot/image of the machine.