Jan 292012
 

SystemRescueCD is very useful to have on hand for those issues that come up at the worst times. Instead of having to dig for that USB key or CD that SystemRescueCD is on, I’ve setup my PXE server with SystemRescueCD to save time on having to find where I’ve put the CD. It also means that when SystemRescueCD is updated, all I need to do is update the files on my PXE server instead of having to burn a new CD or install it again on a USB key which means less clutter for me which is always good.

The only downside to booting over the network is the time it takes to boot if you’re still on good ol’ 100 megabit “Fast” Ethernet as SystemRescueCD weights in at just over 300 megabytes, which also means the system that you’re network booting on must have at least 512 megabytes of ram in order to network boot SystemRescueCD as all the data is stored in RAM when you networkboot.

Anyways, onto the nitty grittys.


Step 1 – Getting the SystemRescueCD files

We need the ISO file that contains the files we will need to PXE boot SystemRescueCD which can be downloaded from here.
Once we have the ISO file, we need 4 files off the ISO file, which are –

  • initram.igz – this is the initial ramdisk that SystemRescueCD uses to boot
  • rescuecd – This is the kernel that SystemRescueCD uses, however there are other options that can be used.
  • sysrcd.dat – This contains the squash file system that becomes the root filesystem for SystemRescueCD
  • sysrcd.md5 – This is the signature file for SystemRescueCD, and isn’t actually needed, but good idea to have.

Once we have these 4 files, we need to place them onto our PXE server. I have used the directory /tftpboot/srcd for my files on the server.

Step 2 – Configuring the PXE Server

We will need to edit the file that contains the configuration for the PXE server. If you have been following my PXE Server guide then the file is called default in the pxelinux.cfg directory.
Using your favourite text editor, add the following lines to the configuration file –

LABEL SRCD
MENU LABEL SystemRescueCD 2.4.1
kernel srcd/rescuecd
append initrd=srcd/initram.igz netboot=tftp://10.1.1.1/srcd/sysrcd.dat

The last two lines will need customisation to your setup if you use a different kernel, or the IP address of your PXE server is different, as will the path for the kernel, initram and netboot parameters.

Once the configuration file is updated, you should now be able to boot SystemRescueCD over the network with little difficulty, however if the network has some issues you may find it will take a little while as the TFTP protocol sends data over UDP which does not support resending corrupted data.

Share

Jun 132011
 

Hi All,

I’ve recently been playing around with some small distributions so I can setup a tiny webcam server – no luck there yet, but I thought I’d post up how to boot Puppy over PXE as I tried that out while messing around.

Step 1 – Getting Puppy

So first thing we need to do, is to get Puppy Linux from here

wget http://distro.ibiblio.org/pub/linux/distributions/puppylinux/puppy-5.2.5/lupu-525.iso

Wget is my weapon of choice here, so the above command will download the ISO file into the current directory. I am logged in as root to set everything up so it has downloaded the iso to /root/.

After we get the ISO file, we need to extract a few files from the ISO so we can use them to boot over PXE.

mount -o loop lupu-525.iso /mnt

With the above command, we mount the ISO from the current directory onto /mnt so we can copy the files off the ISO.
Once it is mounted, we will need 3 files off the ISO:
initrd.gz
vmlinuz
lupu_525.sfs

mkdir /tftpboot/puppy/
cp /mnt/initrd.gz /tftpboot/puppy/
cp /mnt/vmlinuz /tftpboot/puppy/
cp /mnt/lupu_525.sfs /tftpboot/puppy/

With those commands, we create a directory to store the files in, and copy them over.

Step 2 – Setting it up

We will need to pack lupu_525.sfs into the initrd image for this to work as the livecd expects it to be somewhere on the boot media but we don’t have any boot media as we are booting over the network.

So what we do is make a folder so we can modify the initrd –

mkdir /tftpboot/puppy/temp

Change to that directory

cd /tftpboot/puppy/temp

Then we will extract the contents of the initrd.

zcat /tftpboot/puppy/initrd.gz | cpio -i -H newc -d

Now the contents of the initrd are in /tftpboot/puppy/temp
We’ll move the lupu_525.sfs file into the temp folder –

mv /tftpboot/puppy/lupu_525.sfs /tftpboot/puppy/temp

Then we’ll repack it up into a new initrd.gz file by running this command while inside the temp directory –

find | cpio -o -H newc | gzip -4 > ../newinitrd.gz

Now we have our new initrd.gz file, we can setup the pxelinux config file with a new menu item.

Step 3 – Setting up pxelinux.cfg

So now we will need to add the following codeblock to /tftpboot/pxelinux.cfg/default


LABEL Puppylinux
MENU LABEL Puppy Linux 5.2.5
kernel puppy/vmlinuz
append initrd=puppy/newinitrd.gz

Notice we have used the name of the newinitrd.gz file as that is the one we will need to boot from in order for Puppylinux to get the lupu_525.sfs file.

Once you have updated the configuration file, you are now ready to boot Puppy Linux 5.2.5 !

Share

Jun 082011
 

A continuation of this post.

You can also create machine specific configuration files by naming the file the same as the mac address but replacing the colons ( : ) with dashes ( – ) and adding a 01 to the front to signify that this is an ethernet address..
So 00:15:af:69:31:79 becomes 01-00-15-af-69-31-79.

This is also the “BOOTIF” that you see on the previous screenshot.

Share

May 262011
 

Hi All,

Recently I decided to update my Lenovo laptop’s BIOS, but I didn’t have any blank CDs to burn the update iso onto.
Now that I have my PXE server running though, I can boot the ISO over PXE !

So first step was to grab the ISO file from the Lenovo website.
Once you have the ISO file, you will need to copy it to your /tftpboot/ directory, and depending on your style, a subdirectory. I have my ISO file in a subdirectory called lenovo, so the full path would be /tftpboot/lenovo.

Next up is to modify the pxelinux.cfg/default file to add the lines you will need for the ISO file.
Now you will need the memdisk kernel before you add these lines.
If you haven’t already found it, it can be found in the /usr/lib/syslinux/ directory.
I have put memdisk into the boot subdirectory for this exercise, and then added the following block to my default file.


label LenovoBios
menu label Lenovo BIOS 66ET60WW
kernel boot/memdisk
append initrd=lenovo/66et60ww.iso iso

You’ll have to replace the ISO file name with the file that you downloaded, but you should be able to boot off that and update the BIOS that way as I’ve managed to do it with my Lenovo 3000 N200 laptop.

Share

May 192011
 

Hi All,

I’m in the process of setting up PXE for some computers of mine, but I wanted them to have a separate configuration file as they do not have the power to run some of the other options, so I don’t want them to show up. I didn’t want to define specific IP addresses for the computers either or use IP specific configuration files as IP address may change.

So, what I did is to make a configuration file with the SYSUUID as the filename, since the SYSUUID is based off the mac address of the computer.
Then when it loads, the computer will boot off the SYSUUID configuration file instead of the default one.
You can find the SYSUUID on the boot page when a computer is booting from the network.

The SYSUUID is outlined in red, and quite long, but if a file is named that then the computer will boot off it, as that one is currently doing.

Share

May 172011
 
m4s0n501

Hi All,

In my previous post regarding booting Tiny Core Linux over PXE, we were booting a premade image that did not have much installed by default.
In this post, we will remaster the image into something usable that we can boot off by extracting all the files that we need and merging the directories then repacking it all into one. One of the advantages of doing it this way is that it lets you modify all the files in the root file system before you repack it all up.

What we will need to do is to get the tcz files for the applications we want to install, and merge them into the default tinycore.gz image. This will result in a larger tinycore.gz file but when the image is booted, applications will be pre-installed. This can be useful for diskless workstations in an office or netcafe for example.

So, onto the hard parts.


Step 1 – Getting the TCZ files

Ok, so once we’ve decided what software we want, we will need the TCZ files for the software we want.
This Site has a list of all the software we need and their dependencies, though it’s a bit tedious to download every single file as I haven’t found any other way to download what we need.

So, I took a shortcut.
Boot up Tiny Core Linux either using a virtual machine or real machine using PXE or some other boot media.
Install all the software you want via the app manager, and then all the files you need are in /tmp/tce/optional/.
To do this, you will need an internet connection on the computer that you’re booting Tiny Core on.

For me, I will install Firefox, OpenSSH (SSH Client and server), conky, pci-utils, and util-linux-ng, but you can choose what you want to install.
After I have installed the software, all the tcz files I need will be in /tmp/tce/optional/ and should look something like this :

After all the files are there, we will need to transfer them to a different computer to do the remastering.
In this case, I will be transferring them to my PXE server which will be doing the remastering.

Step 2 – Uncompressing Everything

Once we have all the tcz files where we need them, we will need to uncompress them as they are all compressed using squashfs.
We will need to install some additional tools to do that, namely squashfs-tools.

apt-get install squashfs-tools

Once that is installed, we can unsquash all the files so that we can access them like a normal filesystem.
I’ve written up a little script to do it all for me in this case :


#!/bin/bash
for i in $( ls ); do
if [ ! $i == "unsquashall.sh" ] && [ -f $i ]; then
unsquashfs -f $i
fi
done

I’ve named this unsquashall.sh, and have put this into the directory where all the tcz files are.
If you copy and paste this into a .sh file, don’t forget to make it an executable file by running :

chmod +x unsquashall.sh

After you run unsquashall.sh, you will have a directory called squashfs-root which will contain the contents of all the tcz files.

What you will also need, is the core of Tiny Core, the tinycore.gz file. This is a gzipped cpio file which contains the main file system of Tiny Core Linux.
You will want tinycore.gz in it’s own directory when you extract it to make things easier, I have used /tftpboot/tc/temp for that.
To extract tinycore.gz, you will need to run this command as root, or alternatively use sudo before this command.


zcat tinycore.gz | cpio -i -H newc -d

Step 3 – The Merge

Once you’ve extracted the contents, you should see something similar to this :

Looks just like the root file system of a Linux distribution doesn’t it ?
Now, we need to copy the contents of that squashfs-root directory that we created before into this directory.
I have the squashfs-root directory in the /tftpboot/tc/tcz directory, so the command I will be running is :


cp -Rp /tftpboot/tc/tcz/squashfs-root/usr/ /tftpboot/tc/temp/

Step 4 – Repacking Everything

After doing that, we need to repack everything up.
I have made another script for that –


#!/bin/bash
find | cpio -o -H newc | gzip -2 > /tftpboot/tc/tc.gz

Once again, you will need to make the file executable and it should be placed in /tftpboot/tc/temp/.
Once run, this script will create the tc.gz file in /tftpboot/tc which will replace the tinycore.gz file.
I have also copied the kernel bzImage from the iso file into the /tftpboot/tc directory also.

Step 5 – Configuring PXE

Once all that is done, we now need to reconfigure pxe to boot the new Tiny Core initrd file.


LABEL tinycorerm
MENU LABEL Tiny Core 3.6 Remaster
kernel tc/bzImage
append initrd=tc/tc.gz

Should look something like :


So when you boot up the remastered Tiny Core, you should see Firefox in the dock – that’s if you chose to install it.

Share

May 162011
 

Hi all,

I’ve had a play around with Tiny Core Linux recently, and I’m amazed at how they have fit in a window manager and some basic utilities into 10 megabytes.
You start off with a very basic system, consisting of only the Window Manager, and Application manager.

With Tiny Core Linux, you install applications by downloading the tcz files, and loading them via the Application Manager. Alternatively you can remaster the default image to add more applications, which I will also cover later on as it can work extremely well in conjunction with netbooting.

So without further ado, onto the simple process of PXE booting Tiny Core !


Step 1 – Getting Tiny Core

As always, we need to get the files we need first before we can boot from them.

wget http://distro.ibiblio.org/tinycorelinux/3.x/release/tinycore-current.iso

We will grab the ISO file first, and then we will need to extract the files we need from the ISO.
Now from here, we have 2 options.
We can mount the ISO image and boot straight from that to achieve a basic system, or we can extract the files so that we can use them later on to create a remastered image for multiple use situations, e.g. net cafe or diskless workstations.

In this post, I will go with the former option of just mounting it and booting from that.
I will cover the extraction of files and remastering in the next post.

Step 2 – Mounting the ISO

We now need to create a directory on our tftp server so we have a place to mount the ISO file.

mkdir /tftpboot/tinycore

After we’ve done that, we can now use the mount command to mount the ISO in loopback mode.

mount -o loop tinycore-current.iso /tftpboot/tinycore

Once that’s mounted, we can now do a ls in /tftpboot/tinycore to see what’s in there.

ls /tftpboot/tinycore

Should see something similar to this :

This is the contents of the ISO file, which should contain just a ‘boot’ folder.

Step 3 – Configuring the boot menu

So once we have the files where we need them, we can now edit the pxelinux.cfg/default file to include Tiny Core.
We will need this codeblock in there :


LABEL tinycore
MENU LABEL Tiny Core 3.6
kernel tinycore/boot/bzImage
append initrd=tinycore/boot/tinycore.gz

So it should look something similar to this if you have been following my blog up until now :

Once that is complete, when you boot from the network, you should see Tiny Core 3.6 as an option in the menu now.

Share

May 132011
 

Hi All,

Since I’ve recently done a post on how to setup a PXE network boot server, I thought I would do a few on distributions that can be booted through PXE.
First up, is xPUD. I’ve used this before for diskless workstations.
It is a packaged distribution suitable for light computer use with Firefox built in and also a media player.
Further applications can be added via use of additional opt packges which can then extend the functionality of xPUD.

In this post, I will just be booting a vanilla xPUD image from the PXE server.
The alternative way of booting xPUD via PXE is to extract the contents of the ISO file and using NFS to boot from the files themselves, but this is more complicated as it involves the use of an NFS server and permissions to setup. This will be something that I will cover in a different post.

Step 1

We will need to get the xPud image file first.

wget http://download.xpud.org/xpud-0.9.2-image

This will download the xPud image to the hard drive of the PXE server.

Step 2

Next up, we will need to move the file to the tftpboot directory.
Once again, I have chosen to have a subdirectory for xPud to keep it nice and tidy.

mkdir /tftpboot/xpud
mv xpud-0.9.2-image /tftpboot/xpud

Step 3

After we’ve copied the files over, we now need to modify the default file to setup the extra menu option so we can boot xPud.
Once you’ve added this codeblock, you should now be able to boot xPud over the network.

label xpud
menu label xPud 0.9.2
kernel xpud/xpud-0.9.2-image


It might take a little while to boot as the server needs to transfer ~45 megabytes over the network, but once it’s up and running, it’s all run from ram and should be pretty snappy.

Share

May 102011
 

Hi All,

In Part 3, we will install Debian Squeeze using our new PXE server.

Quicklinks :
Part 1
Part 2


First thing we’ll need is the network boot tarball off the Debian Website.

wget http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/netboot.tar.gz

This tarball will let you start installing Debian, but it will then install the rest of the software from the internet. Naturally this means that the computer will need an Internet connection to get the most out of this method.

After you get the tarball, you’ll need to uncompress it, and grab a couple of files out of it, namely linux and initrd.gz and put them into a subdirectory under tftpboot called debian, so you should end up with a directory like this : /tftpboot/debian which should contain the 2 files linux and initrd.gz

Now that we have the files in the right spot, we will need to create a new entry in the /tftpboot/pxelinux.cfg/default file.
So at the moment, we have this in the file.

DEFAULT menu.c32
PROMPT 0
MENU TITLE PXE Boot
TIMEOUT 100

LABEL Memtest4.10
MENU LABEL Memtest86+ 4.10
kernel boot/memtest86+

We will need to add a code block to give us the option to boot to the Debian mini installer.

LABEL DebSqueeze
MENU LABEL Debian Squeeze 6.0.1a Net Install
kernel debian/linux
append initrd=debian/initrd.gz

So the configuration file should look like this in the end :

Once that’s done, you should be able to boot from the PXE server like previously with the Memtest kernel, except it will be loading the Debian Net install files.


Once it’s loaded, you will get this screen –

Which looks exactly like it does as if the computer was booted from a CD.
You can now install Debian straight from the network without the use of a CD.

Share

May 092011
 

Hi All,

In this part, I will go through the install and setup of the needed software.
This list was in Part 1 as the software needed for this :

dnsmasq 2.55
Syslinux 4.02
Memtest86+ 4.10

The first 2 packages are the ones that make the magic happen.
Dnsmasq is a DHCP and TFTP server, which will let the computers that are connected to the network get an IP address and also grab the files it needs to boot from the server.
Syslinux, or more specifically it’s derivative pxelinux will let computers on the network request a file.

Quicklinks :
Part 1
Part 3


Step 1 – Software Install

Anyway, starting from the end of part 1 – we had just installed Debian Linux.
So first thing we do ?
We need to login, preferably as root to do all the configuration stuff first but you can login as your user and then su to root as well or install sudo and use that.

Update sources

So once you’re logged in, you’re ready to install the software. If you are going to use CDs to install the software then you should be able to skip this step, but if it doesn’t work then you can still use the apt-get update command and you should get something similar to this screenshot.

If you have an internet connection, then first thing we need to do is update the sources list with the apt-get update command.

So after we’ve run the apt-get update we should see something similar to above.
That updates the software sources that you selected while you were installing the Debian.

Installing the software

Once the software sources are up to date, you can now install the software that you need with this command : apt-get install dnsmasq syslinux memtest86+
That command will install the 3 packages and any other dependencies that they need to function.
When you run the command you should get something similar to this (I forgot to install memtest at the time of the screenshot :( ) :

Hit enter and you get …

Now you have the software that you need to boot from the network installed !

Step 2 : Configuring the Software

Configuration dnsmasq

First thing I do now is stop dnsmasq and rename it’s configuration files so we can start with a blank configuration file to make it easier to read later.
To stop dnsmasq, you run this command as root : /etc/init.d/dnsmasq stop
Then to rename the config file, you use this command : mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup.

I've done it reversed in this screenshot...

Also this is a good time to unplug the pxe server from the network if it is plugged in, because when we start up dnsmasq again, it will start trying to hand out IP addresses, and if there’s 2 DHCP servers on the network, it may wreak havoc with any new computers trying to get an IP address.

Get the files you need

Next up, you will need to create a directory for the TFTP server to store it’s files.
In this guide, I have chosen to use /tftpboot for the server root.
To create the necessary directory, you run this command, again as root :
mkdir -p /tftpboot/boot.
You will now have a directory called /tftpboot and a sub-directory called /tftpboot/boot created.
You will need these later to store the files you use to network boot computers.
You will also need a /tftpboot/pxelinux.cfg directory created, this is where the configuration files for pxelinux will live.

Next is to copy the files for pxelinux over to the tftpboot directory.
You will need 2 files for this step, pxelinux.0, and menu.c32.
In Debian, the files are located in /usr/lib/syslinux which is where apt-get installed the syslinux package.
Both pxelinux.0 and menu.c32 will need to go into /tftpboot, and to achieve that you will need to run these commands which will copy the files to where we need, again as root :
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /usr/lib/syslinux/menu.c32 /tftpboot

After that, we need to copy the memtest file to the correct directory.
When you first install it, it is installed into /boot for use on the local machine.
To copy it to where we need, we do another cp to where it needs to go.
cp /boot/memtest86+.bin /tftpboot/boot/memtest86+
I’ve removed the .bin extension as PXELINUX won’t boot memtest properly if the bin extension is kept.

Now with all the files in the correct spot, we can move onto the configuration files.

This is the time to setup a static IP address if you haven’t already. The configuration will differ depending on whether you have 1 or 2 network cards, but the general setup remains the same.
I have used 10.1.1.1 as the IP address for my pxe server, and so my configuration file (/etc/network/interfaces) goes :


auto eth0
iface eth0 inet static
address 10.1.1.1
netmask 255.255.255.0

Whether your configuration will be the same or not will depend in your network, but that will work for now.

For dnsmasq, we will need to specify some options to setup the tftp server’s options.
We will need to create a new file with your favourite text editor at /etc/dnsmasq.conf.
The following lines will be added –
interface=eth0
This option is needed if you have more than 1 network card, it will tell dnsmasq to listen on eth0 for the DHCP requests.
dhcp-range=10.1.1.2,10.1.1.10,255.255.255.0
This will set the range of IP addresses that dnsmasq will assign out to computers. For this guide, I have set it up to only assign a range from 10.1.1.2 to 10.1.1.10 with a subnet mask of 255.255.255.0, but you will need to change this to suit your own network.
enable-tftp
This enables the TFTP server in dnsmasq.
tftp-root=/tftpboot/
This sets the root path for the TFTP server, in this guide I have used /tftpboot but you are free to choose your own, or use the default of /var/lib/tftpboot.
dhcp-boot=pxelinux.0,pxeserver,10.1.1.1
This line sets the file, server name, and ip address for network boot clients to boot from.

So all together, you get :

interface=eth0
dhcp-range=10.1.1.2,10.1.1.10,255.255.255.0
enable-tftp
tftp-root=/tftpboot/
dhcp-boot=pxelinux.0,pxeserver,10.1.1.1

After you save this file, you will need to start up dnsmasq again, as we stopped it earlier.
/etc/init.d/dnsmasq start will start it up, and you should get something like :

In /tftpboot/pxelinux.cfg/ we need to create a file called default.
This default file will be the file that all computers will read to get the menu options etc.
In there, we should have the following :

DEFAULT menu.c32
PROMPT 0
MENU TITLE PXE Boot
TIMEOUT 100

LABEL Memtest4.10
MENU LABEL Memtest86+ 4.10
kernel boot/memtest86+

With these 3 files setup, you should be setup to boot from the network.
I got my other virtual PC to boot from the network and I get :

In Part 3, I will add some more functions to your new pxe netboot server :)


Some further reading:
PXELinux
Syslinux menu config file documenation

Share