HOWTO Net Boot Ubuntu

From SystemImager

Jump to: navigation, search

Contents

Introduction

This guide describes how to setup Ubuntu 6.06 LTS as an imaging server using SystemImager 3.7.3. This development version of SystemImager includes UYOK which allows you to use your client computer's kernel for imaging which eliminates common hardware compatibility issues.

This How To is meant to be cut and pasted into your terminal. Run all commands from your user's home directory. Adjust as necessary for IP address, your user name, etc.

  • GUIDE WRITTEN: 08/07/2006
  • DISTRIBUTION: Ubuntu 6.06 LTS
  • SYSTEMIMAGER VERSION: 3.7.3 (Development Version as of this Date)
  • Update: 09/11/06
    • Resolved Problem Areas w/ PXE test script
    • Resolved Problems with services auto starting
    • Finished Still To Complete Areas
    • Added sudo to Perl config command

Although we are using Ubuntu as our server you can image, manage, and restore just about any client distribution including Redhat, Debian, Suse, and probably any other. Even Windows if you have to.

Install Ubuntu Server 6.06

This how to was completed using Ubuntu 6.06 LTS Server. Complete the standard installation.

Uncomment Universe Repositories

sudo nano /etc/apt/sources.list

Update Your Server and Configure Network Interfaces

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install openssh-server

Adjust you network interfaces as necessary and reboot.

sudo nano /etc/network/interfaces
sudo reboot

Install SystemImager Dependencies

sudo apt-get install flex uuid-dev libncurses5-dev libreadline5-dev libtool
gettext zlib1g-dev libssl-dev python2.4-dev build-essential systemconfigurator
dhcp3-server netkit-inetd tftpd-hpa tftp-hpa libstdc++2.10-glibc2.2 pxe syslinux
lynx unzip

Download SystemImager 3.7.3 (DEV)

wget http://easynews.dl.sourceforge.net/sourceforge/systemimager/systemimager-3.7.3.tar.bz2
tar -xvf systemimager-3.7.3.tar.bz2
cd systemimager-3.7.3/

Make and Install SystemImager

sudo make all
sudo make install_server_all
sudo make install_boel_binaries_tarball
sudo make install_initrd

Configure Perl

There is an Ubuntu package (libxml-simple-perl) that should provide for this dependency; however, I couldn't get installed. So...

You will have to run through some first time setup - don't worry about ncftpget ncftp just skip

sudo perl -MCPAN -e shell  
cpan> force install XML::Simple

Press q to leave the perl shell

NOTE: Every si_ script that I ran for the first time had some new dependency. I've covered the dependencies for the scripts used in this How To but there are probably more for the entire suite.

Configure PXE Boot Server and DHCP Server

First install pxe daemon

wget http://www.dannf.org/systemimager/pxe_0.1-2_i386.deb
sudo dpkg -i pxe_0.1-2_i386.deb

Run the automated make boot server script.

sudo si_mkbootserver

Important - This is a great script but it's buggy. If it stops at:

"Does tftp server work... no.
I couldn't tftp a test file from localhost
tftp server test failed."

You probably don't actually have a problem - just reboot you're server and re-run the script. It may take some hacking to get through.

Let si_mkdhcpserver run at the end of this command - configure as necessary

Start the rsync Daemon

sudo /etc/init.d/systemimager-server-rsyncd start

If you ever get the error "rsync error - connection refused" you need to start the rysnc daemon.

Add rsync and dhcp to Startup Processes

rsync and dhcp-server aren't starting for me on boot so:

sudo update-rc.d systemimager-server-rsyncd defaults
sudo chmod 644 /etc/dhcp3/dhcpd.conf

Setup Your Client

On your server:

sudo tar -cvf sysimager_client.tar systemimager-3.7.3/

On your client (Adjust as necessary):

sudo scp -r MyUser@MyServerIP:/home/MyUser/sysimager_client.tar /home/MyClientUser/
sudo tar -xvf sysimager_client.tar
cd systemimager-3.7.3
sudo make install_client_all
cd ../
sudo rm -r sysimager_client.tar systemimager-3.7.3/
sudo si_prepareclient --server MyServerIP

Please note: If, when you run si_prepareclient, you receive a stack trace error that begins with "Can't locate Boot.pm in @NIC" or something to that regard, you are missing the "systemconfigurator" dependency. On your client, run:

sudo apt-get install systemconfigurator

Pull the Image to Your Server

On your server (Note - You are creating the images name with this command i.e. ClientImageName):

sudo si_getimage --golden-client MyClientIP -image ClientImageName

At the end of this command you will have to choose your IP assignment scheme.

  1. DHCP - This will assign an IP address to your client via your DHCP server which in this case is your imaging server. You probably want to use this option if you WILL be using SystemImager to keep your client's up to date.
  2. STATIC - The IP address the client uses during autoinstall will be permanently assigned to that client. Maybe usefull for server deployments?
  3. REPLICANT - Choose this method to leave your client's network setting exactly as they were when you imaged the machines. This is probably the method you want to use if you WILL NOT be using SystemImager to keep your client's up to date.

You will now be asked whether you want to add more clients - y/n. If you want to add more clients that will use this image choose yes, otherwise no. I could be wrong but this is my quick take on this option: Choose yes if you are using SystemImager to manage the images of a network of computers - you will need at least their IP address and probably HOST NAMES as well. It is safe to choose no now and use the "sudo si_addclients" command later on. If you are not using this image to manage clients on a network you probably just want to choose no.

Adjusting Your Image After Retrieval

Now you have your image and you want to adjust it.

Dynamic Partitioning

SystemImager allows you to dynamically partition your drive based on percentages rather than MB (size). This allows you to restore the same image to many different hard drive sizes. (Notice ClientImageName should be changed to your image name).

sudo nano /var/lib/systemimager/images/ClientImageName/etc/systemimager/autoinstallscript.conf

This is the disk portion of the file:

<config>

  <disk dev="/dev/sda" label_type="msdos" unit_of_measurement="%">
    <!--
      This disk's output was brought to you by the partition tool "sfdisk",
      and by the numbers 4 and 5 and the letter Q.
    -->
    <part  num="1"  size="98"  p_type="primary"  p_name="-"  flags="boot" />
    <part  num="2"  size="*"  p_type="extended"  p_name="-"  flags="-" />
    <part  num="5"  size="*"  p_type="logical"  p_name="-"  flags="-" />
  </disk>

Notice "unit_of_measurement" is set to %. Partition num="1" is my root partition and it is set to 98%. The remaining partitions are set to * meaning they will fill up the rest of the disk space. After you hav adjusted your percentages and partitions appropriately use the following command to update the images installation script:

sudo si_mkautoinstallscript --image ClientImageName --force --ip-assignment replicant --post-install beep

Type si_mkautoinstallscript --help for detailed information on the options I provided above.

Making Adjustments to Your Image

Your image is located in /var/lib/systemimager/images/ClientImageName

If you run:

ls /var/lib/systemimager/images/ClientImageName

You will see it is simply your images file system. You can modify files in here as you would if it were on the computer. You can also chroot into the image and run commands as if you were on a live system. More on this once I've done it.

Complete PXE Boot Setup

Finally we need our clients to boot off of the server and provide a menu with your different images available.

First setup the /tftboot/pxelinux.cfg/default file:

sudo nano /tftpboot/pxelinux.cfg/default

In the following example file LABEL 1 boots from the computer the hard disk and doesn't load an image. LABEL 2 uses the kernel and initrd.img from image ExampleImage1 and if chosen loads ExampleImage1 on the machine. LABEL 3 uses the kernel and initrd.img from image ExampleImage2 and if chosen loads ExampleImage2 on the machine. Next we will copy the kernel and initrd.img from the image and setup the menu list that appears when you boot from PXE.

#### located in /tftpboot/pxelinux.cfg/default

DISPLAY pxelinux.cfg/message.txt
PROMPT 1
TIMEOUT 0

######################

LABEL 1
  LOCALBOOT 0 

LABEL local
  LOCALBOOT 0 

######################

LABEL 2
  KERNEL kernel_ExampleImage1
  APPEND vga=extended initrd=initrd.img.ExampleImage1 root=/dev/ram IMAGENAME=ExampleImage1 HOSTNAME=ubuntu

LABEL ExampleImage2
  KERNEL kernel_ExampleImage1
  APPEND vga=extended initrd=initrd.img.ExampleImage1 root=/dev/ram IMAGENAME=ExampleImage1 HOSTNAME=ubuntu

######################

LABEL 3
  KERNEL kernel_ExampleImage2
  APPEND vga=extended initrd=initrd.img.ExampleImage2 root=/dev/ram IMAGENAME=ExampleImage2 HOSTNAME=ubuntu

LABEL ExampleImage2
  KERNEL kernel_ExampleImage2
  APPEND vga=extended initrd=initrd.img.ExampleImage2 root=/dev/ram IMAGENAME=ExampleImage2 HOSTNAME=ubuntu

######################

Copy the Kernel and initrd.img Used to Boot

Using the kernel from your image eliminates hardware incompatibility issues. The kernel and initrd.img from your image is used to PXE boot the client machine and load the image. Notice where we are copying the kernel and initrd.img files to and that we are renaming them to match the above default file. You need to do this for each image you create.

ExampleImage1 Kernel and initrd.img

sudo cp /var/lib/systemimager/images/ExampleImage1/etc/systemimager/boot/kernel /tftpboot/kernel_ExampleImage1
sudo cp /var/lib/systemimager/images/ExampleImage1/etc/systemimager/boot/initrd.img /tftpboot/initrd.img.ExampleImage1

ExampleImage2 Kernel and initrd.img

sudo cp /var/lib/systemimager/images/ExampleImage2/etc/systemimager/boot/kernel /tftpboot/kernel_ExampleImage2
sudo cp /var/lib/systemimager/images/ExampleImage2/etc/systemimager/boot/initrd.img /tftpboot/initrd.img.ExampleImage2


Create Your Menu List

Your menu list is what is seen when you boot from PXE. It allows you to choose the image you will be loading onto the client machine.

sudo nano /tftpboot/pxelinux.cfg/message.txt

The following example file will appear when you boot from PXE. Notice the numbers correspond to LABEL 1 / LABEL 2 / LABEL 3 and so forth.

located in /tftpboot/pxelinux.cfg/message.txt

Welcome to SystemImager

1.) local (Hard Disk)

2.) ExampleImage1

3.) ExampleImage2

STILL TO COMPLETE

Where the help docs are - /usr/share/doc/syslinux/ etc.

Personal tools