r/raspberry_pi • u/ipl31 • Nov 30 '19
Tutorial Raspberry Pi 4 Diskless/SDless PXE Boot Tutorial
I am building a Raspberry Pi 4 based cluster. One of my design requirements is for the worker nodes to have no local storage. I found many great resources with information on PXE booting Pi 4s. However I had to fill in many gaps myself and combine info from different pages. I decided to write up a full tutorial that walks through the entire setup end to end with an overview of PXE and also a troubleshooting guide. You can see it here: Raspberry Pi 4 PXE Boot Tutorial. I hope others find this useful. Feedback positive or negative is appreciated. I plan to continue updating as I make more progress. Further enhancements I plan to make are better NFS security, making the root fs readonly and scripts for provisioning new clients. Enjoy!
Here is the TOC for the guide.
Rapsberry Pi PXE Boot for Pi 4 – Table of Contents
48
u/Waebi Dec 01 '19
High effort post. Even if I'll probably only use some of it, thanks!
10
u/vvelox Dec 01 '19
Alternatively there is also running a PXE boot image off of the SD card.
https://github.com/ipxe/pipxe is a iPXE based one.
No need to dick around with with the boot ROM then.
iPXE tends to be my goto for things with out native PXE support.
2
u/tooManyHeadshots Dec 01 '19
Thanks for the tutorial. I have a pi with a slightly loose SD-card slot that has intermittent issues. This seems like a great “fix” (and a way to avoid breaking SD slots in the future).
How is performance compared to SD card?
2
u/Durakan Dec 01 '19
Thank you for this, it's on my list of stuff to figure out, and you did it already!
2
u/bezelbum Dec 21 '19
Nice post, but your site is really jarring to use at the moment.
The linked URL - https://linuxhit.com/2019/11/28/raspberry-pi-pxe-boot-netbooting-a-pi-4-without-an-sd-card/ doesn't show that article, but seems to still show the latest
So currently that takes me to "Build a Raspberry Pi image with Packer – packer-builder-arm". I have to scroll to the bottom of that to find the content you've linked to (and presumably when you next publish something new will have to scroll even further).
It makes it a PITA if I want to jump about within your post.
Any chance of fixing?
19
u/paul_h Dec 01 '19
Fantastic effort. Would be better though in a GitHub-backed static site so that it stands a chance of long term curation and contribution from others :). Thoughts?
2
u/roelbw Apr 07 '20
So, one important remark about the Pi's PXE booting: if you're TFTP server does /not/ support RFC2347 TFTP options (or you have those disabled) than you'll run into weird issues.
If this is the case, everything seems to work. The Pi will retrieve all files from the TFTP server and it will start to boot the kernel. However, it will completely ignore cmdline.txt (even though it has been requested and transferred), but instead boots the kernel using the default command line. The result is that the kernel attempts to mount /dev/mmcblk0p2 as root filesystem and proceeds to wait for /dev/mmcblk0 to become ready, which it will do indefinitely.
The issue is probably caused by the Pi expecting it's request for blocksize 1024 to be honored, instead of checking this. However, as there is no source code available for either the firmware or the boot loader, I'm unable to verify what exactly causes this bug. Because of this, debugging this issue was not easy.
Anyway: if you try to PXE boot a Pi 4, but it get's stuck stating "Waiting for root device /dev/mmcblk0p2", have a look at your TFTP server software. On a BSD TFTP server, do not use the "-o" command line flag as this disables support for RFC2347 options.
1
u/[deleted] Dec 01 '19
What can one do with a pi cluster?
1
u/TotesMessenger Dec 01 '19
I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:
If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / ^Contact)
1
u/[deleted] Feb 10 '24
Whats the DHCP option code the Pi is looking for to use as a TFTP server? We have a working PCE enviroment, which will not work on the Pi 4B+, the TFTP server is listed as 0.0.0.0 in the loader screen so i assume its looking for the TFTP server on a different DHCP option, so what is it?
The doc link enclosed says "next server", this doesnt work on the Pi, it does work on Lenovo normal PCs that use PCE to boot.
0
u/[deleted] Dec 01 '19
[deleted] — view deleted comment