2

I'm in the process of setting up a compute cluster with the intent of using it for some parallel computing experiments. I have a single executable which I'd like to run on this cluster.

Due to operational constraints on said cluster I can only deploy this executable as a PXE boot image. Unfortunately, the only "ready-made" images I've been able to find are installation ones intended to install a particular distro. They don't particularly appear easy to modify.

Can someone perhaps provide some pointers as to how I could go about creating a pxelinux image that loads the linux kernel and subsequently run an executable?

  • Is your executable its own operating system?! – Michael Hampton Jul 13 '18 at 17:11
  • @MichaelHampton No, it's not. It's a program I compiled and have all required shared libraries for, so it should run on any linux distro. – Bartvbl Jul 13 '18 at 17:12
  • Well, then you can just PXE boot your favorite Linux distro. – Michael Hampton Jul 13 '18 at 17:16
  • @MichaelHampton I'm sorry if it's a dumb question, but how do I include my program in the files being distributed to the machines, and subsequently have the machines execute it once they have finished booting? – Bartvbl Jul 13 '18 at 17:20
  • Instead of booting the kernel/initrd for the installer, you boot the kernel/initrd for an installed system. Your distro's documentation should explain how to install the OS for PXE booting and root filesystem on the network. – Michael Hampton Jul 13 '18 at 17:21
1

Using ubuntu-18-x86_64-initrd.gz:

wget http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz
gzip -d initrd.gz
mkdir image
cd image
cpio -idmv < ../initrd

Now copy your executable, required shared libraries, and other files needed by your executable into image/. Edit etc/inittab. You probably want to remove ::sysinit:. Change ::respawn: to be an invocation of your executable.

find . -print0 | cpio --null -ov --format=newc | gzip -9 > ../initrd-bionic-foo.gz

Copy initrd-bionic-foo.gz to your tftp server. Sample pxelinux.cfg entry:

default foo
label foo
kernel boot/Ubuntu-18.04-x86_64-linux
append initrd=boot/initrd-bionic-foo.gz

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.