Home Wiki > SDB:PXE boot installation
Sign up | Login

SDB:PXE boot installation

tagline: From openSUSE

This article covers the procedures of a network installation using Preboot eXecution Environment (PXE).

Introduction

Preboot eXecution Environment (PXE) is way to start computers without Floppy/Hard Disk/CD-ROM with the BIOS starting directly from the network using the PXE protocol. In order for PXE to work, the server needs OS configuration, and the client side needs a code module that runs PXE for the given LAN card (NIC). Most newer mainboards that have an on-board LAN port already have the module as part of their BIOS image. If you want to boot from a daughterboard NIC, i.e. a card in a ISA/PCI/etc. slot, you need to put the proper module either on a BootROM (only applicable when the NIC has a ROM socket), or into the BIOS image (only applicable when there is a proper image tool available, AMIFLASH is one).


Getting ready

For a successful networked install, you should have:

  • an existing openSUSE (hosting dhcpd and tftpd - install with zypper in atftp dhcp-server ),
  • an internet connection (broadband highly recommended),
  • a networked target system supporting PXE boot.

Configuration

dhcpd config

PXE boot is based on a BOOTP server which will send all the essential information for the system to start its network layer. That job could be done with the well known DHCPd server included in the openSUSE distribution if you set up a static configuration. Here is the typical configuration (default configuration file is /etc/dhcpd.conf):

host target_host {
     hardware ethernet xx:xx:xx:yy:yy:yy;
     fixed-address 192.168.1.10;
     server-name "192.168.1.1";
     next-server 192.168.1.1;
     filename "pxelinux.0";
}

Notice that 2 lines are added specially for the PXE boot. Indeed it is necessary to specify the TFTP boot server IP (server-name) and the filename containing PXE bootstrap (filename).

You need to (re)start the DHCPd server as follows:

 # rcdhcpd restart

Please Note: Depending on which tftp server you use and whether it runs in a chroot environment the "filename" may have to be specified without a leading path element. For the standard tftpd server on openSUSE or if you are using a RedHat based server, the "filename" should read:

filename "pxelinux.0";

With the ISC DHCP server version 3 (shipped on openSUSE) it is possible to configure the DHCP server to only respond to booting requests and this way run it in parallel with another default dhcp server. This may be desirable in case the default dhcp server can not be configured to supply a boot server or boot file name (this is the case with many DSL routers). The PXE client will ignore DHCP offers that do not contain a boot server or boot file name. Below is a complete configuration file for this scenario:

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none; ddns-updates off;
allow booting;
 
option domain-name "my.domain";
option domain-name-servers my.dnsserver;
option routers my.router;
   
# define rules to identify DHCP Requests from PXE and Etherboot clients.
class "pxe" {
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
}
class "etherboot" {
    match if substring (option vendor-class-identifier, 0, 9) = "Etherboot";
}
   
subnet 192.168.1.0 netmask 255.255.255.0 {
    option broadcast-address 192.168.1.255;
    pool {
         default-lease-time 180; # no long lease time required for booting
         max-lease-time 360;     # booted system does its own dhcp request
         server-name "mybootserver";
         next-server mybootserver.; # in case your local DNS only handles
                                    # unqualified domains keep trailing '.'
         filename "pxelinux.0";
         allow members of "pxe";
         allow members of "etherboot"; # allow etherboot, too
         range 192.168.1.201 192.168.1.211;
     }
}

atftpd config

It is recommended to use atftp package because atftp is the only free TFTP server complying with all RFC. Once installed, you should check that everything is OK in /etc/sysconfig/atftpd. Make sure you have tftp as a user on your system, otherwise you will have an error on restarting the daemon and it will fail to load. Here is the typical configuration:

ATFTPD_OPTIONS="--daemon --user tftp -v"
ATFTPD_USE_INETD="no"
ATFTPD_DIRECTORY="/srv/tftp/tftpboot"

In this example, note that the tftp root directory is set to /srv/tftp/tftpboot. You need to (re)start the TFTP server as follows:

 # rcatftpd restart

Please Note: The default tftp server that accompanies RedHat Enterprise Linux will do just fine. It will not require any further configuration. Simply start the service using the following command.

chkconfig tftp on

tftpd-hpa config

tftpd-hpa is the tftpd server from H. Peter Anvin, available in the "tftpd" package. In its default setup, it is configured to be started from xinetd and will chroot to the directory specified in /etc/xinetd.d/tftp, usually /tftpboot. Options to run as unprivileged user are to be added in /etc/xinetd.d/tftp as well.


Setting up PXE boot environment

Getting all

Before really starting to build the PXE environment, you have to install the syslinux package. This package provides a very useful file:

 /usr/share/syslinux/pxelinux.0

If you can not install syslinux, you can download this little file here.

Building PXE boot

At that point, you should have everything to build your PXE boot environment. Create the initial directory structure under the TFTP root directory as shown below:

 # mkdir -p /srv/tftp/tftpboot/pxelinux.cfg

Copy PXE bootstrap file into tftpboot directory.

 # cp /usr/share/syslinux/pxelinux.0 /srv/tftp/tftpboot

Create the PXE config file by editing /srv/tftp/tftpboot/pxelinux.cfg/default. This is almost the same as the syslinux.cfg file. Here is a sample PXE config file:

default install
prompt   1
timeout  30
  
# Install i386 Linux
label install
  kernel linux
  append initrd=initrd splash=silent vga=0x314 showopts install=http://download.opensuse.org/factory/repo/oss/

# Install x86_64 Linux
label install64
  kernel linux64
  append initrd=initrd64 splash=silent vga=0x314 showopts install=http://download.opensuse.org/factory/repo/oss/ 

Copy the kernel and initrd (here: linux, initrd, linux64, initrd64) to /srv/tftp/tftpboot.

Please Note: If you are using a RedHat based server, your default configuration will need a few more options for the line beginning with "append":

append root=/dev/ram0 load_ramdisk=1 initrd=initrd splash=silent showopts ramdisk_size=4096 init=linuxrc

This configuration file refers to 2 important files: linux and initrd. They have to be downloaded from the network openSUSE install repository (or a mirror). Notice they depend on your hardware (i386 or x86_64).

# cd /srv/tftp/tftpboot
# wget http://download.opensuse.org/factory/repo/oss/boot/i386/loader/linux
# wget http://download.opensuse.org/factory/repo/oss/boot/i386/loader/initrd
# wget -O initrd64 http://download.opensuse.org/factory/repo/oss/boot/x86_64/loader/initrd
# wget -O linux64 http://download.opensuse.org/factory/repo/oss/boot/x86_64/loader/linux

Please Note: If you are using a RedHat based server, your directory structure for the tftp-server should be as follows:

 /tftpboot 
 /tftpboot/pxelinux.0 
 /tftpboot/initrd.img 
 /tftpboot/vmlinuz 
 /tftpboot/pxelinux.cfg 
 /tftpboot/pxelinux.cfg/default

Using this config, you can type either "install" or "install64" at the boot: prompt.

You may also create a boot message file the same as what syslinux and isolinux uses, to display the available boot: prompt options. To do that edit /srv/tftp/tftpboot/f1.txt and add:

boot options:
  install   - install 32 bit i386 openSUSE 10.3
  install64 - install 64 bit x86_64 openSUSE 10.3

Then edit /srv/tftp/tftpboot/pxelinux.cfg/default and add near the top:

 DISPLAY f1.txt
 F1 f1.txt

Now when booting, instead of just a boot: prompt, you would see:

boot options:
  install   - install 32 bit i386 openSUSE 10.3
  install64 - install 64 bit x86_64 openSUSE 10.3
 
boot:

Booting PXE

You should ensure that your target host is well configured to boot from network and check that PXE is enabled. Then everything will run as accordingly... enjoy PXE & have a lot of fun!


Common issues

PXELINUX boot is very slow

You may find that while PXELINUX loads, it then seems to take a really long time going through all the different lines like:

 pxelinux.cfg/01-88-99-aa-bb-cc-dd
 pxelinux.cfg/C000025B
 pxelinux.cfg/C000025
 pxelinux.cfg/C00002
 pxelinux.cfg/C0000
 pxelinux.cfg/C000
 pxelinux.cfg/C00
 pxelinux.cfg/C0
 pxelinux.cfg/C
 pxelinux.cfg/default

You have to make sure that you have next-server in your /etc/dhcpd.conf file set to the address of your tftp server. You don't have to use a hostname, as is shown in the examples, you can have just a line like this:

 next-server 192.168.77.254;

Alternately, if you have a router set to assign IP addresses for your network, use the routers IP for the next-server. ie:

 next-server 192.168.0.1

No options accepted

You might also get warning messages like the following in /var/log/messages:

in.tftpd: tftp: client does not accept options

This is normal. PXELINUX does not seem to accept all options, but it does not impact booting.

Socket errors when running in.tftpd

If you get errors like:

in.tftpd: cannot bind to local socket: Address already in use

Then you might have mis-configured the options for the server in /etc/xinet.d/tftp. Check those options carefully.


Starting the Graphical Install System

After the PXE loaded install system has finished loading drivers you will be presented with a message saying that the openSUSE Install CD could not be found. Hit OK. You will then be asked to select your language and keyboard map.

Once at the Main Menu, select "Start Installation or System", then "Start Installation or Update". Next choose Network as the source medium to install from. You now need to locate an internet installation repository to install from. Select an appropriate mirror, for example:

http://download.opensuse.org/distribution/12.3/repo/oss/

Now select FTP or HTTP depending on the type of mirror you chose. Now choose the appropriate network device, and use DHCP. You will next be asked for the IP address of the server. Despite the request for an IP address, a hostname works fine, eg:

download.opensuse.org

Next you will be asked to enter the directory on the server, eg:

/distribution/12.3/repo/oss/

You can also install the newer releases of openSUSE Linux by checking the site and changing the install directory to reflect the new release.

The graphical instillation system will then be downloaded from your mirror. You may be told "Installation system does not match your boot medium.". Ignore this and continue. After a short pause the full graphical YaST should be loaded. You can now proceed with the instillation as normal.

Troubleshooting

Corrupted graphics

Ensure you have

vga=0x314

as an option in /srv/tftp/tftpboot/pxelinux.cfg/default on the append line. Otherwise, try the directions below for other vga=xxx options.

Text based YaST Loads Instead of X Server

If your computer is not too low spec to use the GUI installer you may be able to get the X Server to start by manually specify a resolution and color depth to use. I found this to be the case with my Latitude C400 laptop. To do this, go back to your TFTP server and edit the pxelinux.cfg/default file. On the line:

  append initrd=initrd splash=silent showopts

add the following:

vga=xxx

where xxx is a Linux video mode number for a mode you know your monitor/graphics card works with. eg:

  append initrd=initrd splash=silent showopts vga=773

You can find a list of Linux video mode numbers here. Boot with PXE again and the X Server should start properly.



See also


External links