How to use Etherboot

From Fit-PC

Jump to: navigation, search

Contents

[edit] Introduction

Etherboot allows booting a fit-PC over a LAN. It is an option in the BIOS - [Custom Configuration] / [Etherboot] The major challenge in using Etherboot is configuring the server.

For step by step instructions see below.

For more information see:


[edit] Server base setup

Create directories: The first thing to do is to create the directories where your diskless system will be stored. Create a directory called /diskless which houses a directory for fitPC client. For the rest of this howto we'll be working on the client 'fitPC'.

  • Code Listing 1: Directory setup
mkdir /diskless
mkdir /diskless/fitPC
mkdir /diskless/fitPC/boot


DHCP and TFTP setup: The client will get boot informations using DHCP and download all the required files using TFTP.

For TFTP, emerge app-admin/tftp-hpa. In /etc/conf.d/in.tftpd, put the following :

  • Code Listing 2: in.tftpd
INTFTPD_PATH="/diskless"
INTFTPD_USER="nobody"
INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"

Setting up DHCP is easy, but if you are in a network environment administered by someone else, you must use a preexisting DHCP server. Contact your sysadmin for more infornation! If you "own" the network then you can follow this procedure.

For DHCPd, run emerge dhcp (or any other DHCP server of your choice). Make sure that the correct interface is selected in /etc/conf.d/dhcpd.

Configure DHCP for your basic needs. Then, add the following on /etc/dhcp/dhcpd.conf.

Note: This provide a static IP address for the client and the path of a PXE boot image, here pxegrub. You have to replace the MAC address of the Ethernet card of the client and the directory where you will put the client files with the one you use.

  • Code Listing 3: dhcpd.conf
option option-150 code 150 = text ;
ddns-update-style none ;
host fitPC {
hardware ethernet 00:00:00:00:00:00;
fixed-address ip.add.re.ss;
option option-150 "/fitPC/boot/grub.lst";
filename "/fitPC/boot/pxegrub";
}

The pathes "/fitPC/boot/grub.lst" and "/fitPC/boot/pxegrub" defined revative to the path "/diskless" from /etc/conf.d/in.tftpd.

Next you'll need to configure your interface in /etc/conf.d/net so that it doesn't get cleared at bootup. See /etc/conf.d/net.example for more information.

  • Code Listing 4: /etc/conf.d/net
(Replace eth0 with the correct interface)
config_eth0=( "noop" )

Setup GRUB: To provide PXE booting I use GRUB with the netboot USE flag enabled. Once GRUB is compiled, copy the PXE image to the diskless client's boot directory. Then edit its grub.lst config file.

  • Code Listing 5: Grub setup
echo "sys-boot/grub netboot" >> /etc/portage/package.use
emerge -av grub
cp /usr/lib/grub/i686-pc-linux-gnu/pxegrub /diskless/fitPC/boot/
nano -w /diskless/fitPC/boot/grub.lst
  • Code Listing 6: grub.lst
default 0
timeout 30
title=Diskless Gentoo
root (nd)
kernel /fitPC/boot/bzImage ip=dhcp root=/dev/nfs rw nfsroot=ip.add.re.ss:/diskless/fitPC

For the nfsroot option, the IP address is the one of the server and the directory is the one where your diskless client files are located (on the server).

  • Code Listing 7: Installing nfs-utils
emerge nfs-utils

Setup NFS: NFS is quite easy to configure. The only thing you have to do is to add a line on the /etc/exports config file:

  • Code Listing 8: /etc/exports
nano -w /etc/exports
#/etc/exports: NFS file systems being exported.  See exports(5).
/diskless/fitPC ip.add.re.ss(sync,no_root_squash,rw)

where ip.add.re.ss is fixed-address that your fitPC received from dhcpd.conf.

[edit] Creating the system on the server

Stage tarballs and chroot: This example uses a stage3-x86-2007.0.tar.bz2 tarball and linux-2.6.20 kernel. Download it from one of gentoo mirrors. Mount /proc to your diskless directory and chroot into it to continue.

Warning: Be very careful where you extract your stage tarball. You don't want to end up extracting over your existing installation.

  • Code Listing 9: Extracting the stage tarball and Kernel sources
cd /diskless/fitPC/
wget http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/x86/2007.0/stages/stage3-x86-2007.0.tar.bz2
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
tar xvjpf  stage3-x86-2007.0.tar.bz2
tar xvjf linux-2.6.20.tar.bz2 -C /diskless/fitPC/usr/src/
mount -t proc /proc /diskless/fitPC/proc
cp /etc/resolv.conf /diskless/fitPC/etc/resolv.conf
chroot /diskless/fitPC/ /bin/bash
env-update
source /etc/profile

Kernel configuration: When you do the make menuconfig of your kernel configuration, don't forget to enable the following options with the others recommended into the install howto. For me worked default kernel configuration plus options listed below.

  • Code Listing 10: menuconfig options

Under "Networking --> Networking options" :

[*] TCP/IP networking
[*] 	IP: kernel level autoconfiguration
[*] 		IP: DHCP support
[*] 		IP: BOOTP support

Under "File systems --> Network File Systems" :

[*] NFS file system support
[*] 	Provide NFSv3 client support
[*] Root file system on NFS

Compile, install modules and save the kernel in your chrooted /boot according to the pxegrub setting defined earlier.

  • Code Listing 11: Kernel and modules
make
make modules_install
cp /usr/src/linux-2.6.20/arch/x86/boot/bzImage /boot/

Next configure your diskless client's /etc/fstab. Run nano -w /etc/fstab

  • Code Listing 12: /etc/fstab
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs nodev,nosuid,noexec 0 0

You also need to prevent the client to run a filesystem check:

  • Code Listing 13: Preventing the client to run a filesystem check
touch /fastboot
echo "touch /fastboot" >> /etc/conf.d/local.start

Since eth0 used to communicate with NFS and TFTP, remove the net.eth0 symlink, otherwise booting will be stuck.

  • Code Listing 14: Removing net.eth0 service
rm /etc/init.d/net.eth0

You have done with server filesystem. Don`t forget to set passwd and exit chrooted environment

  • Code Listing 15: Setting password and exiting
passwd
exit

Bootloader. Don't install another bootloader because we already have one - pxegrub. Simply finish the install and restart the server. Start the services you'll need to boot the new client: DHCP, TFTPD, and NFS.

  • Code Listing 16: Starting services
/etc/init.d/dhcpd start
/etc/init.d/in.tftpd start
/etc/init.d/nfs start

[edit] Booting the new client

For the fitPC to boot properly, you'll need to configurate the bios: Press Del on reboot, enter the "Custom Configuration" menu and set Etherboot option to "Enabled". On exit choose "Write to CMOS and Exit".

The network card should get an IP address using DHCP and download the GRUB PXE image using TFTP. Then, you should see a nice black and white GRUB bootmenu where you will select the kernel to boot and press Enter. If everything is ok the kernel should boot, mount the root filesystem using NFS and provide you with a login prompt. Enjoy.

Personal tools