Is it possible to boot a client over PXE using custom Linux image using PXELINUX?


We use various IoT devices (Intel based processor) that use Linux as OS (Ubuntu to be specific). But we have customized OS based on our need (for example by adding our own applications, system configuration etc). Now, we are looking into possibility if we can boot off these devices using PXE as a fail-safe for local storage corruption (or just get away from that).

I am able to achieve this using standard Ubuntu images using TFTPD64 (on Windows) and PXELINUX. And I can selectively boot image for different devices based on their MAC IDs. But I am having hard time make it work for our image.

So my question is, how can I create custom image (or use any other mean) to boot our Linux system using PXE?

I created ISO using DD utility (over 4GB in size). But PXELINUX bootloader fails to even download that ISO.

  • PXE support in ARM is not a given.... – Rui F Ribeiro Apr 2 '18 at 18:00
  • 1
    sorry, I should have mentioned, its not ARM processor. Device that I want to use on has Intel processor. Updating my question to reflect that. – JackLock Apr 2 '18 at 18:02
  • 2
    A pxe loader wont book an ISO, it needs to boot a kernel. – Rui F Ribeiro Apr 2 '18 at 18:05
  • @JackLock I've posted answer with general steps to do what you want. If you want more specific info, then provide more info about doing following (in my answer) steps. I did PXE with custom images 2 month ago. Also you can see my post for snapshots capability over overlayfs on PXE: unix.stackexchange.com/questions/420646/mount-root-as-overlayfs/… – Yurij Goncharuk Apr 2 '18 at 18:57
  • @RuiFRibeiro I can access to whole file system so I can access kernel (vmlinuz) too. But what I don't understand is how to make it work. I am venturing into bit unknown territory so don't mind my unfamiliarity with terms. – JackLock Apr 2 '18 at 19:15

These steps helps to you boot your custom image:

1) You need decide location of your future root (/) (is being located entirely in network resource (i.e. NFS) or it will be loaded into RAM during the boot.

2) Prepare your initrd depends on step 1).

3) Place your kernel and initrd in TFTP server.

4) Change your /etc/fstab of your system image (it may be iso or squashfs or entirely unpacked on network resource).

Result boot sequence:

1) Kernel unpack initrd and pass control to it.

2) Initrd mount network resource (or copy to RAM (tmpfs) if loaded system will be entirely located in RAM).

3) Initrd return control to kernel and kernel loads init/systemd from mounted prepared root (/).

  • I am using Windows as my PXE server. So I am going to use "cifs" instead of NFS. And it really doesn't matter if we keep it on network or in memory. Question is, how do I edit my initrd file? And what is expected there? – JackLock Apr 2 '18 at 19:18
  • @JackLock Lets discuss this in chat: chat.stackexchange.com/rooms/75426/pxe-cifs – Yurij Goncharuk Apr 2 '18 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.