Difference between revisions of "How to boot salix live using PXE"
(→TFTP Server) |
(→TFTP Server and Boot manager) |
||
Line 150: | Line 150: | ||
/tftpboot/salixlive/initextra.xz | /tftpboot/salixlive/initextra.xz | ||
</pre> | </pre> | ||
− | vmlinuz is the live kernel you can find the in the boot folder in the Salix Live ISO. | + | <ul><li>vmlinuz is the live kernel you can find the in the boot folder in the Salix Live ISO.</li> |
− | + | <li>initextra.xz is the special initrd you can find in sourceforge.net download page.</li> | |
− | initextra.xz is the special initrd you can find in sourceforge.net download page. | + | <li>You can copy menu.c32 from the following location: /usr/share/syslinux/menu.c32</li> |
− | + | <li>You can copy the pxelinux.0 from the following location: /usr/share/syslinux/pxelinux.0</li> | |
− | You can copy menu.c32 from the following location: /usr/share/syslinux/menu.c32 | + | <li>Here is my pxelinux.cfg/default file: |
− | + | ||
− | You can copy the pxelinux.0 from the following location: /usr/share/syslinux/pxelinux.0 | + | |
− | + | ||
− | Here is my pxelinux.cfg/default file: | + | |
<pre> | <pre> | ||
DEFAULT menu.c32 | DEFAULT menu.c32 | ||
Line 192: | Line 188: | ||
APPEND root=/dev/ram0 remote=http,192.168.0.1,/salixlive.iso skipnetcheck quiet | APPEND root=/dev/ram0 remote=http,192.168.0.1,/salixlive.iso skipnetcheck quiet | ||
INITRD /salixlive/initextra.xz | INITRD /salixlive/initextra.xz | ||
− | </pre> | + | </pre></li></ul> |
Of course you should tweak the config of pxelinux.cfg/default and the content of the salixlive directory (or any other directory).</li> | Of course you should tweak the config of pxelinux.cfg/default and the content of the salixlive directory (or any other directory).</li> | ||
</ol> | </ol> |
Revision as of 19:57, 3 February 2012
Contents |
What is PXE boot
PXE is a boot system integrated in BIOS to be able to boot your system through the network instead of using connected devices (hard disk, optical drive, usb stick, …).
This can be used for several reasons, but most of them are:
- target system cannot boot on a CD or a USB (because there is no such device, the devices are broken or simply because the BIOS cannot do it) ;
- to provide an easy way to use a computer as a terminal (the system is upgraded on the server, and the terminal just connect to it) ;
- for system administrators, to help debug a broken computer, make mass-installations, …
Here we just focus and a simply way to configure and install such a system. For more options, see more advanced tutorials on the net.
SaLT Netboot Features
The underlying live boot system used is SaLT (Salix Live Technology), which currently have the following features:
- NFS
- SSH using sshfs
- Samba (CIFS)
- HTTP using httpfs
- FTP using wget
Known limitations
There are of course some limitations:
- PXE boot, in FTP mode, will freeze (kernel panic) while chrooting when using curlftpfs library. So wget is used instead but hence it needs more memory because the entire ISO must be loaded into RAM prior to booting
- no user/password authentification over HTTP support
- no wireless network support
- no DNS resolution support
Netbooting
Netbooting requires three things:
- A boot manager that uses TFTP
- A kernel
- An initrd
The boot manager using is pxelinux, the kernel is the regular one provided in the Salix Live ISO, the initrd is an enhanced one that the one provided in the Salix Live ISO.
And of course it requires that the Linux kernel recognize and configure your network device. So check that your driver is listed in the attached modules file.
Installing a PXE environment on the host
In order to netboot, you first need to set up a PXE environment. This needs a DHCP server with the BOOTP protocol and a TFTP server.
The following instructions are for a Slackware distributions. You can easily adapt it to another distro or find information about PXE on the web.
Configurations
DHCP Server
- Install the 'dhcp' server package:
slapt-get -i dhcp
- Create the dhcp daemon:
cat <<'EOF' >/etc/rc.d/rc.dhcpd #!/bin/sh # # /etc/rc.d/rc.dhcpd # This shell script takes care of starting and stopping # the ISC DHCPD service # # Put the command line options here that you want to pass to dhcpd: DHCPD_OPTIONS="-q eth0" [ -x /usr/sbin/dhcpd ] || exit 0 [ -f /etc/dhcpd.conf ] || exit 0 start() { # Start daemons. echo -n "Starting dhcpd: /usr/sbin/dhcpd $DHCPD_OPTIONS " /usr/sbin/dhcpd $DHCPD_OPTIONS echo } stop() { # Stop daemons. echo -n "Shutting down dhcpd: " killall -TERM dhcpd echo } status() { PIDS=$(pidof dhcpd) if [ "$PIDS" == "" ]; then echo "dhcpd is not running!" else echo "dhcpd is running at pid(s) ${PIDS}." fi } restart() { stop sleep 3 start } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) status ;; *) echo "Usage: $0 {start|stop|status|restart}" ;; esac exit 0 EOF chmod +x /etc/rc.d/rc.dhcpd
- Configure the dhcp server to answer the BOOTP protocol with the location of the PXE boot manager to fetch by TFTP. You also configure the network information that will be fetched by the PXE client and by the live distro.
The config file is /etc/dhcpd.conf:# dhcpd.conf # # Configuration file for ISC dhcpd (see 'man dhcpd.conf') # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; ddns-update-style none; # Allow bootp requests allow bootp; # Point to the TFTP server: next-server 192.168.0.1; # Default lease is 1 week (604800 sec.) default-lease-time 604800; # Max lease is 4 weeks (2419200 sec.) max-lease-time 2419200; subnet 192.168.0.0 netmask 255.255.255.0 { option domain-name "my.lan"; option broadcast-address 192.168.0.255; option subnet-mask 255.255.255.0; option domain-name-servers 192.168.0.1; option routers 192.168.0.10; range dynamic-bootp 192.168.0.50 192.168.0.100; use-host-decl-names on; if substring (option vendor-class-identifier, 0, 9) = "PXEClient" { filename "/tftpboot/pxelinux.0"; } }
This is just an example, adjust with your network configuration.
TFTP Server and Boot manager
- Install a TFTP server, the 'tftp-hpa' package, and syslinux:
slapt-get -i tftp-hpa syslinux
- Create the following directory structure:
/tftpboot/ /tftpboot/pxelinux.cfg/ /tftpboot/pxelinux.cfg/default /tftpboot/pxelinux.0 /tftpboot/menu.c32 /tftpboot/salixlive/vmlinuz /tftpboot/salixlive/initextra.xz
- vmlinuz is the live kernel you can find the in the boot folder in the Salix Live ISO.
- initextra.xz is the special initrd you can find in sourceforge.net download page.
- You can copy menu.c32 from the following location: /usr/share/syslinux/menu.c32
- You can copy the pxelinux.0 from the following location: /usr/share/syslinux/pxelinux.0
- Here is my pxelinux.cfg/default file:
DEFAULT menu.c32 PROMPT 0 LABEL salixlive_nfs MENU LABEL ^N) Net boot Salix Live (NFS) LINUX /salixlive/vmlinuz APPEND root=/dev/ram0 remote=nfs,192.168.0.1,/tftpboot/salixlive/iso skipnetcheck quiet INITRD /salixlive/initextra.xz LABEL salixlive_ssh MENU LABEL ^S) Net boot Salix Live (SSH) LINUX /salixlive/vmlinuz APPEND root=/dev/ram0 remote=ssh,192.168.0.1,/tftpboot/salixlive/iso skipnetcheck quiet INITRD /salixlive/initextra.xz LABEL salixlive_smb MENU LABEL ^M) Net boot Salix Live (Samba) LINUX /salixlive/vmlinuz APPEND root=/dev/ram0 remote=smb,192.168.0.1,salixlive skipnetcheck quiet INITRD /salixlive/initextra.xz LABEL salixlive_ftp MENU LABEL ^F) Net boot Salix Live (FTP) LINUX /salixlive/vmlinuz APPEND root=/dev/ram0 remote=ftp,192.168.0.1::user:password,/salixlive.iso skipnetcheck quiet INITRD /salixlive/initextra.xz LABEL salixlive_http MENU LABEL ^H) Net boot Salix Live (HTTP) LINUX /salixlive/vmlinuz APPEND root=/dev/ram0 remote=http,192.168.0.1,/salixlive.iso skipnetcheck quiet INITRD /salixlive/initextra.xz