beta-tester / RPi-PXE-Server

setup a Raspberry Pi as an PXE-Server
307 stars 63 forks source link

Boot not working for EFI #6

Closed HarvsG closed 6 years ago

HarvsG commented 6 years ago

As referenced in #5, comment 4. I cannot get IPv4 UEFI boot to work. Initially, I suffered an error prompt from my BIOS "Selected boot image did not authenticate" then after disabling secure boot, I got an error "The selected boot device failed to load". Suggests the issue here is two-fold, firstly with secure boot an then with the PXE configuration.

After you (@beta-tester) pointed this out "did you removed the '#' in front of the efi32 and efi64 stuff i comment out?", I did so and that is what got me the "The selected boot device failed to load" error, initially I was only getting the "The selected boot device failed to load" error, even with secure boot enabled.

I am going to try with an iPXE device so I can get more detailed error reports and will update.

I am yet to test this "what you also can try is to offer the UEFI computer the UEFI compatible boot-manager-file directly (in dnsmasq) instead of offering the pxe-menu file. but then you don't have the choice anymore to select different OS'es for UEFI computers."

HarvsG commented 6 years ago

So I go the output of the logs from dnsmasq to see what the server was doing: May 27 22:44:31 dnsmasq-tftp[3761]: sent /media/server/srv/tftp/menu-efi64/syslinux.0 to 192.168.0.31 With repeated attempts, that was what I got nearly every time, so the DHCP must be working fine and it was sending syslinux.0 happily.

Once or twice i got the below errors, although not that often.

May 27 22:44:31 dnsmasq-tftp[3761]: failed sending /media/server/srv/tftp/menu-efi64/syslinux.0 to 192.168.0.31
May 27 22:44:31 dnsmasq-tftp[3761]: error 8 User aborted the transfer received from 192.168.0.31       

Going from these rescources [1],[2] it seems a .efi file is expected, and if it is to be secure boot compatible, a signed one at that. It seems grub would do, but does it suppport multiboot?

HarvsG commented 6 years ago

So I have made a few changes: on this fork. They are: 1 . Adds install for syslinux-efi package in the first script. https://github.com/HarvsG/RPi-PXE-Server/commit/90bd6277f57bdf914d743fc5b820ce8d35176fca

  1. Add a symlink for the .efi file that syslinux-efi installs. https://github.com/HarvsG/RPi-PXE-Server/commit/be38a7341801de4d1e410763b88203b7c5faebc0
  2. Make to relevant changes in the dnsmasq config https://github.com/HarvsG/RPi-PXE-Server/commit/95be45373432c5714e57e0e3e1a1ba85c5fd44d9 & https://github.com/HarvsG/RPi-PXE-Server/commit/c695cdf95ab559be6639e7902de0d75562ab86eb

It gets me past the error messages, to a frozen screen that reads like this:

>>>Start PXE over IPv4, Press [ESC] to EXIT...
    Station IP address is 192.168.0.31

    Server IP address is 192.168.0.35
    NBP filename is menu-efi64/syslinux.efi
    NBP filesize is 176208 Bytes
  Downloading NBP file...

    Succeed to download NBP file.
Getting cached packet
My IP is 192.168.0.31
_

Meanwhile the server logs are:

May 27 23:50:07 dnsmasq-dhcp[5725]: DHCP, proxy on subnet 192.168.0.35
May 27 23:50:07 dnsmasq-tftp[5725]: TFTP enabled
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 available DHCP subnet: 192.168.0.35/255.255.255.0
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 available DHCP range: 192.168.0.150 -- 192.168.0.200
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 vendor class: PXEClient:Arch:00007:UNDI:003016
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 PXE(eth0) xx;xx:xx:xx:xx proxy
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 tags: x64_UEFI, eth0
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 next server: 192.168.0.35
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 broadcast response
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 sent size:  1 option: 53 message-type  2
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 sent size:  4 option: 54 server-identifier  192.168.0.35
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 sent size:  9 option: 60 vendor-class  50:58:45:43:6c:69:65:6e:74
May 27 23:50:13 dnsmasq-dhcp[5725]: 3154604121 sent size: 17 option: 97 client-machine-id  00:35:43:44:33:34:35:37:5a:4d:4d:6c:c2:17...
May 27 23:50:17 dnsmasq-dhcp[5725]: 3154604121 available DHCP subnet: 192.168.0.35/255.255.255.0
May 27 23:50:17 dnsmasq-dhcp[5725]: 3154604121 available DHCP range: 192.168.0.150 -- 192.168.0.200
May 27 23:50:17 dnsmasq-dhcp[5725]: 3154604121 vendor class: PXEClient:Arch:00007:UNDI:003016
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 available DHCP subnet: 192.168.0.35/255.255.255.0
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 available DHCP range: 192.168.0.150 -- 192.168.0.200
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 vendor class: PXEClient:Arch:00007:UNDI:003016
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 PXE(eth0) xx:xx:xx:xx proxy
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 tags: x64_UEFI, eth0
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 bootfile name: menu-efi64/syslinux.efi
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 server name: 192.168.0.35
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 next server: 192.168.0.35
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 sent size:  1 option: 53 message-type  5
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 sent size:  4 option: 54 server-identifier  192.168.0.35
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 sent size:  9 option: 60 vendor-class  50:58:45:43:6c:69:65:6e:74
May 27 23:50:17 dnsmasq-dhcp[5725]: 4203663260 sent size: 17 option: 97 client-machine-id  00:35:43:44:33:34:35:37:5a:4d:4d:6c:c2:17...
May 27 23:50:18 dnsmasq-tftp[5725]: error 8 User aborted the transfer received from 192.168.0.31
May 27 23:50:18 dnsmasq-tftp[5725]: failed sending /media/server/srv/tftp/menu-efi64/syslinux.efi to 192.168.0.31
May 27 23:50:18 dnsmasq-tftp[5725]: sent /media/server/srv/tftp/menu-efi64/syslinux.efi to 192.168.0.31

~Baisically what I think is going on here is that these lines are copy-paste from the BIOS section, but should be a whole new set of files, unrelated to the BIOS ones installed by syslinux-commonhttps://github.com/beta-tester/RPi-PXE-Server/blob/383b85432b3b18ac43de0eb36f210eb4d1d1e229/install-pxe-server_pass2.sh#L1545-L1553~

edit: seems syslinux.efi might be bugged in syslinux-efi v6.03, causing a timeout, im not sure....

HarvsG commented 6 years ago

so I downloaded the syslinux v6.04-pre1 and manually updated just the .efi file and got a new error

>>>Start PXE over IPv4, Press [ESC] to EXIT...
    Station IP address is 192.168.0.31

    Server IP address is 192.168.0.35
    NBP filename is menu-efi64/syslinux.efi
    NBP filesize is 200208 Bytes
  Downloading NBP file...

    Succeed to download NBP file.
Getting cached packet
My IP is 192.168.0.31
Unable to locate configuration file
_

With the log output the same as before plus these additional lines:

May 28 01:06:09 dnsmasq-tftp[669]: sent /media/server/srv/tftp/menu-efi64/ldlinux.e64 to 192.168.0.31                                                     
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/35434433-3435-375a-4d4d-6cc2175fa130 not found                     
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/01-6c-c2-17-5f-a1-30 not found                                     
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a8001f not found                                                 
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a8001 not found                                                  
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a800 not found                                                   
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a80 not found                                                    
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a8 not found                                                     
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0a not found                                                      
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c0 not found                                                       
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/c not found                                                        
May 28 01:06:09 dnsmasq-tftp[669]: file /media/server/srv/tftp/menu-efi64/pxelinux.cfg/default not found

Seems I am making progress, will look further in the morning.

HarvsG commented 6 years ago

Success! Renaming the efidefault to default did the trick, all up and running! :)

Will update and put in a PR in the morning

beta-tester commented 6 years ago

it works?!.. oh man... that's phantastic! i wished i would have proper hardware to see that with my own eyes... 8-)

great, many thanks... i will try to implement your changes soon.

beta-tester commented 6 years ago

your changes are integrated now. see https://github.com/beta-tester/RPi-PXE-Server/commit/44d581a83f65099e87ec316f4c49dae3271e52ac

again, thank you very much for your help.

squadramunter commented 5 years ago

I have tried to boot with UEFI mode in BIOS settings but it did not work. I use Realtek controller to boot from it. My laptop is Asus K501LX. Booting from Legacy (CSM) does work but UEFI doesn't.