iPXE discussion forum
FTP chainloading a menu.ipxe - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: FTP chainloading a menu.ipxe (/showthread.php?tid=19547)



FTP chainloading a menu.ipxe - alhyene - 2019-09-15 03:03

Hello Everybody, it's my first post here. Smile

I'm in trouble chainloading a menu.ipxe by FTP
I've tried with and without EMBEDing script in ipxe.lkrn (compiled by hand or rom-o-matic with I think good options)

#!ipxe
dhcp
chain http://ftp.192.168.0.254/Disque%20dur/menu.ipxe

The script load then suddenly hang.
I must say I successfully boot a Linux one (kernel + initrd) by FTP.

ps: I must use FTP cause my Internet box have just a FTP inside.

Best regards.


RE: FTP chainloading a menu.ipxe - NiKiZe - 2019-09-18 01:44

ftp, no username or password are provided.

make sure that you really intent to use FTP and not TFTP.

Are you sure that you get a full hang, and not a error message of any kind? Have you tried running this from a shell, that is not using an embded script - which should always be what you test first before embedding (that is trying the basic parts in shell by typing it out)


RE: FTP chainloading a menu.ipxe - alhyene - 2019-09-18 02:19

Hi,

> ftp, no username or password are provided.

It's not a problem, I compiled ipxe with FTP debug enabled and it connect anonymous (user: anonymous , pass: ipxe@ipxe.org)

I've tested with password and it function as well:

initrd http://ftp.user:pass@192.168,0,254/Disque%20dur/rootfs.gz
kernel http://ftp.user:pass@192.168,0,254/Disque%20dur/bzImage64
boot

> make sure that you really intent to use FTP and not TFTP.

Nope... Really FTP.

> Are you sure that you get a full hang, and not a error message of any kind? Have you tried running this from a shell, that is not using an embded script - which should always be what you test first before embedding (that is trying the basic parts in shell by typing it out)

It don't hang, PC just reboot, no error message or no time to read.
Yes, I tried from shell.

EMBEDed script:

#!ipxe
dhcp
chain http://ftp.192.168.0.254/Disque%20dur/menu.ipxe

menu.ipxe (for testing):

#!ipxe
dhcp
shell

Also I can't do SANHOOK or SANBOOT with FTP.

Sad


RE: FTP chainloading a menu.ipxe - NiKiZe - 2019-09-18 13:34

san commands over FTP, probably to much of a nightmare.

Ok - so the actual error description that you should have in your opening post is: "when i chain over ftp, PC reboots"

When testing, I would use iPXE without embeded script.
add || shell at the end of your chain line - just to be sure that you get back to shell if it fails.

You might also want to use imgfetch instead of chain, followed by imgstat, to see that the script is detected correctly as an ipxe script and not a binary of some sort that it tries to run.
With that out of the way, my guess would be hardware issues, and I would start with running memtest to check for any issues with memory.


RE: FTP chainloading a menu.ipxe - alhyene - 2019-09-18 17:16

> san commands over FTP, probably to much of a nightmare.

Ok, I forget it by now...

> Ok - so the actual error description that you should have in your opening post is: "when i chain over ftp, PC reboots"

Then what to do ? Changing the thread name ?

> When testing, I would use iPXE without embeded script.
add || shell at the end of your chain line - just to be sure that you get back to shell if it fails.

Yes, I tried it by shell commands:
dhcp
imgfetch http://ftp.192.168.0.254/Disque%20dur/menu.ipxe
( FTP Ok )
imgstat menu.ipxe
( menu.ipxe : 22 bytes [PXE-NBP] ) <--- don't know if it's good
chain menu.ipxe || shell

At this point PC reboots.

menu.ipxe is a simple script:
#!ipxe
dhcp
shell

I will try memtest...


RE: FTP chainloading a menu.ipxe - alhyene - 2019-09-18 21:53

Ok, I've tested with HTTP and don't look the same.

In a shell I've tested:
dhcp
imgfetch http://boot.ipxe.org/demo (the ipxe script exemple)
( HTTP Ok )
imgstat demo
( demo : nnn bytes [Script] ) and not [PXE-NBP] like with FTP
chain demo
(boot ipxe demo)

Then I think something is broken in FTP.
Am I on right ?


RE: FTP chainloading a menu.ipxe - NiKiZe - 2019-09-19 04:45

You should see Script.
if PXE-NBP then it runs as binary code.
So you are using different files to test.... could you donwload the ipxe script example and put on your server as is and test that?
make sure that your script is a valid script with #!ipxe in ASCII as the first bytes.
If it is - I would start to use tcpdump on the FTP box, since that is the only way that you will see what is actually going on.


RE: FTP chainloading a menu.ipxe - cckp - 2019-09-19 06:48

(2019-09-19 04:45)NiKiZe Wrote:  if PXE-NBP then it runs as binary code.

sometimes it's just because of text format.

e.g.

http download a script text file like this:
Code:
#!ipxe
echo hi
will be shown as [Script] ) and not [PXE-NBP], and execute normally

but if this text file is saved as UTF-8 with BOM, i.e. EF BB BF added at beginning, then it'd be shown as [PXE-NBP], and executing it causes hang


RE: FTP chainloading a menu.ipxe - alhyene - 2019-09-20 00:33

Big Grin Yeah Men ! You're on right !

It's a stupid thing, I don't saw that with Nano editor.
I put da menu.ipxe ina hex editor, et voila : EF BB BF as header, then it crunch the magic #!ipxe.

Now it works and by now I will pay more attention on this...
Thanks again for your help. Wink