03

January
2013

How PXE boot works in Slax

If Slax is started with the boot option "Act as PXE server", it executes /sbin/pxe script during startup (in between runlevel 3 and runlevel 4). The pxe script has several goals. First of all, it takes the current initramfs directory tree from currently running Slax (from /mnt/live), adds to it all currently available network drivers from /lib/modules/ from the currently running Slax system, and packs everything into a new initramfs image, which is much bigger than the original one (since it contains all the drivers). It is stored in /var/state/dnsmasq/root/initramfs.img). This image is packed by gzip rather than xz because gzip has much better compression speed, and we don't care about compression ratio here, the size actually doesn't matter so much.

When the new initramfs image is created, Slax data files are symlinked to /var/state/dnsmasq/root/* so the files can be downloaded by the client machines later.

Finally, several services are started in background, such as DHCP, TFTP and HTTP. This ensures that the client machines get IP address assigned properly and are instructed to download vmlinuz and initramfs.img over TFTP from the server. Later, the client machines will download Slax data files over HTTP (which is much faster than TFTP in general) and Slax is started on the clients.

Update

If you have your own existing PXE server and just would like to boot Slax on your client machines by using it, you can actually do that too, but it is a bit tricky. First of all, you'll have to boot Slax acting as PXE server, and locate files in /var/state/dnsmasq/root/. You'll see initrfs.img image there and a link to vmlinuz. These two files must be served by your own PXE server over TFTP. Next, you'll have to setup a webserver on the same machine where your PXE server is running, on port 7529 (this number appears if you type SLAX on your mobile phone). Your webserver must provide PXEFILELIST file as you can find it in /var/state/dnsmasq/root/ as well as the data files listed in the PXEFILELIST.

User comments
Mark De Silva 2013-01-04 00:59

Actually you don't have to run slax as a PXE first, run it normally, open konsole and type:

/sbin/pxe

it will generate a whole load of softlink files in /var/state/dnsmasq/root/ together with the new initrfs.img and the PXEFILELIST. The also in konsole do:

cd /var/state/dnsmasq/root/
tar -zcfh /tmp/dnsmasq-root.tgz *

the 'h' argument in the tar command will causes tar to archive the actual files that the symbolic links point to, instead of just the links themselves, so your /tmp/dnsmasq-root.tgz will contain all the actual necessary files.

Copy the /tmp/dnsmasq-root.tgz you've just created to your PXE server and untgz (tar -zxf) it to your PXE web server's root and you should be good to go.

Shantanu Gadgil 2013-01-04 01:07

Hi,
I usually loopback mount the ISO files instead of copying the data out. I guess I was providing the 'smaller' initrfs.img.

Now I have put the correct initrfs.img file on the TFTP server:
# md5sum *
b805cc78fecb43e909562dc1474405b3 01-core.sb
076a5c1412a04a00a1c8619b389c123c 02-xorg.sb
ba13de858fa75977af90fa1973145c51 03-kdeps.sb
32365b5e37c0b76eaecd504dd009b9c6 04-kde.sb
10fe81d1d155f6092af4089f87f16293 05-kapps.sb
43d9e06ba491a44da42f416c36d43b77 06-devel.sb
63148419b809e9cad1fc4cc62e8d6cd5 07-ffox.sb
5b950092b5a8b672036d110fd7135e61 initrfs.img
809ed4b7bcbe54d3a74a283e07d578d8 PXEFILELIST
1c7a79e1e1f272043ac10496a3a9702c vmlinuz

I am serving the same directory using mongoose web server on 7529. (My Apache runs on standard port 80)

The PXE client is still stuck on the "Looking for slax data in /slax ......" line and then drops to shell.

My (a bit modified) 'default' file contents are:

label slax-7.0.3-i386
menu label Slax 7.0.3 (i386)
kernel os/slax/7.0.3/i386/vmlinuz
initrd os/slax/7.0.3/i386/initrfs.img
append vga=773 load_ramdisk=1 prompt_ramdisk=0 rw printk.time=1 slax.flags=perch,xmode

Q: How does the booting initrfs know which IP to query for the "PXEFILELIST" ???
Q: Can I not set the port and http PATH for the .sb file so that I can "reuse" my loopback mounted data?

Regards,
Shantanu

Tomas M 2013-01-04 01:15

There are some more files needed for PXE boot, namely the file pxelinux.0 and others. That is the boot loader file which is sent over PXE and which handles the loading of vmlinuz and initrfs.img. It is also responsible of adding special boot parameter at the end of kernel cmdline, which is:
ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>

If Slax (livekit in general) detects this ip= boot parameter, it assumes PXE boot, parses it for values and tries to load data from the given http server. It actually understands even one more option for port, so if you're going to specify this boot parameter manually you may add port at the end, like:
ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>:<http-port>

Shantanu Gadgil 2013-01-04 01:35

Hi,
Silly me ... I should have copied the "default" file from the PXE server mode SLAX.

Was about to post that things are working after "ipappend 1" :) :) :)
--- snip ---
label slax-7.0.3-i386
menu label Slax 7.0.3 (i386)
kernel os/slax/7.0.3/i386/vmlinuz
initrd os/slax/7.0.3/i386/initrfs.img
append vga=773 load_ramdisk=1 prompt_ramdisk=0 rw printk.time=1 slax.flags=perch,xmode
ipappend 1
--- snip ---

I have a few queries, though:
Can I somehow specify the HTTP sub path and port, so that I dont have to run yet another webserver on 7529?
I don't really want to specify all the 'ip' parameters. Can I not leave them blank? something like "ip=::::80" (four colons)

Shantanu Gadgil 2013-01-04 01:44

Hi,
I added the following line to the 'append' parameter (just to see if it works)
"ip=192.168.1.100:192.168.1.1:192.168.1.1:255.255.255.0:80"

I temporarily stopped my mongoose web server ... and the installation fails.
This doesn't query the port '80' of my HTTP server :(
I never see anything in the error_log file for my apache.
(I mean, I am expecting an error for the file PXEFILELIST file)

Would I need the 'pxelinux.0' from the SLAX server? I am currently using 4.06 as released from the main website.

Regards,
Shantanu

Shantanu Gadgil 2013-01-04 02:16

Hi,

I added a NameVirtualHost and VirtualHost on port 7529 to my Apache config.
This is for my custom path location.

This is really really sweet and I am going to be advertising this to people as much as possible in the near future!!!

Awesome work!!! Much appreciated!

Now I just need to load up on more software bundles so that I can to "sysadmin" activity using Slax 7!!! :) :)
(Use SLAX as an alternative to quickly pa

Shantanu Gadgil 2013-01-04 02:17

the last part of the message is:

"... quickly partition, reimage etc."

Thanks and Regards,
Shantanu

softy 2013-01-04 05:07

Of the topic sorry
I need Java jdk module
please help .

jcsoh 2013-01-04 05:41

Convert from a console using txz2sb or tgz2sb

http://slackfind.net/en/packages/search/?name=jdk&distversion=

softy 2013-01-04 05:56

Thanks

Petr Bednář 2013-01-04 07:44

I have been tested Slax on my Asus Eee and not working at all. :-(

Mark De Silva 2013-01-04 07:47

@Petr, we'll need more details than just "not working at all" if we are to try to help.

How exactly did you create your slax bootable device (CD? USB?)

Can you boot Slax at all?

What are the errors you have?

Richard Ivy 2013-01-04 16:18

richardpivy

why is it that every time i try to install a program i have to go to windows to get it properly installed i have used slax off of my flash drive for along time but have had to install it a couple of times for one reason or another but i always have to go to the windows program to get it installed. my question is when are you going to make a copy of slax that i can copy to any old flash drive and have it install itself. it seems to me that something is wrong with the computing world if windows is the only system on the market that you can put a disk into a machine and it will do everything for you to operate the machine entirely. the only thing i have ever really had to do to my windows is put in the oem number and maybe drink some coffee. when is slax going to get up to speed with a self booting self installing system and get away from windows. until then i am afraid you will never really be a totally independnt company and neither will any of the other linux programs as long as they are dependent on a microsoft program to be installed or booted to. maybe you should change your name to microsoft dependent unix slax ubuntu yadda yadda yadda.. get with the program people show some independence. you try to promote you program as better that windows but you need windows to install it. seems like there is something wrong with that sentence.

Atakan Çal 2013-01-05 00:20

I have just translate some texts fo slax.org. How can ı post that to you?
::example::
http://www.slax.org/en/download.php
--------------İn Turkish --- Türkçe olarak

Slax Ä°ndir
Klavye düzenleri, çevirileri, fontları ve sistem ayarlarıyla 50'den fazla dilde Slax mevcuttur. Slax; Masaüstü, Müzik dizini gibi iyi bilinen
klasörlerin yererleştirilmiş isimleri için XDG Base Directory Specification'ı baz alır.
Aşağıdakilerden seçiminizi yapın ve kendi dilinizdeki Slax ile eğlenin.

Prcek 2013-01-05 00:49

Richard Ivy: What windows program are you talking about? I installed my Slax from linux, I didn't use any windows program at all. All you need to do to install Slax is unzip the archive and run one script. I don't see why you would need windows for that.

jcsoh 2013-01-05 01:40

If you use a knife and cut your finger , you can blame yourself for been careless , the knife for been too sharp , or whatever you are cutting for been too hard /slippery , or the cutting surface for been slippery , the air in the kitchen for been too dusty (hence obstructing your vision) , the movie you watch till late last night for making you lacking in sleep and hence reduced your concentration , your home school teacher for not teaching you on knife safety ....blah ... blah

By comparision if you need to use window to install slax , blame Bill (you know which Bill) for "converting" Tomas to "window worshiping" , slax for been too lame , the computer hardware for been crapy , the manufacturer, blah blah...

Or you could just evaluate you linux /slac knowledge ?
Or better still post on Slax's forum for and answer
Or use the Search function

Constructive criticism is welcome.

"maybe you should change your name to microsoft dependent unix slax ubuntu yadda yadda yadda." Sarcasm is not.

If the time come when Slax no longer suit my need or I find something better , it would not change the debt I own from slax 5.18 till slax 6.12.
I am grateful for been able to use and evaluate if for free and at no obligation.

The jury on Slax 7 is still out.

Mark De Silva 2013-01-05 04:12

*Thumbs UP* for JcSoh's post!

tdmsilvino 2013-01-05 10:54

*Thumbs UP* for JcSoh's post! +2

Jerzy Glowacki 2013-01-05 18:58

@Tomas,

Error in bootinst.sh. USB device or hard disk is not bootable (filesystems ext2,ext3,ext4 ...), if there is ... no bootable flags set.
Line in section # Toggle bootable flags:
fdisk -l "$DEV" | fgrep "*" | fgrep "$DEV" | cut -d " " -f 1 \

Necessary changes:
fdisk -l "$DEV" | fgrep "$DEV" | cut -d " " -f 1 \

Best regards,
jgl

jcsoh 2013-01-05 21:15

Jerzy

Are you sure ? Usually linux partition don't need bootable flag set. Otherwise how have user been dual booting with window os. The bootable flag is alway set to window partition.

Tomas M 2013-01-05 21:51

@Jerzy: the script actually removes all existing bootable flags from the given device (from all partitions) and then it sets the bootable flag for the only partition where Slax is installed. After rechecking the script it seems to me it's written properly. If you remove the fgrep part as you suggested, it will actually toggle bootable flag for all partitions (thus all those without the bootable flag will be marked as bootable, even those which should not boot) which is incorrect behavior.

Liquid Snake 2013-01-06 00:50

Off-topic: Tomas, did you change any setting about aufs or tmpfs in version 7.0.3? I tried to compile a new kernel and, when I try to patch the kernel with aufs, I get:

patching file Documentation/ABI/testing/debugfs-aufs
patching file Documentation/ABI/testing/sysfs-aufs
patching file Documentation/filesystems/aufs/README
patching file Documentation/filesystems/aufs/design/01intro.txt
patching file Documentation/filesystems/aufs/design/02struct.txt
patching file Documentation/filesystems/aufs/design/03lookup.txt
patching file Documentation/filesystems/aufs/design/04branch.txt
patching file Documentation/filesystems/aufs/design/05wbr_policy.txt
patching file Documentation/filesystems/aufs/design/06mmap.txt
patching file Documentation/filesystems/aufs/design/07export.txt
patching file Documentation/filesystems/aufs/design/08shwh.txt
patching file Documentation/filesystems/aufs/design/10dynop.txt
patching file Documentation/filesystems/aufs/design/99plan.txt
patching file fs/aufs/Kconfig
patching file fs/aufs/Makefile
patching file fs/aufs/aufs.h
patching file fs/aufs/branch.c
patching file fs/aufs/branch.h
patching file fs/aufs/conf.mk
patching file fs/aufs/cpup.c
patching file fs/aufs/cpup.h
patching file fs/aufs/dbgaufs.c
patching file fs/aufs/dbgaufs.h
patching file fs/aufs/dcsub.c
patching file fs/aufs/dcsub.h
patching file fs/aufs/debug.c
patching file fs/aufs/debug.h
patching file fs/aufs/dentry.c
patching file fs/aufs/dentry.h
patching file fs/aufs/dinfo.c
patching file fs/aufs/dir.c
patching file fs/aufs/dir.h
patching file fs/aufs/dynop.c
patching file fs/aufs/dynop.h
patching file fs/aufs/export.c
patching file fs/aufs/f_op.c
patching file fs/aufs/f_op_sp.c
patching file fs/aufs/file.c
patching file fs/aufs/file.h
patching file fs/aufs/finfo.c
patching file fs/aufs/fstype.h
patching file fs/aufs/hfsnotify.c
patching file fs/aufs/hfsplus.c
patching file fs/aufs/hnotify.c
patching file fs/aufs/i_op.c
patching file fs/aufs/i_op_add.c
patching file fs/aufs/i_op_del.c
patching file fs/aufs/i_op_ren.c
patching file fs/aufs/iinfo.c
patching file fs/aufs/inode.c
patching file fs/aufs/inode.h
patching file fs/aufs/ioctl.c
patching file fs/aufs/loop.c
patching file fs/aufs/loop.h
patching file fs/aufs/magic.mk
patching file fs/aufs/module.c
patching file fs/aufs/module.h
patching file fs/aufs/opts.c
patching file fs/aufs/opts.h
patching file fs/aufs/plink.c
patching file fs/aufs/poll.c
patching file fs/aufs/procfs.c
patching file fs/aufs/rdu.c
patching file fs/aufs/rwsem.h
patching file fs/aufs/sbinfo.c
patching file fs/aufs/spl.h
patching file fs/aufs/super.c
patching file fs/aufs/super.h
patching file fs/aufs/sysaufs.c
patching file fs/aufs/sysaufs.h
patching file fs/aufs/sysfs.c
patching file fs/aufs/sysrq.c
patching file fs/aufs/vdir.c
patching file fs/aufs/vfsub.c
patching file fs/aufs/vfsub.h
patching file fs/aufs/wbr_policy.c
patching file fs/aufs/whout.c
patching file fs/aufs/whout.h
patching file fs/aufs/wkq.c
patching file fs/aufs/wkq.h
patching file fs/aufs/xino.c
patching file include/linux/aufs_type.h
patching file fs/inode.c
patch: setting attributes for fs/inode.c.oFGdVDS: Operation not supported

So, the aufs is not shown in make menuconfig. I searched about the error and I found out that it is some kind of filesystem error. So, I created an ext4 block in my harddrive, copied everything there and the patch worked properly.

I used Slax 7.0 to compile the kernel I use now. Did you change anything about aufs or tmpfs, so it could cause the problem of patching does not support change of file permissions in 7.0.3?

Liquid Snake 2013-01-06 01:00

Even if I use chmod 644 fs/aufs/*, the aufs does not appear in make menuconfig. I must create a separate filesystem, like ext4, just to patch the kernel. So, I can copy that to /root and keep compilation from there.

Tomas M 2013-01-06 02:39

That is odd. Are you actually compiling that while running Slax?
In /root ? Do you have persistent changes active?

Emanuele Rogledi 2013-01-06 04:30

Many thanks for PXE support!

Liquid Snake 2013-01-06 10:10

@Tomas: yes, I am compiling it in Slax. The same error occurs in two versions of kernel: /root/linux-3.5.4 and /root/linux-3.6.11.

I do not use changes.dat. Only rootcopy. I was able to compile the kernel because I created an ext4 block in my harddrive, patched the kernel, copied to /root and did the rest in there.

Tomas M 2013-01-06 10:12

Can you see any error in dmesg when the chmod problem occurs?

Liquid Snake 2013-01-06 10:19

@Tomas: if I boot Slax's original kernel, the problem does not happen. So, it is my mistake, in my own configuration of kernel. Sorry for disturbing you.

Tristan 2013-01-07 04:51

I've extended the PXE setup to keep the bundles on the remote server. An overview:

Instead of fetching PXEFILELIST and the files named therein, I export a directory containing slax from the server:
mount -t 9p $SERVER $1 # or other network file protocol

chmod -x /etc/rc.d/rc.networkmanager # to prevent it disconnecting itself

Overall it's much much cleaner than before, and I'm looking forward to removing the firewall rules that kept the normal web server happy.

Sadly the setup is still too memory-hungry for our older machines (KDE4 + (general public) web browsing is painful in 256M).

Rebuilding all the old packages is a bit of a process, but that's just fine.

Petr Bednář 2013-01-08 01:25

@Mark De Silva,
Excuse me.
I used Slax from USB on my Assus Eee PC (32bit). Command line start but X server was freezed. In command line was only error about not able to mount ext2 filesystem. I copied /var/log directory to flash disk, but log contains many errors.
Which log file help You to solve the problem?
Exist posibility to send You all data?

Tomas M 2013-01-08 02:12

@Petr, if you're using Slax 7.0.2 or older, please download version 7.0.3 which has improved detection of X failure and provides some fallback. If you're running 7.0.3 then please send me /var/log/Xorg.0.log, /var/log/Xorg.0.log.old and /etc/X11/xorg.conf (mail it to tomas@slax.org). Thank you

Mark De Silva 2013-01-09 05:28

Petr, was your USB formatted as ext2? Or is that your hard drive of the Asus Eee PC? I used to boot an Asus Eee PC with the old Slax 6 without issues so I know the graphics drivers for Slax should be ok. Maybe try with 7.0.3 like Tomas says and see how it goes.

Petr Bednář 2013-01-09 22:08

Mark, I don't have EXT2 at all. On flash disk i have fat32 (slax) and on HDD I have EXT4 (Lubuntu).

Petr Bednář 2013-01-09 22:09

Slax version is 7.0.3

Tomas M 2013-01-10 01:33

I'm in touch with Petr on email now. Lets hope we can find some solution.

fixxxer 2013-01-21 23:02

Where to put rootcopy on http server? Does it have to be in pxefilelist?

Lawrence Pina 2013-03-15 10:56

Regarding the practical application of PXE:

1. Is it possible to edit the Boot Options such that "Act as PXE Server" is selected by default? As it is now, the server automatically reboots as a workstation after a power failure, requiring human intervention to make it a server again.

2. At the same time, would it be possible to have "Act Like a PC Running on AC Power" (Applications/System/System Settings/Hardware/Power Management/Activity Settings/Slax Desktop/Act Like a PC Running on AC Power) automatically selected whenever "Act as PXE Server" is selected? As it is now, clients lose internet service (by default) as soon as the server goes to sleep...

Thank you!

Paulo Costa 2013-10-23 03:26

Hello and thank you for bringing out Slax.

@fixxer - I had the same question and ended up creating my own xx-Rootcopy.sb in order to customize Slax running on diskless stations, xx being the highest number in the list of modules to load.

Hope that helps

Cheers!

SubSurge 2013-12-04 13:17

Hey, love your distro.

Having an issue implementing it into my existing PXE server. Receiving a "wget:can't connect to remote host: network is unreachable" error.

I have the appropriate files in the root of /var/www for Apache2, if I http to my PXE server on port 7529 I get the "This is Slax PXE data server" message, so that's set up right...

Here's the menu entry of my pxelinux.cfg/default file
menu label SLAX LiveCD
kernel slax/boot/vmlinuz
ipappend 1
append vga=normal initrd=slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printktime=0 ip=127.0.0.1:192.168.1.210:192.168.1.1:255.255.255.0 slax.flags=toram,xmode

(loopback is set for client machine because I want to serve the image to multiple computers)

I have an nfs mount point in /etc/exports:
/home/tftpboot/slax *(ro,no_root_squash,no_subtree_check)

But I still get the "can't find executable chroot command" and drop down to a shell when trying to pxeboot from a client machine. I'm sure there's something I'm missing but I believe I followed all the instructions in this post and something's not working right.

kg.crap@hotmail.com 2014-02-26 06:46

Hi guys,

First of all I want to thank you for the excellent work. I found slax a couple of weeks ago and I'm thrilled of using it. As I said : "using it" because I'm a complete Linux-nitwit. I was happy as a child when I got it booting from USB, but now I want to go one step further and try the PXE-boot. Unfortunately I got stuck and was hoping anyone could help me out.

What I did so far :
I downloaded slax 7.0.8 and put it on a USB and made it bootable.
I booted one PC frim this USB and selected "Act as PXE server". As soon as this PC was running, I started a second PC and selected to boot from onboard NIC. Apparently it finds the PXE-server because I see a lot of text flashing the screen. At the end it says : Fatal error occured - Can't find executable chroot command" with a request to reboot the system.
A couple of lines above the error : it says :

Setting up union using AUFS 3
Adding bundles to union
sh: can't open '/memory/union/etc/fstab' : No such file or directory
...
Live Kit done, starting slax
ln: sbin/fsck.aufs: No such file or directory"


I'm probably doing something wrong. Can you please explain step by step how to get this running?

Thanks in advance