Welcome to the new location of Alien's Wiki, sharing a single dokuwiki install with the SlackDocs Wiki.

Welcome to Eric Hameleers (Alien BOB)'s Wiki pages.

If you want to support my work, please consider a small donation:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
slackware:pxe [2006/09/27 21:33] – Cosmetics for added clarity alienslackware:pxe [2006/10/02 19:57] – Some typos fixed. alien
Line 2: Line 2:
  
  
-When the time comes to install Slackware on your computer, you have a limited number of options regarding the location of your Slackware packages. Either youinstall them from the (un)official Slackware CDROM or DVD, or you copy them to a pre-existing hard disk partition before starting the installation procedure, or you fetch the packages from a [[slackware:samba#setting_up_nfs_on_slackware|NFS server]].+When the time comes to install Slackware on your computer, you have a limited number of options regarding the location of your Slackware packages. Either you install them from the (un)official Slackware CDROM or DVD, or you copy them to a pre-existing hard disk partition before starting the installation procedure, or else you fetch the packages from a [[slackware:samba#setting_up_nfs_on_slackware|NFS server]].
  
 The number of possible options for booting your Slackware installer is similarly limited: either you boot your computer from the bootable first CDROM of the Slackware CD set, or from the DVD, or (in those cases where the computer BIOS refuses to recognize the CD as bootable) create boot/root floppies and boot from those. There is even loadlin, the DOS based Linux starter, but let's not concern ourselves with the past today. The number of possible options for booting your Slackware installer is similarly limited: either you boot your computer from the bootable first CDROM of the Slackware CD set, or from the DVD, or (in those cases where the computer BIOS refuses to recognize the CD as bootable) create boot/root floppies and boot from those. There is even loadlin, the DOS based Linux starter, but let's not concern ourselves with the past today.
Line 18: Line 18:
 The commonly used method of booting a computer over the network is called [[wp>Preboot_Execution_Environment|PXE]] or **P**reboot E**x**ecution **E**nvironment. If you want your computer to boot using PXE, it needs a network card with PXE-capable firmware, and a BIOS that supports network boot. Most modern network cards (and computers) sold on the market today support this. When a computer boots from the network , it is the network card that downloads the bootloader, kernel and a filesystem - any Operating System that might already be installed on the computer will be untouched.\\ You can just as well boot a diskless computer using PXE - in fact this is how [[wp>Thin_client|Thin Clients]] and the [[http://ltsp.org/|Linux Terminal Server Project]] work. The commonly used method of booting a computer over the network is called [[wp>Preboot_Execution_Environment|PXE]] or **P**reboot E**x**ecution **E**nvironment. If you want your computer to boot using PXE, it needs a network card with PXE-capable firmware, and a BIOS that supports network boot. Most modern network cards (and computers) sold on the market today support this. When a computer boots from the network , it is the network card that downloads the bootloader, kernel and a filesystem - any Operating System that might already be installed on the computer will be untouched.\\ You can just as well boot a diskless computer using PXE - in fact this is how [[wp>Thin_client|Thin Clients]] and the [[http://ltsp.org/|Linux Terminal Server Project]] work.
  
-Of course, the other end of the network needs our attention, too. A //PXE server// needs to be available on the local network. The PXE firmware in your computer's network card will contact this server in order to fetch some kind of bootable program code and bootstrap itself. What happens //after// the computer boots has no longer anything to do with the PXE boot stage, it is the bootstrapping process we're insterested in.+Of course, the other end of the network needs our attention, too. A //PXE server// needs to be available on the local network. The PXE firmware in your computer's network card will contact this server in order to fetch some kind of bootable program code and bootstrap itself. What happens //after// the computer boots has no longer anything to do with the PXE boot stage, it is the bootstrapping process we're interested in.
  
 We will cover the requirements for such a server in one of the [[#server_requirements|next paragraphs]]. We will cover the requirements for such a server in one of the [[#server_requirements|next paragraphs]].
  
-The Slackware network installation process will be roughly as follows:+The Slackware network installation process will roughly be as follows:
   * You start the computer that is going to receive Slackware;   * You start the computer that is going to receive Slackware;
   * On startup, you make sure you select //network boot// in the BIOS startup - either by activating a ''custom startup sequence'', by entering a ''boot menu'' by pressing a function key like <key>F12</key>, or else by preselecting ''network boot'' as first option in the BIOS.   * On startup, you make sure you select //network boot// in the BIOS startup - either by activating a ''custom startup sequence'', by entering a ''boot menu'' by pressing a function key like <key>F12</key>, or else by preselecting ''network boot'' as first option in the BIOS.
-  * When the computer boots, the network card activates it'PXE code and tries to contact a PXE server. When such a server exists on the LAN, it will tell the card where to download a piece of bootable code, an Operating System kernel (the Slackware Linux kernel) and an initial ramdisk (aka initrd - the compressed root-filesystem image where the setup program, libraries and kernel modules are stored). You will see a page full of mumbo-jumbo as the card broadcasts on the LAN, and probes for possible candidate configurations to download;+  * When the computer boots, the network card activates its PXE code and tries to contact a PXE server. When such a server exists on the LAN, it will tell the card where to download a piece of bootable code, an Operating System kernel (the Slackware Linux kernel) and an initial ramdisk (aka initrd - the compressed root-filesystem image where the setup program, libraries and kernel modules are stored). You will see a page full of mumbo-jumbo as the card broadcasts on the LAN, and probes for possible candidate configurations to download;
   * If a willing PXE server was found, your computer's network card will then download a kernel and initrd, boot the Linux kernel, unpack the initrd into a ramdisk and start the Slackware installer's initialization sequence. This is where you'll be in familiar territory again, since this is exactly what happens if you had booted from a CDROM or a floppy. But the fun is not over...   * If a willing PXE server was found, your computer's network card will then download a kernel and initrd, boot the Linux kernel, unpack the initrd into a ramdisk and start the Slackware installer's initialization sequence. This is where you'll be in familiar territory again, since this is exactly what happens if you had booted from a CDROM or a floppy. But the fun is not over...
   * Since we booted the computer using code that did not originate from our computer, we will have to fetch the remainder of the data - the Slackware  packages - from the network as well. It's just that the freshly booted Linux kernel has no idea how it came to be running on the computer: you will have to initialize the network all over again. The network card's PXE firmware has done it's job and is no longer in the picture. So:   * Since we booted the computer using code that did not originate from our computer, we will have to fetch the remainder of the data - the Slackware  packages - from the network as well. It's just that the freshly booted Linux kernel has no idea how it came to be running on the computer: you will have to initialize the network all over again. The network card's PXE firmware has done it's job and is no longer in the picture. So:
-  * We need to load a kernel driver for our network card and locate a NFS server that holds the Slackware package tree. Currently, NFS is our only means of getting to network data at all. Before starting ''cfdisk'' and ''setup'', we need to run the (''pcmcia'' and/or) ''network'' command to probe the network card and load a suitable driver. If your network card is not supported by any of the available drivers, you're out of luck and will have to rethink your options.+  * We need to load a kernel driver for our network card and locate a NFS server that holds the Slackware package tree. Currently, NFS is our only means of getting to network data at all. Before starting ''cfdisk'' and ''setup'', we need to run the (''pcmcia'' and/or) ''network'' command to probe the network card and load a suitable driver. If your network card is not supported by any of the available drivers, you're out of luck and will have to re-evaluate your options.
   * From here on, installation proceeds as usual, under the condition that you select //NFS server// as the source of the Slackware packages.   * From here on, installation proceeds as usual, under the condition that you select //NFS server// as the source of the Slackware packages.
  
Line 42: Line 42:
 This is the interesting part (well in my opinion at least - many people consider this as a dark art).\\ This is the interesting part (well in my opinion at least - many people consider this as a dark art).\\
 A PXE Server is really a mix of several components. We need A PXE Server is really a mix of several components. We need
-  * A service that understands the //BOOTP// protocol. BOOTP is a network protocol somewhat like DHCP, and it is used by the PXE firmware to broadcast on the network it'desire to find a suitable server to download the bootstrap code from. The DHCP Server that is part of Slackware fulfills this requirement, since it talks BOOTP as well as DHCP.+  * A service that understands the //BOOTP// protocol. BOOTP is a network protocol somewhat like DHCP, and it is used by the PXE firmware to broadcast on the network its desire to find a suitable server to download the bootstrap code from. The ISC DHCP Server which comes as part of Slackware fulfills this requirement, since it supports BOOTP as well as DHCP.
   * A download service for the bootstrap code. A //TFTP// (trivial file transfer protocol) server is needed for this. Slackware ships with an implementation of a TFTP server called tftpd-hpa which does what we need.   * A download service for the bootstrap code. A //TFTP// (trivial file transfer protocol) server is needed for this. Slackware ships with an implementation of a TFTP server called tftpd-hpa which does what we need.
   * And for the Slackware installer, a NFS server is required because we must perform a network install. Slackware does not know the concept of installation from a ftp server (yet?). We can use Slackware's stock NFS server for that.   * And for the Slackware installer, a NFS server is required because we must perform a network install. Slackware does not know the concept of installation from a ftp server (yet?). We can use Slackware's stock NFS server for that.
Line 70: Line 70:
 You probably already have a DHCP server running on your network. You can try and modify it's configuration so that it will do want we want, or if that is impossible (for instance because the DHCP server is running on your DSL/Cable router) you could consider disabling that and setting up a Slackware DHCP server for your LAN with much enhanced functionality. You probably already have a DHCP server running on your network. You can try and modify it's configuration so that it will do want we want, or if that is impossible (for instance because the DHCP server is running on your DSL/Cable router) you could consider disabling that and setting up a Slackware DHCP server for your LAN with much enhanced functionality.
  
-Slackware includes the //ISC DHCP// server package (dhcpd). Two example ''/etc/dhcpd.conf'' configuration files for this DHCP Server is included in the [[#example_configuration_scripts|last section]] of the article.+Slackware includes the //ISC DHCP// server package (dhcpd). Two example ''/etc/dhcpd.conf'' configuration files for this DHCP Server are included in the [[#example_configuration_scripts|last section]] of the article.
  
 If you don't want to be bothered with fancy configurations but want a quick solution that will just work for your network, use the [[#first_example_dhcpd.conf|first (simple) example]] ''/etc/dhcpd.conf'' configuration file as well as the provided ''/etc/rc.d/rc.dhcpd'' [[#rc_script|start script]] and you'll be up and running in minutes. It requires //no// editing of files, the examples will work out of the box. If you don't want to be bothered with fancy configurations but want a quick solution that will just work for your network, use the [[#first_example_dhcpd.conf|first (simple) example]] ''/etc/dhcpd.conf'' configuration file as well as the provided ''/etc/rc.d/rc.dhcpd'' [[#rc_script|start script]] and you'll be up and running in minutes. It requires //no// editing of files, the examples will work out of the box.
Line 85: Line 85:
 group { group {
   allow bootp;   allow bootp;
 +  next-server 192.168.0.1;
   use-host-decl-names on;   use-host-decl-names on;
   if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {   if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
Line 98: Line 99:
   }   }
 } }
-</code> This makes the DHCP server recognize network boot clients that use PXE and serves them the PXElinux boot loader ''/slackware-11.0/pxelinux.0''. What this boot loader does will be explained further down the article. +</code> This makes the DHCP server recognize network boot clients that use PXE and serves them the PXElinux boot loader ''/slackware-11.0/pxelinux.0''. What this boot loader does will be explained further down the article.\\ \\ The ''next-server'' parameter contains the IP adddress of the TFTP server. This will often be identical to the DHCP server's IP address, but if you have a TFTP server that is running on a different IP address than the DHCP server (i.e. they run on separate servers) you will have to add the remote IP address instead, like this (assuming the TFTP server is running on IP address 192.168.0.254): <code>
- +
-<note tip>If you have a TFTP server that is running on a different IP address than the DHCP server (i.e. they run on separate servers) yopu will have to add an extra line to this PXE //group block// that goes like this (assuming the TFTP server is running on IP address 192.168.0.254): <code>+
 next-server 192.168.0.254;</code> next-server 192.168.0.254;</code>
 +
 +<note tip>If you are running a version of ISC dhcpd that is >= 3.0.3 , then the addition of a ''next-server <ipaddress>;'' line is **mandatory**. For older releases this was only needed if the TFTP and DHCP Servers actually had different addresses.\\ If you fail to set the ''next-server'' address, the //siaddr// field in the data returned to the client is set to zero where in the past it would default to the DHCP server's own IP address (which often happened to be the IP address of the TFTP server as well). The PXE client uses the //siaddr// field to determine the IP address of the TFTP server and so the PXE booting will stall at the point of looking for a TFTP server.
 </note> </note>
  
Line 185: Line 186:
 mount -o loop,ro /mirror/Slackware/slackware-11.0/isolinux/network.dsk network/ mount -o loop,ro /mirror/Slackware/slackware-11.0/isolinux/network.dsk network/
 </code> You've probably noticed I mount these images read-only; we're only going to copy files //out// of them. </code> You've probably noticed I mount these images read-only; we're only going to copy files //out// of them.
-  * Use the ''dd'' command to create a new file of sufficient size (called ''newinitrd''). At the end of the process this file will contain a filesystem which holds the combined contents of the Slackware disk images we just loop-mounted.\\ With "sufficient" I mean the size must be at least the combined sizes of the uncompressed disk images we are going to copy into our new filesystem. In my example ''dd'' command below I use a count of ''9500'' 1kB sized blocks which amounts to a 9.5MB file: <code>+  * Use the ''dd'' command to create a new file of sufficient size (called ''newinitrd''). At the end of the process this file will contain a filesystem which holds the combined contents of the Slackware disk images we just loop-mounted.\\ With "sufficient" I mean the size must be at least the combined sizes of the uncompressed disk images we are going to copy into our new filesystem. In my example ''dd'' command below I use a number of ''9500'' 1kB sized blocks which amounts to a 9.5MB file: <code>
 dd if=/dev/zero of=/tmp/pxe/newinitrd bs=1k count=9500 dd if=/dev/zero of=/tmp/pxe/newinitrd bs=1k count=9500
-</code> How did I get at that number ''9500''? Well, you sum the sizes of the ''initrd.dsk'', ''network.dsk'' and ''pcmcia.dsk'' files and make sure you use a number that is not lower than that sum. The following command is the geek way to return the sum value: <code>echo $(( $(du -sk initrd.dsk|cut -f1)+$(du -sk network.dsk|cut -f1)+$(du -sk pcmcia.dsk|cut -f1) ))+</code> How did I get at that number ''9500''? Well, you sum the sizes of the ''initrd.dsk'', ''network.dsk'' and ''pcmcia.dsk'' files and make sure you use a number that is not smaller than that sum. The following command is the geek way to return the sum value: <code>echo $(( $(du -sk initrd.dsk|cut -f1)+$(du -sk network.dsk|cut -f1)+$(du -sk pcmcia.dsk|cut -f1) ))
 </code> </code>
   * We then create a filesystem //inside// this file (and use the ''-F'' flag to ''mkfs.ext2'' to indicate that we are fully aware we're applying the command to a non-block device). Also, tune the filesystem so that it will never ever ask for a filesystem check (''fsck'') when it gets mounted: <code>   * We then create a filesystem //inside// this file (and use the ''-F'' flag to ''mkfs.ext2'' to indicate that we are fully aware we're applying the command to a non-block device). Also, tune the filesystem so that it will never ever ask for a filesystem check (''fsck'') when it gets mounted: <code>
Line 225: Line 226:
 </code> </code>
  
-<note tip> I have written a script //create_slackboots.sh// that does all of this fully automatically (and more!), and you can download it at [[http://www.slackware.com/~alien/tools/slackboot/|http://www.slackware.com/~alien/tools/slackboot/]]. Do not forget to also download the other files that you'll find at that URL, because the script needs those to patch the pcmcia and network scripts. Be aware that this script also adds the content of ''network26.dsk'' (the network drivers for the ''huge26.s'' kernel) to our big new ''initrd.img'', which is something I omitted the detailed steps above in order to keep it readable</note>+<note tip> I have written a script //create_slackboots.sh// that does all of this fully automatically (and more!), and you can download it at [[http://www.slackware.com/~alien/tools/slackboot/|http://www.slackware.com/~alien/tools/slackboot/]]. Do not forget to also download the other files that you'll find at that URL, because the script needs those to patch the pcmcia and network scripts. Be aware that this script also adds the content of ''network26.dsk'' (the network drivers for the ''huge26.s'' kernel) to our big new ''initrd.img'', which is something I omitted from the detailed steps above in order to keep the story readable</note>
  
 <note> You can also just download a [[http://www.slackware.com/~alien/slackboot/pxe/initrd.img|ready-made initrd.img]] of course. <note> You can also just download a [[http://www.slackware.com/~alien/slackboot/pxe/initrd.img|ready-made initrd.img]] of course.
-I have an accompanying [[http://www.slackware.com/~alien/slackboot/pxe/pxelinux.cfg/default|pxelinux configuration file]] too. If you rather create that file yourself, use the aforementioned //create_slackboots.sh// script or read the next paragraph.</note>+I have an accompanying [[http://www.slackware.com/~alien/slackboot/pxe/pxelinux.cfg/default|pxelinux configuration file]] too. If you rather want to create that file yourself, use the aforementioned //create_slackboots.sh// script or read the next paragraph.</note>
  
 ==== Creating a pxelinux configuration file ==== ==== Creating a pxelinux configuration file ====
  
-Save the isolinux.cfg file from the Slackware CDROM to the tftp directory: <code>+Copy the isolinux.cfg file from the Slackware CDROM to the tftp directory: <code>
 mkdir -p /tftpboot/slackware-11.0/pxelinux.cfg mkdir -p /tftpboot/slackware-11.0/pxelinux.cfg
 cp /mirror/Slackware/slackware-11.0/isolinux/isolinux.cfg /tftpboot/slackware-11.0/pxelinux.cfg/default cp /mirror/Slackware/slackware-11.0/isolinux/isolinux.cfg /tftpboot/slackware-11.0/pxelinux.cfg/default
Line 238: Line 239:
 sed -i -e "s/ramdisk_size=[[:digit:]]*/ramdisk_size=9500"/ \ sed -i -e "s/ramdisk_size=[[:digit:]]*/ramdisk_size=9500"/ \
        -e "s#/kernels/#kernels/#" \        -e "s#/kernels/#kernels/#" \
-       /tftpboot/pxelinux.cfg/default+       /tftpboot/slackware-11.0/pxelinux.cfg/default
 </code> </code>
  
Line 263: Line 264:
  
 Good luck! Good luck!
- 
  
 ====== Example configuration scripts ====== ====== Example configuration scripts ======
Line 284: Line 284:
 # Allow bootp requests # Allow bootp requests
 allow bootp; allow bootp;
 +
 +# Point to the TFTP server:
 +next-server 192.168.0.1;
  
 # Default lease is 1 week (604800 sec.) # Default lease is 1 week (604800 sec.)
Line 393: Line 396:
   allow bootp;   allow bootp;
  
-  # Only use next-server if the TFTP service runs on another server+  # Point to the TFTP server (required parameter!)
-  # You'd fill in the IP address of that TFTP server here+  next-server 192.168.0.1; 
-  #next-server 192.168.0.11;+
   # If you want to log the boot process, you will need to configure   # If you want to log the boot process, you will need to configure
   # your logserver to allow logging from remote hosts.   # your logserver to allow logging from remote hosts.
   #option log-servers 192.168.0.1;   #option log-servers 192.168.0.1;
 +
   use-host-decl-names on;   use-host-decl-names on;
  
 PXE: Installing Slackware over the network ()
SlackDocs