Just a note ... You can still use syslinux/pxelinux to do FAI installs for both EFI and BIOS. In other words, you don't have to switch to grub, you can still use the syslinux pxe config files you created via fai-chboot.

Here is a link to an article that shows how to get isc-dhcp-server to detect whether you are booting via EFI or BIOS and set the filename option appropriately:
https://www.syslinux.org/archives/2014-October/022683.html

I just modified my faiserver to support both EFI and BIOS yesterday. It turned out being way easier than I expected. The only changed I had to make to my various configurations were the following: 1: Make the dhcp server detect EFI boot vs BIOS and set filename option appropriately (see above). 2: Rename my FAI setup-storage config files (in the disk_config sub directory) based on the classes FAI already creates, GRUB_PC and GRUB_EFI.
3: Modify the GRUB_EFI setup_storage config file:
3a.  Chage thedisklabel from msdos to gpt
3b: Change all logical partitions to primary.

There is sample code in the fai-docs package that shows how to create those classes, GRUB_PC and GRUB_EFI. I'd guess most people are already using that. So the only change I had to make to my FAI config was to rename my disk_config files to match those classes and then make some minor changes to the disk-config file to work with gpt instead of msdos.



On 07/06/2018 08:19 AM, tt-...@kky.ttu.ee wrote:
Hi!

Just went through setting up UEFI boot over PXE and TFTP. Of great help in figuring out what was going on was to add logging to the TFTP server:

Kill the tftp server started at boot and manually start one with

# /usr/sbin/in.tftpd –vvv --listen --user tftp --address 0.0.0.0:69 --secure /srv/fai

or similar (check the startup script of in.tftpd, add –v’s generously).

Then you will see in the syslog, which files are being requested and whether they are actually being transmitted.

A successful UEFI boot with grub generates about 15 TFTP requests, starting with:

Jun 30 18:22:40 server in.tftpd[11435]: RRQ from 172.24.0.68 filename fai/efi/x86_64-efi/core.efi

Jun 30 18:22:40 server in.tftpd[11436]: RRQ from 172.24.0.68 filename /fai/efi/x86_64-efi/normal.mod

Jun 30 18:22:40 server in.tftpd[11437]: RRQ from 172.24.0.68 filename /fai/efi/x86_64-efi/extcmd.mod

[…]

A missing or misplaced file will show up as

Jun 30 18:22:40 server in.tftpd[11449]: RRQ from 172.24.0.68 filename /fai/efi/grub.cfg

Jun 30 18:22:40 server in.tftpd[11449]: sending NAK (1, File not found) to 172.24.0.68

Hoping this helps,

Toomas

*From:*linux-fai <linux-fai-boun...@uni-koeln.de> *On Behalf Of *Rémy Dernat
*Sent:* Friday, July 6, 2018 3:28 PM
*To:* linux-fai@uni-koeln.de
*Subject:* UEFI + Legacy BIOS TFTP/PXELINUX

Hi,

I am trying to set up an UEFI boot pxe mainly because our hardware servers do not support full legacy BIOS anymore (particularly hard disk plugin on those servers).

Our legacy pxelinux works just fine from a while now (and thanks for it).

I followed this link : https://lists.uni-koeln.de/pipermail/linux-fai/2014-February/010294.html

... with no luck. I created an "UEFI" specific class to avoid the erase of DEFAULT, and put everything in that new class, because we will need to keep the pxelinux config.

My tftp fai folder is organised like this:

```

root@faiserv:/srv# tree -L 2

.

├── fai

│   ├── config

│   └── nfsroot

├── nfs4

└── tftp

     └── fai

root@faiserv:/srv/tftp/fai# tree -L 2

.

├── c2960s-universalk9-tar.150-2a.SE9.tar

├── cisco-ios-150-2a.tar -> c2960s-universalk9-tar.150-2a.SE9.tar

├── efi

│   ├── fonts

│   ├── grub.cfg

│   ├── grub.cfg.nok

│   ├── i386-pc

│   ├── locale

│   ├── pxelinux.cfg -> ../pxelinux.cfg

│   ├── unicode.pf2

│   └── x86_64-efi

├── gpxelinux.0

├── initrd.img-3.16.0-4-amd64

├── initrd.img-3.16.0-6-amd64

├── ldlinux.c32

├── lpxelinux.0

├── pxelinux.0

├── pxelinux.0.back

├── pxelinux.cfg

│   ├── 0A01FD03

│   ├── 0A01FFF2

│   ├── A226B5A1.disable

│   ├── A226B5A2.disable

│   ├── A226B5A3.disable

│   ├── A226B5A4.disable

│   ├── A226B5A5.disable

│   ├── A226B5A6.disable

│   ├── A226B5A7.disable

│   ├── A226B5A9

│   ├── A226B5AA.disable

│   ├── A226B5AB.disable

│   ├── A226B5B0.disable

│   ├── A226B5B4.disable

│   ├── A226B5B8

│   └── default

├── syslinux.efi

├── vmlinuz-3.16.0-4-amd64

└── vmlinuz-3.16.0-6-amd64

```

I do not know if the UEFI is also searching for a filename matching its IP address with the hexa value, so I created a symbolic link to the pxelinux.cfg parent directory...

I have no problem with DHCP, and my client is loading the grub.cfg menu. However, it fails while searching for the nfsroot. The error I get (with debug=all) is (replacing sensitive informations):

```

kern/disk.c:196 : Opening `tftp,IP.IP.IP.IP'...

disk/efi/efidisk.c:461 : opening tftp

kern/disk.c: 281: Opening `tftp,IP.IP.IP.IP' failed.

kern/disk.c: 295: Closing `tftp'.

```

Here is my grub.cfg config :

```

root@faiserv:/srv/tftp/fai/efi# cat grub.cfg

set menu_color_normal=white/black

set menu_color_highlight=black/light-gray

set timeout=5

# for debug:

#set pager=1

set debug=all

insmod efi_gop

insmod efi_uga

if loadfont ${prefix}/unicode.pf2

then

     insmod gfxterm

     set gfxmode=auto

     set gfxpayload=keep

     terminal_output gfxterm

fi

menuentry "Install from FAI" {

     linux  vmlinuz-3.16.0-6-amd64 rw ip=dhcp root=/dev/nfs nfsroot=IP.IP.IP.IP:/srv/fai/nfsroot FAI_FLAGS=verbose,sshd,createvt,reboot FAI_ACTION=install server=faiserv.acme.ltd FAI_CONFIG_SRC=nfs://faiserv.acme.ltd/srv/fai/config

      initrd initrd.img-3.16.0-6-amd64

}

```

Any help would be greatly appreciated.

Thanks,

Rémy

Antwort per Email an