Cobbler setup script – problem with restarting service and rebuilding configuration

Writing a bash script for an easy and fast setup of Cobbler environment took a while. But the need to get it done – our project needs frequent and painless network installations of Ubuntu on 20-30 machines, took over my ambitions for the afternoon as a seemingly easy task and just swallowed my whole evening.

The problem: running the script was not completely setting up the environment, although it contained same commands as i have been manually inserting into the terminal, the output was returning that cobblerd does not appear to be running/accessible, though the script was deliberately staring the service after the installation with
sudo service cobbler start

After several hours of experimentations on different machines I realized that the problem is that restarting cobbler service and rebuilding it with
sudo service cobbler restart
sudo cobbler sync

SHOULD NOT BE RUN WITHOUT ANY TIME INTERVAL IN BETWEEN, apparently the service restart takes a bit more than it seems, so when the next command is issued to rebuild the configuration the service appears to be [still] inaccessible.

The solution is to include a short (1 second) timeout in between:
sudo service cobbler restart
sleep 1
sudo cobbler sync

The script has been tested on several machines in our university lab. Running it:

  • sets up cobbler
  • configures the environment for network installation of Ubuntu Alternate 11.04 in lab’s LAN
  • powers on all the computers in the LAN and installs Ubuntu Alternate on them

Yes, all in one script. It is available in AwaseConfigurations github repository.

, , ,

  1. #1 by Tero Karvinen on October 31, 2011 - 3:45 pm

    You should probably ‘sudo apt-get update’ after modifying sources.list with ‘software-properties-gtk’.

    • #2 by armens movsesjans on October 31, 2011 - 3:55 pm

      true. in ubuntu 11.04 universe is already enabled after the installation, so it went unnoticed, thanx!

Leave a comment