SDB:PXE-Boot-Installation

Wechseln zu: Navigation, Suche
Dieser Artikel behandelt die Prozeduren einer Netzwerkinstallation mit der Verwendung von Preboot eXecution Environment (PXE).

Einführung

Preboot eXecution Environment (PXE) ist der Weg Computer ohne Diskette/Festplatte/CD-ROM direkt über das BIOS vom Netzerk unter Verwendung des PXE-Protolkolls zu starten. Damit PXE funktioniert, braucht der Server eine Betriebssystem-Konfiguration und die Client-Seite braucht ein Code-Modul, das PXE für eine entsprechende Netzwerkkarte (NIC) verwendet. Die meisten neueren Mainboards, die einen On-Board-LAN-Port haben, haben dieses Modul schon als Teil ihres BIOS-Images. Wenn Sie von einer Tochterboard-NIC booten wollen, z.B. eine Karte in einem ISA/PCI/etc.-Slot, müssen Sie das richtige Modul entweder auf einem BootROM (nur anwendbar, wenn die NIC ein ROM-Socket hat), oder in das BIOS-Image (nur anwendbar, wenn das richtige Image-Tool verfügbar ist, AMIFLASH ist eines) hinzufügen.


Fertig werden

Für eine erfolgreiche Netzwerkinstallation sollten Sie haben:

  • ein bestehendes openSUSE (gehostetes dhcpd und tftpd - Installation mit zypper in atftp dhcp-server ),
  • eine Internet-Verbindung (Breitband-Internet sehr empfohlen),
  • ein an das Netzwerk angeschlossenes Ziel-System, das PXE-Boot unterstützt

Konfiguration

dhcpd-Konfiguration

PXE-Boot basiert auf dem BOOTP-Server, der alle wichtigen Informationen für den Systemstart an seine Netzwerkschicht senden wird. Dieser Job könnte mit dem bekannten DHCPD-Server, inkludiert in der openSUSE-Distribution, gemacht werden, wenn eine statische Konfiguration eingerichtet wird. Hier ist eine typische Konfiguration (Standard-Konfigurationsdatei ist die /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";
}

Beachten Sie, dass 2 Zeilen speziell für den PXE-Boot hinzugefügt werden. Deshalb ist es notwendig die IP-Adresse des TFTP-Bootservers (Servername) und den Dateinamen, der den PXE-Bootstrap beinhaltet (Dateiname) mit anzugeben.

Man muss den DHCPD-Server folgenderweise (neu) starten:

 # rcdhcpd restart

Bitte beachten: Je nachdem, welchen TFTP-Server verwendet wird und ob er in einer Chroot-Umgebung läuft,kann "filename" ohne ein führenden Pfad-Element angegeben werden müssen. Für den Standard-TFTP-Server von openSUSE oder wenn ein RedHat-basierter Server verwendet wird, sollte "filename" so gelesen werden:

filename "pxelinux.0";

Mit dem ISC-DHCP-Server Version 3 (mitgeliefert in openSUSE) ist es möglich den DHCP-Server so zu konfigurieren, dass er nur auf Boot-Anfragen reagiert und mit diesem Weg läuft er parallel zu einem anderen Standard-DHCP-Server. Das kann erwünscht sein, wenn der Standard-DHCP-Server nicht so konfiguriert werden kann, dass er einen Boot-Server oder Boot-Dateinamen liefertr (das ist der Fall mit vielen DSL-Routern). Der PXE-Client wird DHCP-Angebote ignorieren, die keinen Boot-Server oder Boot-Dateinamen beinhalten. Unten ist eine komplette Konfigurationsdatei für dieses Szenario:

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-Konfiguration

Es wird empfohlen das Paket atftp zu verwenden, weil atftp der einzige freie TFTP-Server, der alle RFCs einhält, ist.

Auf openSUSE Leap reicht Folgendes aus, um den Socket mit aktiviertem atftp zu verwenden:

zypper in atftp
systemctl start atftpd.socket

Optional um den Socket nach dem Neustart aktiviert zu haben:

systemctl enable atftpd.socket

Es sind keine weiteren Änderungen an /etc/sysconfig/atftpd notwendig. Die Standard-root ist /src/tftpboot. Wenn eine Firewall verwendet wird, sollte sie udp/69 erlauben.

tftpd-hpa-Konfiguration

tftpd-hpa ist der TFTPD-Server von H. Peter Anvin, verfügbar im Paket "tftpd". In seinem Standard-Setup ist er so konfiguriert, dass er von xinetd gestartet wird und zum Verzeichnis, das in /etc/xinetd.d/tftp angegeben ist, chrooten wird, was meistens /tftpboot ist. Genauso müssen Optionen zum Laufen als unberechtigter Benutzer in /etc/xinetd.d/tftp hinzugefügt werden.


Einrichtung einer PXE-Boot-Umgebung

Alles bekommen

Bevor mit der Erstellung der PXE-Umgebung wirklich angefangen wird, muss man das Paket syslinux installieren. Dieses Paket bietet eine sehr hilfreiche Datei:

 /usr/share/syslinux/pxelinux.0

Wenn Sie syslinux nicht installieren können, kann diese kleine Datei hier heruntergeladen werden.

Bauen vom PXE-Boot

An diesem Punkt sollten Sie alles zum Bauen einer PXE-Boot-Umgebung haben. Erstellen Sie die initiale Verzeichnisstruktur unterhalb des TFTP-Root-Verzeichnisses (wie hier unten gezeigt):

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

Kopieren Sie die PXE-Bootstrap-Datei ins Verzeichnis tftpboot.

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

Erstellen Sie die PXE-Konfigurationsdatei mit der Editierung von /srv/tftpboot/pxelinux.cfg/default. Das ist meistens das Gleiche wie die Datei syslinux.cfg. Hier ist eine Muster-PXE-Konfigurationsdatei:

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/ 

Kopieren Sie den Kernel und die initrd (hier: linux, initrd, linux64, initrd64) nach /srv/tftpboot.

Bitte beachten: Wenn Sie einen Server basierend auf RedHat verwenden, wird die Standard-Konfigurationsdatei einige weitere Optionen für die Zeile, die mit "append" beginnt, brauchen:

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

Diese Konfigurationsdatei bezieht sich auf 2 wichtige Dateien: linux und initrd. Sie müssen aus dem Netzwerk openSUSE install Repository (oder einem Mirror) heruntergeladen werden. Merken Sie sich, dass es auf ihre Hardware (i386 oder x86_64) ankommt.

# cd /srv/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

Bitte beachten: Wenn Sie einen Server basierend auf RedHat verwenden, sollte ihre Verzeichnisstruktur für den tftp-server folgendermaßen sein:

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

Wenn diese Konfiguration verwendet wird, können Sie entweder "install" oder "install64" bei der Booteingabe eingeben.

Sie dürfen auch eine Boot-Nachrichten-Datei erstellen, die das Gleiche wie syslinux und isolinux verwendet, um die verfügbaren Boot-Optionen anzuzeigen. Um das zu machen, editieren Sie /srv/tftp/tftpboot/f1.txt und fügen hinzu:

Boot-Optionen:
  install   - Installation 32 bit i386 openSUSE Leap 15.1
  install64 - Installation 64 bit x86_64 openSUSE Leap 15.1

Dann editieren Sie /srv/tftpboot/pxelinux.cfg/default und fügen oben hinzu:

 DISPLAY f1.txt
 F1 f1.txt

Jetzt wird beim Booten statt nur dem Boot-Prompt folgendes angezeigt:

Boot-Optionen:
  install   - Installation 32 bit i386 openSUSE Leap 15.1
  install64 - Installation 64 bit x86_64 openSUSE Leap 15.1
 
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, it will load and start the graphical install system, which is same as the normal one. Continue installing as usual.

Troubleshooting

does not start the Graphical Install System

If your network environment has no DHCP server or misconfigured DHCP server, Please make sure your installation medium is available message is shown instead of graphical install system. If you faced such problem, follow this procedure:

  1. Select No for Please make sure your installation medium is available. Retry? message (TAB or cursor key to move cursor, enter key to select)
  2. Select your language for Select the language (note that it's scrollable; push down cursor key repeatedly)
  3. Select your keyboard map for Choose a keyboard map.
  4. Select Start Installation for Main Menu.
  5. Select Installation for Start Installation.
  6. Select Network for Choose the source medium.
  7. Select one of protocols for Choose the network protocol. If you want to use the official site of openSUSE, select HTTP.
  8. Select No for Automatic configuration via DHCP?.
  9. Enter an IP address and subnet mask for Enter your IP address with network prefix.; note that the subnet mask must be specified by CIDR style (i.e. "24" instead of "255.255.255.0").
  10. Enter a default gateway address for Enter your gateway IP address.. If you do not have one, leave empty.
  11. Enter a name (DNS) server address for Enter your name server IP address.. If you do not have one, leave empty.
  12. Enter a domain name for Enter your search domains. If you do not have one, leave empty.
  13. Enter a download site for Enter the name of the xxx server. If you want to use the official site of openSUSE, set download.opensuse.org (default).
  14. Enter a directory path in download site for Enter the directory on the server. Set distribution/(version)/repo/oss/ for official site of openSUSE.
  15. Select one for Do you need a username and password to access the xxx server?. Set No for official site of openSUSE.
    1. If you selected Yes for above, enter the username and password for Enter the user name.. and Enter the password...
  16. Select one for Use a xxx proxy?, according to your network environment.
    1. If you selected Yes, enter the proxy server address and port for Enter the name of the xxx proxy and Enter the port of the xxx proxy.
    2. Select one for Do you need a username and password to access the proxy?, according to your network environment.
      1. If you selected Yes for above, enter the username and password for Enter the user name.. and Enter the password...

If you finished it, Loading Installation System message will be shown and will start graphical installation.

Corrupted graphics or Text based YaST Loads Instead of X Server

Change the vga= value on the append line in /srv/tftp/tftpboot/pxelinux.cfg/default (values can be selected from VESA BIOS Extensions). If you specify the value by hex, it should be started with 0x. If you specify the value by decimal, set as-is (including values described earlier).


See also


External links