# PXE Boot, 0 byte file UEFI on several computers



## jardows (Aug 29, 2022)

I have been trying to setup a PXE boot server for FreeBSD.  I have followed the setup found in the Handbook, chapter 32.8. Diskless Operation with PXE, with the exception I have substituted loader.efi for pxeboot.  I have setup the NFS server and my exports file, and do successfully boot on two computers.  I have three other computers I have tested, and they all fail with the same message, that the boot file is 0 bytes.  

My exports file is this:

```
/b -ro -alldirs -maproot=root -network 192.168.0/24
```

I user OpnSense for my router/DHCP server, and have the DHCP services for LAN1 setup like this:







I have tried several different configurations after the initial didn't work, and have even tried non-uefi boot, which does not work on these computers either.  I am at a loss as to why these computers are not getting the file from the tftp file, but my other two are.  Does anyone have suggestions?


----------



## jardows (Sep 2, 2022)

Doing some troubleshooting, I'm looking at /var/log/xferlog
Here is the log for a successful boot:


```
Sep  1 19:33:03 server tftpd[9030]: Filename: 'FreeBSD/install/boot/loader.efi'
Sep  1 19:33:03 server tftpd[9030]: Mode: 'octet'
Sep  1 19:33:03 server tftpd[9030]: Got ERROR packet: User aborted the transfer
Sep  1 19:33:03 server tftpd[9032]: Filename: 'FreeBSD/install/boot/loader.efi'
Sep  1 19:33:03 server tftpd[9032]: Mode: 'octet'
Sep  1 19:33:03 server tftpd[9032]: 192.168.0.136: read request for //FreeBSD/install/boot/loader.efi: success
```

Now, here is a log for an unsuccessful boot

```
Sep  1 19:41:03 kranov tftpd[9048]: Filename: 'FreeBSD/install/boot/loader.efi<FF>'
Sep  1 19:41:03 kranov tftpd[9048]: Mode: 'octet'
Sep  1 19:41:03 kranov tftpd[9048]: 192.168.0.141: read request for FreeBSD/install/boot/loader.efi<FF>: File not found
```

Not sure why the <FF> after loader.efi in this case, but it is something to look into.  Any ideas?


----------



## richardtoohey2 (Sep 2, 2022)

BIOS/firmware the same level on all machines?  (I have no idea, just a thought.)


----------



## jardows (Sep 2, 2022)

richardtoohey2 said:


> BIOS/firmware the same level on all machines?  (I have no idea, just a thought.)


They are all different computers.  The ones that are not working are all slightly older, though I'm not sure if that would make a difference.  The two computers that are working are a Dell Latitude E5570 and a custom desktop with an Asus TUF X570 Plus motherboard.  The computers I've tried that don't work are a ECS B75 board, an Asrock AM1H-ITX, and a Dell Precision M4800.  The Dell's both have Intel Ethernet, while all the others have Realtek.  I borrowed a spare Latitude E5570 from work, and it booted without issue.  We have some other model of newer computers at work available as loaners, I may see about borrowing one of those for testing purposes.


----------



## richardtoohey2 (Sep 2, 2022)

You could try a Linux host and see if those machines work with that, but if they do it might not prove much (if Linux has some workarounds to handle such machines then you are none-the-wiser as how to fix for FreeBSD.)


----------



## covacat (Sep 2, 2022)

i don't know about efi+pxe but legacy pxe fails on lots of boxes i tried (i suspect loader runs out of memory) (it works with older loaders (from freebsd 10 or 11) or ipxe


----------



## wb7odyfred (Sep 19, 2022)

Looking at your setup, because I want to try put a TFTP server using PXE to boot GhostBSD.org/download 4 gigabyte .ISO file
I see the byte <FF> as a problem in the name resolution.  Should the TFTP server clean up this errant byte <FF> as not being a correct ASCII or UTF-8 character?




> Sep 1 19:41:03 kranov tftpd[9048]: Filename: 'FreeBSD/install/boot/loader.efi<FF>'
> Sep 1 19:41:03 kranov tftpd[9048]: Mode: 'octet'
> Sep 1 19:41:03 kranov tftpd[9048]: 192.168.0.141: read request for FreeBSD/install/boot/loader.efi<FF>: File not found





> Sep  1 19:33:03 server tftpd[9030]: Filename: 'FreeBSD/install/boot/loader.efi'
> Sep  1 19:33:03 server tftpd[9030]: Mode: 'octet'
> Sep  1 19:33:03 server tftpd[9030]: Got ERROR packet: User aborted the transfer
> Sep  1 19:33:03 server tftpd[9032]: Filename: 'FreeBSD/install/boot/loader.efi'
> ...



Why the difference between  names "kranov"  and "server"?

Are all BIOS setup into  GPT UEFI mode,  No Secure Boot,  No CSM mode?   You did not say either way, though I assume all are UEFI GPT boot mode.  The older BIOS might have problems with UEFI PXE boot mode.  Looking to hear your next findings, Sir.
How big is the loader.efi file you are trying to download?


https://forums.freebsd.org/threads/problem-with-isc-dhcpd-and-diskless-booting.82199/#post-556758
After a lot of digging trying everything, I found that the pxeboot and loader.efi was too big simply due to ZFS support.
So I did this after buildworld:
cd /usr/src/stand
make WITHOUT_LOADER_ZFS=YES clean
make WITHOUT_LOADER_ZFS=YES all
make WITHOUT_LOADER_ZFS=YES install DESTDIR=/vol/tftpboot/pxe0


And now it works, with my old GigaByte mainboard!


----------



## jardows (Sep 19, 2022)

wb7odyfred said:


> Looking at your setup, because I want to try put a TFTP server using PXE to boot GhostBSD.org/download 4 gigabyte .ISO file
> I see the byte <FF> as a problem in the name resolution.  Should the TFTP server clean up this errant byte <FF> as not being a correct ASCII or UTF-8 character?
> 
> 
> ...


The different names are just that I had planned on replacing my actual name with "server" for privacy reasons, and forgot to update the one posting.

Yes, all BIOS is UEFI/GPT only.

While I might have thought the older computers would be the source of the problem, I recently had the opportunity to take my work computer home, which is a much more recent HP ProBook 455 G8, and it too failed to PXE boot.  

My loader.efi is the standard file from the FreeBSD installation.  I don't recall what the exact size of the file is, but it didn't seem too large.  That being said, I don't know where to find what that limitation for PXE boot would be.  

Are you using ZFS to serve the tftp server?  I want to make sure that removing ZFS support from loader.efi doesn't create additional issues.  I'll try the customizing of the file you mentioned.


----------



## jardows (Sep 20, 2022)

Update for tonight.  I attempted recompiling the loader.efi and pxeboot as suggested.
Original loader.efi size is 872K, while the one without ZFS is 488K.  The pxeboot file went from 486K 398K.
Unfortunately, the Dell M4800 still did not boot, while the Latitude E5570 is booting off the network just fine.

The error messages in xferlog are the same as I posted above, so I am still stumped.


----------

