Sanitation Guide: PXE Over the Network

×

Status message

If you have any questions about this page or if you find any errors, please write a message to the support wall and a Labdoo volunteer will help resolve it. Thank you for helping to improve our wiki pages.
Tags: 

Introduction

This wiki will lead you through the process of sanitizing Labdoo laptops using ready-to-use images from the network. It allows you to sanitize laptops using a fast and efficient cloning process and is also very helpful if you are dealing with a large number of laptops. However, this process is quite more complex at the same time and that is why we consider it an advanced method. If you are new to Labdoo and do not have much experience with computers, we recommend you to use the Simple Sanitation Method, but if you are up for learning a great way to install a powerful software in a computer, this is your guide.

Images are a complete software copy of an installed Labdoo computer containing everything, from the operating system, software, educational content to al optimized settings. The cloning process takes care of everything for you in one shot, except for adopting the final configuration to the country of the destination edoovillage (language and keyboard) and setting the hostname.

In the next section you will find a step by step description of the Sanitation process based on images.

How to use a Labdoo PXE server to sanitize laptops

[Note: This section assumes you have a Labdoo PXE server with you (because you either created one by following the instruction in the section below "Steps to create a new Labdoo PXE server" or because another hub gave you the Labdoo PXE server so that you can use it to sanitize your laptop)]

If you already have a Labdoo PXE server, please read the "PXE Process in detail" document that you can download from this link. This guide explains step by step how to use the PXE server to sanitize laptops. You can also download from this link the "Labdoo Process Slip", a handy slip which will allow you to track each laptop technical description as explained in the "PXE Process in detail" document.

Steps to create a new Labdoo PXE server

# Installbox
########################################

The Installbox set-up allows you to automatically install Linux clients on a large scale.

### Pre-Requirements

- A laptop with wireless LAN and gigabit ethernet port
- A gigabit switch
- Network cables to connect the clients
- Wireless internet access where you are NOT using the IPv4 network address 192.168.20.0/24

# Installbox Setup
########################################

- Download the customized ISO image: GET-LATEST-VERSION-FROM-WEB.iso
- Either burn the image to a CD or write it to a USB key using dd if=debian-jessie-installbox.iso of=/dev/sdb
(replace sdb with the device node of your USB stick, if necessary).
- Boot the laptop using the CD or the USB stick.
- Please do not connect the ethernet cable yet.
- Select the option "Install" during boot.
- You will be asked to select the keyboard layout, select the one that fits best for you.
- During network set-up please select the wireless interface. There should be two interfaces on the list:
eth0 (which is ethernet, don't select this one!) and wlan0.
Note: If you do not see those two interfaces here, please abort the installation process. It means that your device is not supported.
- When you have selected wlan0, the installer will search for wireless networks available. Select your network.
Most modern wireless networks use WPA/PSK for authentication, so if you are not sure, you can select this option.
- Type in your Wireless password in the next step. Please note that it is displayed in a clear text.
- Relax, the rest of the installation should work fully automated.
- After a while the device reboots, so you can now connect an ethernet cable from the laptop's installation box to the gigabit switch.
- You should now be able to connect any client to the switch and select ethernet boot.
On Lenovo, you can press F12 and choose the network interface as a boot device.
- On the install box, an NFS export has been created on /exports.
This will be available to all clients on the LAN and should contain the Clonezilla images.

# PXE Boot Options
########################################

When you boot a client, the boot menu will show the following options:

- Clonezilla Autorestore x86
This should be started on a client where you want to apply the default image. No interaction needed, all existing data will be deleted.
It will restore an image called Linux-x86 which must be available in /exports on the install box.

- Clonezilla Autorestore x86_64
Same as Autorestore x86 but for the 64bit variant. It will automatically restore an image called Linux-x86_64

- Preseed x86
Prepare a 32bit master installation

- Preseed x86_64
Prepare a 64bit master installation

- Clonezilla Autosave x86
Create an image of a master installation. It will automatically be written to the NFS share /exports under the name Linux-x86.
Note: This will overwrite an existing image of the same name in the install box.

- Clonezilla Autosave x86_64
Same as Autosave x68 but for the 64bit variant. It will automatically write a disk image to the install box at /exports/Linux-x86_64.
Note: This will overwrite an existing image of the same name on the install box.

- Clonezilla Live
Just the default live image with all options and the NFS share already mounted.

- SystemRescueCD
A universal system recovery toolbox. It also contains GParted for manual partitioning.
To start GParted, simply type startx and then click on the GParted icon in the taskbar.

- Boot and Nuke
starts dban and will automatically wipe all data on disk.

Note: you can press the tab key on all options in order to change settings manually.
To permanently adjust the file, edit /var/lib/tftpboot/prd/pxelinux.cfg/default on the installbox.

# Workflow
########################################

After you have set up the install box a typical workflow would be the following:

1. Create a master image

- Choose another laptop on which you want to create the master image.
- Connect the laptop to a port on the gigabit switch.
- Follow the steps described in the 'Prepare Master Image' section.

Alternatively, you can download a prepared master image. See the 'Image Creation Cutoff' section below for further details.

2. Provision laptops with the newly created master image

- after the master image has been stored on the install box, choose the relevant Clonezilla Autorestore option from the PXE menu

Once you have created a master image, there is no need to re-create it other than changes that need to be done to it.
Next time, you can just start provisioning clients using the Autorestore option.

Hint: if you are not sure, just create a master image for the x86 architecture. This should work on nearly every machine.

# Image Creation Cutoff
########################################

If you do not want to prepare an image on your own, you can download the prebuild image for the x86 architecture.

To do so, execute the following commands in the install box:

sudo wget -c GET-LATEST-VERSION-AS.tar.gz -O /exports/linux-x86.tar.gz
sudo tar xvzf /exports/linux-x86.tar.gz -C /exports/

Note: the image to download might take a long time, it depends on your internet connection.
If the download is interrupted for some reason, you can resume it by executing exactly the wget command from above again.

This image is set up for the Swiss-German keyboard layout. If you want to customize it:
- Deploy a machine using the 'Clonezilla Autorestore x86' function.
- Boot it and make your customization.
- Boot the SystemRescueCD and start GParted.
- Shrink the root partition to ~ 30000MB.
- Remove any existing version of the image by running sudo rm -rf /exports/Linux-x86 on the install box.
- Reboot the client that contains your modifications and select the Clonezilla Autosave option for x86.
This will save your modified version to the install box.

# Prepare Master Image
########################################

In order to develop a master image from scratch, please make sure that the install box in your laptop has a working wireless LAN internet connection.

### Preseed

On a client that connects to the gigabit switch, start the pxe boot and select either Preseed for x86 or x86_64.
This will set up an install base of ubuntu with a user "Labdoo" and a password "Labdoo".

After preseeding, boot into the newly installed system and apply the customization from:

http://ftp.labdoo.org/download/install-disk/installskripts/

If you want to modify the preseed file, e.g. to set up a different user account, just edit /var/lib/tftpboot/trusty/preseed.cfg

Hint: To change the keyboard layout (which defaults to us), simply run dpkg-reconfigure keyboard-configuration after installation.

### Creating the Image

When the client has been set up according to your needs, reboot and select the relevant Clonezilla Autosave option that fits best the architecture of your master set-up.

This will automatically save an image to the install box that will be applied later to other clients using the Clonezilla Autorestore function for that architecture.

Note: This automated process has been optimized for image installations on systems with at least 40GB HDD/SSD of space.
If you need to install it on machines with smaller disks, please shrink the root partition before creating the image.

# Image Requirements
########################################

If you do not want to use the images that eventually work with the install box setup, please make sure that your images
fulfill the following requirements:

- images should be deployed automatically using this setup and must have the following partition layout:
/dev/sda1 - swap (suggested size 2GB)
/dev/sda2 - root / ext4
- after the master preparation, please shrink the root partition to its minimal size possible.
This ensures that the image will be deployable on small drives as well.

# Resetting the Installbox
########################################

You can reset the changes made to the install box default settings at any time by running /usr/local/sbin/applypuppet as root.

# Making of the Installbox ISO
########################################

This step is not necessary, it is just for informational purposes. It describes how the ISO for the install box was created.

apt-get install -y bsdtar genisoimage syslinux-utils
cd ~
rm -rf cd
mkdir cd
wget GET-LATEST-VERSION-FROM-WEB.iso
bsdtar -C cd -xf firmware-8.2.0-i386-netinst.iso
vi cd/isolinux/txt.cfg
- append vga=788 initrd=/install.386/initrd.gz --- quiet
+ append vga=788 initrd=/install.386/initrd.gz url=GET-LATEST-VERSION-FROM-WEB.cfg locale=en_US.UTF-8 ipv6.disable=1 debconf_debug=5 netcfg/get_domain=domain.example netcfg/dhcp_timeout=60 netcfg/get_hostname=installbox --- quiet
quit vi with ESC :wq!
vi cd/isolinux/gtk.cfg
- append vga=788 initrd=/install.386/gtk/initrd.gz --- quiet
+ append vga=788 initrd=/install.386/gtk/initrd.gz url=GET-LATEST-VERSION-FROM-WEB.cfg locale=en_US.UTF-8 ipv6.disable=1 debconf_debug=5 netcfg/get_domain=domain.example netcfg/dhcp_timeout=60 netcfg/get_hostname=installbox --- quiet
quit vi with ESC :wq!
cd cd; md5sum `find ! -name "md5sum.txt" ! -path "./isolinux/*" -follow -type f` > md5sum.txt; cd ..
genisoimage -o debian-jessie-installbox.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./cd
isohybrid debian-jessie-installbox.iso

# Additional Notes
########################################

- There is a script available on the installbox called /usr/local/sbin/pxesync.
It can sync the files needed for PXE boot for the Ubuntu and Debian distributions.

# Changelog
########################################

20150930 v0.2
- added prebuild image

20150928 v0.1
- initial setup


Continue reading under this section:
Information for Labdooers (Volunteers)