Booting Slax Linux from OpenWrt PXE server

First of all, if you don’t know what is Slax, it’s a highly usable and compact slackware based GNU/Linux live CD distro just around 230 MB. It’s one of the most complete and flexible live CD around, with a stripped down KDE 4 desktop and precisely chosen applications. If you don’t have it, download and try it from the official site .

Despite it’s small size, Slax provides many features like copy to ram, load user made changes, act as a PXE boot server to boot other systems over network etc. etc. Installing and managing software packages is very easy, squashfs based software packages are highly modular.

Lets start, booting Slax from a CD or USB drive is easy, but it could not be used to boot from network with the standard initramfs image(initrfs.img in this case). The standard Slax initramfs is very small(~ 750 KB) compared to other Linux distros, without any networking support, though enough for booting from CD/DVD or USB drive.

So we need a different initramfs image with networking support and different init script. How to generate this special initramfs image ?

This is another extension of main article about OpenWrt PXE server , so it’s good to have a look there before going further.


1. Generate PXE boot capable initramfs

The Slax initramfs is called initrfs.img , there is a nice shell script named pxe under the /sbin directory in Slax live to generate it automatically. To generate this, you have to boot Slax live CD and run


Now copy the pxe boot capable initrfs.img file from the /var/state/dnsmasq/root folder to the OpenWrt PXE boot server. I did it by running Slax Live in Virtualbox and copied it to a USB drive.

cp /var/state/dnsmasq/root/initrfs.img /media/sdb2/initrfs_pxe.img 
cp /var/state/dnsmasq/root/PXEFILELIST /media/sdb2/

Note: Both of these commands are meant to be run on the Slax live environment and make sure that you changed the commands according to your system.


2. Copy the Slax data

This step depends on your Slax download, if you downloaded the zip archive simply unzip it to the right partition of the USB drive. Or if you downloaded the ISO file, loop mount it some where and copy the data. This step is to be done on a PC running any Linux distro.

sudo mount slax_7.0.8.iso /mnt/

cp -r /mnt/slax/ /media/user_name/drive_name/  # example

cd /media/user_name/drive_name/

mv initrfs_pxe.img slax/


Note: Dont forget to modify the commands which matches to your system. Now unmount the USB drive from the PC and connect it to the OpenWrt router.


3. Create the pxelinux configuration

Now write the pxelinux configuration for the OpenWrt PXE boot server to boot Slax, assuming you have read the the previous guide of setting up OpenWrt PXE boot server. This step is to be done on the OpenWrt router.

Just one thing to do before editing the configuration, the PXEFILELIST contains name of the Slax data to be downloaded from the http server.

cd /mnt/sda2

mv initrfs_pxe.img slax/


ln -s /mnt/sda2/slax/ /mnt/sda2/PXEboot/

Edit the /mnt/sda2/PXEboot/pxelinux.cfg/default file and add the configuration bellow

KERNEL /slax/boot/vmlinuz
APPEND initrd=/slax/initrfs_pxe.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=xmode


4. Setup a HTTP server at port 7529 in OpenWrt

The Slax LiveKit init script will download the Slax data files from a HTTP server running at port 7529. Creating a lightweight HTTP server with OpenWrt is very easy with the uhttpd . There is a good probability that your system has uhttpd installed, if not install it.

 opkg install uhttpd 

Now start the server at port 7529 binding all available interfaces

 uhttpd -p -h /mnt/sda2/slax/ 

Check if the HTTP server is working or not

 wget -q -O - 

To start the http server automatically at boot up, add this line bellow

 uhttpd -p -h /mnt/sda2/slax/ 

at the /etc/rc.local file before the exit 0 line.

Now boot up a PC or virtual machine from the OpenWrt PXE server and select the Slax PXE to test this setup. There are many way to setup a small HTTP server, read more here.


5. TO DO

This setup could not load or save the any user made change form the changes.dat file, this thing needs to be fixed.

It seems that currently the Slax copy to ram feature doesn’t work while booting from PXE server. But the system will be as responsive as running from ram, because all the Slax squashfs modules (sb files) are downloaded to RAM. Checking this with the command.

 losetup -a 


This little guide will help you to boot Slax from a PXE server, please leave your suggestion or question through the comments. If you find this tutorial useful, please share it with your friends.

4 Responses

  1. Miguipda says:


    nice tutorial.

    1) at point 3. you wrote “OpwnWrt” in place of “OpenWrt”.

    2) the point 5. must be analysed to allow us to keep changes.

    3) one thing that I still does not know. Does pxe boot distribution allow to get them in “toram” loading mode ? That will then give us a responsive distribution.

    4) as already explained Porteus is also a great distribution that work like Slax (and was used by users when Slax was sleeping too long for new version). I means that copying the iso content will give you a bootable distribution. I presume then the pxe config file will be similar or also easy to create.

    But … because there is a but, I do not know if Slax is like Porteus with updating programs. Because even if it is only needed to copy the compressed file to get a working package it is difficult to have (by example) the last Firefox version (then stay in secure mode).

    Please continue to share us this great multiboot pxe (with interesting distributions like Tails and Slitaz that give security and quick start with responsive interaction.

    Have a nice day.

    Miguipda 😉

    • Arnab says:

      First, thanks again for spotting the mistake, my quirky mind always tends to type something wrong

      I’m also experimenting to load and save the changes over PXE boot.

      I forgot check toram function over PXE before writing it, I’ll update it very soon.

      Yes Potreus is more updated than slax, but somewhat bigger than Slax, so didn’t downloaded it !

  2. Miguipda says:

    Hi again,

    I just found now the information concerning the Slitaz pxe at

    Have a nice day and give us your next tutorial concerning pxe Slitaz through an OpenWRT server 😉

    Have a nice day.

Leave a Reply

Your email address will not be published. Required fields are marked *