Archive for August, 2009

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.


Quick SVN Branch

No Comments »

Took me a while to figure out how to make a branch. There is an easy way to do it without even checking out a new local copy. Just:

svn copy https://your.svn.server/svn/location/trunk https://your.svn.server/svn/location/branches/branch_name -m "commit message"

All the work is done on the server. No mess locally and super quick…now I just need to figure out how to merge changes between branches easily


Quick SSH Remote Key Setup For Passwordless Login

No Comments »

Lots of different ways of creating keys and sending them to remote machines so you can login. This is just a quick reference for me and how I do it.

If you haven’t already done so, you need to create keys for your local machine:

ssh-keygen -t dsa

Next, store that key in the remote machine’s authorized_keys file:

cat ~/.ssh/id_dsa.pub | ssh remote-machine 'sh -c "cat - >>~/.ssh/authorized_keys2"'

Now you can just use passwordless login to those machine that you ssh into the most (if it is setup, it is by default for me).


Uninstalling a Python setup.py style project

No Comments »

If you are like me and like to install the newest versions of software and not just settle for the ones available from a package manager, you may have some trouble if you get to a point where you want to uninstall it if that project uses python’s setuptools or disttools for installation.

Using setup.py is wonderful for installing but there is no uninstall option available…pretty sad. I saw that there were options for creating an RPM or Windows installer package from the source but no way to create a .deb for Debian/Ubuntu. So, if you are using an RPM based distro then all you will need is the bdist_rpm command and then install the resulting RPM file.

If you are running Debian or Ubuntu then just do this:

python setup.py bdist_rpm
cd dist
sudo alien -d -c {your_package}.rpm # Make sure you don't use the src RPM
sudo dpkg -i {your_package}.deb

That’s it, now you have installed the package. I haven’t tested this extensively so I don’t know if there are problems because the setup.py file isn’t run with the install parameter so some things may not be configured right, but it should work for the most part.

Also, I have not had much luck with it but you may also want to try out stdeb http://github.com/astraw/stdeb/tree/master