Computer Recycling in Kitchener PXE Setup

From Free Geek Toronto
Jump to: navigation, search

These are lightly-edited notes from our internal documentation on setting up a PXE server.

Contents

Administering network installers

We have a network install server.

This section documents how it is set up, and what you have to do in order to take care of it.

User pnijjar has a zipfile of example scripts that can be used, but cannot upload zipfiles to the wiki!

PXE Booting

General Info

The files you need to worry about live in the /var/lib/tftpboot directory. Some files of note:

  • introscreens/ : text files that specify the text "menus" people see when PXE booting
  • pxelinux.0/default : where the menus (for all screens) are configured. Some options here call the textfiles in introscreens/ to display their options.

One dirty secret: you can actually type any valid option in any screen. You don't have to navigate to the text menu where that option is displayed.

Another dirty secret: I modified these files based on the Debian/Ubuntu installer. That is where I got the pxelinux.0 file and the file structure.

pxelinux.cfg/default

There are lots of parts to this file. Here are a few choice things.

First, to set up the text screens you do this:

DISPLAY introscreens/f1-boot.txt

f1 introscreens/f1-boot.txt
f2 introscreens/f2-hwtest.txt
f3 introscreens/f3-int-linux.txt
f4 introscreens/f4-preseed.txt
f5 introscreens/f5-drivewipe.txt

f9 introscreens/f9-windows.txt

Every option that is bootable needs a LABEL. Here are a few examples:

LABEL autoinstall-cr-mar-winxp
kernel winxp/unattended/linuxboot/tftpboot/bzImage
append initrd=winxp/unattended/linuxboot/tftpboot/initrd

LABEL jaunty
kernel ubuntu/jaunty/i386/linux
append vga=normal initrd=ubuntu/jaunty/i386/initrd.gz -- quiet

LABEL lenny-amd64
kernel debian/lenny/amd64/linux
append vga=normal initrd=debian/lenny/amd64/initrd.gz -- quiet

LABEL memtest
kernel memtest/memtest86

LABEL dban
kernel memdisk
append initrd=dban/dban-1.0.7_i386.ima

Finally, the next two bits mean that the network boot prompt will sit there and not do anything unexpectedly:

PROMPT 1
TIMEOUT 0

Initial setup

I started by getting TFTP booting to install Ubuntu and Debian. There are good instructions here: http://www.howtoforge.com/ubuntu_pxe_install_server

Here are a few additional notes:

  • aptitude install tftpd-hpa dhcp3-server lftp
  • I used pfSense for DHCP -- enable Network Booting. You have to point the bootfile to /var/lib/tftpboot/pxelinux.0

Set up tftpd

  • in /etc/default/tftpd-hpa, TFTP_DIRECTORY="/var/lib/tftpboot"
  • in /etc/default/tftpd-hpa, set RUN_DAEMON to "yes"
  • files go into /var/lib/tftpboot

I had troubles getting this working at first. I needed to use netstat -anp liberally to see what was going on.

PXE-EA1 error

I occasionally got the following error from dumb network cards:

Error: "PXE-EA1: No PXE server found, using static boot file"

http://hiigle.com/rt/pg/30

  • set "-r blksize" as an option in /etc/default/tftpd-hpa
  • echo 1 > /proc/sys/net/ipv4/ipnopmtu_disc (how do you make this permanent?)

In the (probably unlikely) event that this works then you can set it permanently by adding the following line to /etc/sysctl.conf:

net.ipv4.ip_no_pmtu_disc = 1

The solution to this is to use a GPXE boot disk. You can get GXPE by generating an ISO file with "all network drivers" here: http://rom-o-matic.net/

PXE-E32 error

From some network cards I would get the following error: "PXE-E32: TFTP open timeout"

This means that the network card cannot find the TFTP server. This problem goes away if you have the TFTP server on the same machine as the DHCP server.

Again, use GPXE to solve this problem.

Splash Image

I wanted a nice scary splash image for people who accidentally boot into the server.

http://www.mail-archive.com/debian-custom@lists.debian.org/msg01357.html

Matheus Morais <[EMAIL PROTECTED]> wrote:

I'm looking to create my own rle splash image on boot start. How I can do this? GIMP can convert jpg or png in rle?

  1. create a new splash.png file (using gimp or whatever)
  2. convert it to "pnm" by using "pngtopnm" % pngtopnm splash.png > splash.pnm
  3. convert it to "rle" by using "ppmtolss16" % ppmtolss16 "#000000=0" "#ffffff=7" < splash.pnm > splash.rle


Configuring Linux Installations

I mostly followed the procedure here:

http://www.howtoforge.com/ubuntu

pxe install_server

Basically the idea is that Ubuntu (and Debian) have network installers
configured already. You just steal their installation files and put
them into the /var/lib/tftpboot/ directory someplace and claim all
the credit.

If you install lftp then you can first go to /tmp/ and get the
installation directory:

lftp -c "open http://ftp.debian.org/debian/dists/lenny/main/installer-i386/current/ima... mirror i386/"

This will mirror the installer. Then put the i386 folder in
/var/lib/tftpboot/debian/lenny . There are corresponding netboot
directories for Ubuntu as well. You don't need to use this folder
structure, but it makes installing multiple distros and releases much
easier.

If you don't already have the installation files, you can then make
copies of the following to /var/lib/tftpboot/ :

  • pxelinux.0
  • the pxelinux.cfg directory
  • the boot-screens directory (which I renamed to introscreens)

pxelinux.cfg configuration

There are way too many entries for installing Linux in the default
screens. I leave only a straightforward installation entry:

LABEL lenny
kernel debian/lenny/i386/linux
append vga=normal initrd=debian/lenny/i386/initrd.gz -- quiet

Note that I change the paths so they are relative to pxelinux.0.
Because I put installers for different distros in different
directories, I have to modify the lines here.

This gives you the basic interactive installer.

Installing other Linux distros

The pxeboot installers are available for only i386 and amd-64
architectures. You need to download different netboot folders for each
distro release and architecture. (Actually, that is a lie. You only
need initrd.gz and linux, but the other things are small enough
that I do not worry about them.)

The HOWTO linked above has good instructions for all kinds of distros.

DOS/Memtest images

You can take DOS images and Memtest images and boot them using PXE booting.

Memtest

Just install the memtest package and copy the binary to /var/lib/tftpboot. Here is the menu entry:

LABEL memtest
kernel memtest/memtest86

DOS images (.img and .ima format)

These are used by Techiez. They are basically floppy disk images that get copied to memory. To install them first install the syslinux package. Copy the memdisk binary to /var/lib/tftpboot . Then just copy .img/.ima files someplace in the TFTP directory, and make menu entries like the following:

LABEL dban
kernel memdisk
append initrd=dban/dban-1.0.7_i386.ima

LABEL hd-ibm
kernel memdisk
append initrd=techiez/IBMFT.IMG

The memdisk binary just copies the disk images to memory in the same way a kernel gets loaded for booting the system.

UHA format

This is the format used by Hiren's. This is just a compression format. I have not yet gotten it working with PXE booting. Probably the easiest solution is just to unpack the files and repack them somehow. This cannot be done natively in Linux (I think). There are unpacking programs in Windows, though.


Debian Live PXE project

This is the "debian-live" option of the PXE booter.

I developed this on a different box running Debian Squeeze. The scripts are out of date on Ubuntu.

I am mostly following instructions here: http://live.debian.net/manual/en/html/live-manual.html

I am using the "net" variety, which (by default) loads the image via NFS. You can also have the system copy the entire filesystem into memory (which is what the Gparted LiveCD does). This is fine but takes more system memory.

Initial Setup

  • Install Squeeze
  • aptitude install live-build (install "suggests" packages too!
  • aptitude install git-core
  • aptitude install idesk

I track config files with git.

To build:

  • cd debian-live
  • lb clean
  • lb build

Important Files/Locations

  • auto/config : Copy this (and other auto files) from cp /usr/share/live/build/examples/auto/ . You edit this for most of the configuration.
  • config/chroot_local-includes : Contains default files for the system (/etc/skel/ , /etc/sudoers)
  • config/chroot_local-packageslists : Contains lists of programs to be installed. This is where I define cr.list

auto/config

#!/bin/sh
lb config noauto \
       --architecture i386 \
       --packages-lists "standard cr" \
       --linux-flavours 486 \
       --binary-indices false \
       --memtest none \
       --includes none \
       --binary-images net \
       --net-root-path /home/ftp/debian-live \
       --net-root-server 172.26.107.5 \
       --net-root-filesystem nfs \
       --tasks "standard" \
       --mirror-binary http://frogger:3142/ftp.debian.org/debian/ \
       --mirror-bootstrap http://frogger:3142/ftp.debian.org/debian/ \
       --mirror-chroot http://frogger:3142/ftp.debian.org/debian/ \
       --mirror-chroot-security http://frogger:3142/security.debian.org/ \
       --mirror-debian-installer http://frogger:3142/ftp.debian.org/debian/ \
       --archive-areas "main contrib non-free" \
       --hostname "netlinux" \
       "${@}"

See the manual pages (man lh_config) to see what these options mean. (frogger:3142 is the address of our internal apt-proxy-ng server)

The filesystem.squashfs goes into /home/ftp/live

The initrd stuff goes into /var/lib/tftpboot/live-debian so that the initial system can boot.

I have to modify pxelinux.cfg/default as well.

sudo setup

In order to run programs (lshw-gtk) properly you need to be root. So I gave the default user sudo permissions. In config/chroot_local-includes/etc/sudoers.d/00-user I had the following:

user ALL=(ALL) NOPASSWD: /sbin/shutdown, /usr/bin/lshw-gtk
user ALL=(ALL) NOPASSWD: /usr/sbin/gparted

Icons

I got some icons from the Freedesktop project: http://tango.freedesktop.org/Tango_Icon_Library

I use the idesk package to make the desktop icons. I changed the icons to be single-click. Here are the relevant bits of the .ideskrc file:

table Actions
Lock: control right doubleClk
Reload: middle doubleClk
Drag: right hold
EndDrag: right singleClk
Execute[0]: left singleClk
Execute[1]: right doubleClk
end

Desktop icons go into ~/.idesktop/ . Here is an example:

table Icon
Caption: Shut down computer
CaptionTip: Power off computer
Icon: ./system-log-out.png
Width: 32
Height: 32
X: 91
Y: 225
Command[0]: sudo shutdown -h now
end


Preseeding for unattended Ubuntu installations

Preseeding allows you to install Ubuntu or Debian without any user interaction. I don't have it working completely but I can do basic installs.

Basics

The preseed files contain answers to the questions asked by the Debian/Ubuntu installer.

They are stored in /home/ftp/preseed.

pxelinux.cfg line

I found that the "auto" keyword did not work for me. Here is one entry that did work:

LABEL autoinstall-cr-xubuntu
kernel ubuntu/hardy/i386/linux
# This line works, but is long (It is all supposed to be one line)
append vga=normal initrd=ubuntu/hardy/i386/initrd.gz locale=en_CA
debian-installer/keymap=us netcfg/wireless_wep= netcfg/choose_interface=eth0
netcfg/get_hostname=linuxblah preseed/url=ftp://frogger/preseed/./preseed.cfg
DEBCONF_DEBUG=5 --

Basically, you need the extra entries to answer the preseed file before the network has been set up.

the preseed/url entry specifies the location of the preseed file.

FTP Server

In order to get the preseed file and extra scripts I needed an FTP server (not just TFTP) installed on frogger. I used VSFTP. Here are the interesting parts of the file:

listen=YES
anonymous_enable=YES

I do not know how the program knows to look in /home/ftp . There is an "anon_root" option in the configuration file, but I don't set it.

Extra Files

Look in /home/ftp/preseed/preseed-customize

I want extra scripts to:

  • Set GDM autologins
  • Fix the sources.list files.

Resources

This is a big and complicated topic. Here are some of the websites I used:

TODO

  • Add post-install scripts to fix /etc/apt/sources.list. I have the scripts written and everything, but I don't have them configured.
  • Document the tricky parts of the preseed file.