PXE-netboot-install

Differences between revisions 5 and 6
Revision 5 as of 2012-09-07 01:54:20
Size: 6196
Editor: ppp121-45-240-193
Comment:
Revision 6 as of 2013-01-08 21:58:37
Size: 7333
Editor: ua-178
Comment: Some fleshing out based on our experience getting this to work.
Deletions are marked like this. Additions are marked like this.
Line 36: Line 36:
  * Note that some modules may cause the installation to stall with a ''error: no device connected'' message, in this case you will need to remove the drivers giving the error. For instance, to remove the ''pata'' module, change the module listing part to `ls /usr/lib/grub/x86_64-efi | sed -n 's/\.mod//gp' | grep -v pata`
Line 64: Line 65:
 * Configure dnsmasq as both the DHCP and TFTP server, to serve PXE clients your custom bootx64-distro.efi image:  * Configure a way to hand IP addresses and TFP files to the clients. You can use a dhcpd/tftp combo, or dnsmasq as both the DHCP and TFTP server, to serve PXE clients your custom bootx64-distro.efi image. Dnsmasq is simpler and easier to set up than dhcpd and tftpd, here's how to set up dnsmasq :
Line 89: Line 90:
 * If you already have a working dhcpd/tftpd setup, just configure it to serve the .efi image to target Clients, by setting it as a host's "filename" parameter in dhcpd.conf. More details on this are out of scope for this document.
Line 90: Line 92:
  * The Server system is now prepared to serve bootx64-precise.efi to target Clients.
 * The Server system is now prepared to serve bootx64-precise.efi to target Clients.
Line 128: Line 129:
 * If you see a "error: variable `prefix' isn't set" message, it can be safely ignored. Really, it doesn't mean anything. If your installation is stalling and this is visible on-screen, you should look at the "next" error, that's the one actually stopping it form working. If it ''really'' bothers you, play around with the '-p' parameter to ''grub-mkimage'' and see you can make it go away.

UEFI PXE netboot / install procedure

Experimental method developed by Kamal Mostafa <kamal@canonical.com>

Interesting features of this method

  • Serves a UEFI-compliant "bootx64.efi" grub image to PXE clients via TFTP (as opposed to the legacy BIOS "pxelinux.0" method).
  • Does not need NFS (as is commonly used in conjunction with the pxelinux.0 method), because...
  • This method constructs a custom bootx64.efi image with the entire install iso embedded inside.

Install and configure the Server system

  1. Install a regular Ubuntu system + updates, or use an existing Ubuntu system as the Server. The Server can be any computer with a wired NIC; the Server itself does not need to be UEFI-capable. (I installed ubuntu-11.10-desktop-amd64.iso from a USB stick on to an x220 laptop, but any Ubuntu installation should work).
  2. On the Server system, fetch a netboot "mini.iso" image and save it with a distinct filename (or substitute a different Ubuntu distro for "precise"; see Notes below about Debian):
    wget http://ftp.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/mini.iso  \
                    -O /tmp/mini-precise.iso
  3. Generate a custom "bootx64-distro.efi" image with the mini-distro.iso embedded inside, and (Important!) with all available x86_64-efi grub modules enabled. You will move the generated .efi image file from /tmp to the tftpboot directory in a moment:
    • the ls|sed sequence generates the list of all modules.

    • many of the modules are actually required, but surely not all; I don't know which are or aren't required.
    sudo apt-get install grub-efi-amd64-bin
    
    grub-mkimage --format=x86_64-efi  \
                    --output=/tmp/bootx64-precise.efi   \
                    --memdisk=/tmp/mini-precise.iso  \
                    `ls /usr/lib/grub/x86_64-efi  | sed -n 's/\.mod//gp'`
    • Note that some modules may cause the installation to stall with a error: no device connected message, in this case you will need to remove the drivers giving the error. For instance, to remove the pata module, change the module listing part to ls /usr/lib/grub/x86_64-efi  | sed -n 's/\.mod//gp' | grep -v pata

  4. Configure a static IP address (e.g. 192.168.99.1) on the wired NIC (eth0):
    sudo vi /etc/network/interfaces
    Add these lines to /etc/network/interfaces:
    • auto eth0
      iface eth0 inet static
              address 192.168.99.1
              broadcast 192.168.99.255
              netmask 255.255.255.0

  • sudo restart network-manager
    
    sudo /etc/init.d/networking restart
  • Install apt-cacher-ng to provide http proxy service to the Clients:
    • alternately, configuring the server as a network gateway should work, but see Notes below.
    • apt-cacher-ng's proxy service will start automatically and listen on port 3142.
    sudo apt-get install apt-cacher-ng
  • Configure a way to hand IP addresses and TFP files to the clients. You can use a dhcpd/tftp combo, or dnsmasq as both the DHCP and TFTP server, to serve PXE clients your custom bootx64-distro.efi image. Dnsmasq is simpler and easier to set up than dhcpd and tftpd, here's how to set up dnsmasq :
    sudo apt-get install dnsmasq
    sudo vi /etc/dnsmasq.conf
    Add these lines to /etc/dnsmasq.conf:
    • interface=eth0
      bind-interfaces
      dhcp-range=192.168.99.10,192.168.99.254
      dhcp-boot=bootx64-precise.efi
      enable-tftp
      tftp-root=/var/lib/tftpboot

  • sudo mkdir /var/lib/tftpboot
    
    sudo mv /tmp/bootx64-precise.efi /var/lib/tftpboot/
    
    sudo /etc/init.d/dnsmasq restart
  • If you already have a working dhcpd/tftpd setup, just configure it to serve the .efi image to target Clients, by setting it as a host's "filename" parameter in dhcpd.conf. More details on this are out of scope for this document.
  • The Server system is now prepared to serve bootx64-precise.efi to target Clients.

PXE-install a target Client system

  1. Watch syslog on the Server with "tail -f /var/log/syslog"
  2. Power-on the target UEFI Client machine and get into its BIOS / boot manager menu, select the UEFI network boot option (perhaps called "EFI Network"; if more than one such choice is listed, select the IPv4 variant).
    • Server syslog should show Client acquiring an IP address and then loading your bootx64-distro.efi.
  3. Client will display a grub installer menu. Select the primary "Install" choice.
  4. When Client prompts for "HTTP proxy information", enter the following, which corresponds to the apt-cacher-ng proxy running on the Server (alternately, if you configured the server as a gateway instead of installing apt-cacher-ng, leave it blank):
    • http:/192.168.99.1:3142/
  5. Answer the remaining installer prompts, including (optionally) selecting additional software components to install above and beyond just the base OS.

Notes

  • If you don't select any additional software components when installing the Client (just the base OS), then after it boots you will be left at just a blinking cursor when the Ubuntu splash screen quits (a bug?)... Use Ctrl-Alt-F1 to get to a login prompt.
  • The installed Client system will remember the proxy server setting in /etc/apt/apt.conf -- remove that file from the installed Client if you don't plan to keep it attached to the server's network.
  • If you use apt-cacher-ng as described above, subsequent client installs using this Server will be much faster than the first client install.
  • My Intel SDP system with UEFI BIOS version TM_B8 or TM_B9:
    • ... hangs before loading grub on the soft reboot after the PXE-install completes, but after a ctrl-alt-del it then boots to grub fine.
    • ... exhibits a 60-second stall with a black screen after the grub menu (before it starts loading the kernel) when booting an Ubuntu UEFI filesystem from HDD or from USB stick. This was due to bug 944347 "linux and initrd load very slowly on UEFI system", now resolved.

  • It is possible to configure dhcp to offer different images to different clients based on MAC address and some other variables, which could be used to offer UEFI (bootx64.efi) and legacy BIOS (pxelinux.0) images, but this is not covered here.
  • This method seems like it should work with Debian wheezy's netboot/mini.iso also, but it doesn't quite; the Clients just boot to a grub> prompt instead of a grub installer menu. Perhaps wheezy's iso contains a grub.cfg someplace other than the /boot/grub dir that Ubuntu's grub expects?

  • If you see a "error: variable `prefix' isn't set" message, it can be safely ignored. Really, it doesn't mean anything. If your installation is stalling and this is visible on-screen, you should look at the "next" error, that's the one actually stopping it form working. If it really bothers you, play around with the '-p' parameter to grub-mkimage and see you can make it go away.

  • TBD: How can we pre-seed the install?
  • TBD: This method always feeds the client a single, pre-selected distro (e.g. "bootx64-precise.efi"). Is it possible to somehow allow the client to select which distro they want via a menu system (like with the pxelinux.0 install menu system?)

UEFI/PXE-netboot-install (last edited 2016-09-23 20:55:07 by cyphermox)