PXE Network Booting Configuration.

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
pumbaa2
White ninja
White ninja
Posts: 29
Joined: 08 May 2012, 10:39
Distribution: Slackware 13.37
Location: Melbourne, FL
Contact:

PXE Network Booting Configuration.

Post#1 by pumbaa2 » 29 May 2014, 04:35

Anyhow, it has been some time since I've spoke with you guys. I see the Porteus Distro has made some leaps and bounds since Version 1.2...

Moving on... I noticed that Porteus does have the option to host itself as a Network Boot Server that will enable other diskless clients to use that copy to host other machines. I have to admit, very nice touch. Anyhow, being that my current DHCP Server has Network Boot options already configured, I didn't want to bring up a copy of Porteus in Server Mode because of the network disruption it would cause. So, I was going to create a virtual interface and run 2 virtual machines with each virtual machine linked to each other via the virtual interface to allow 2 instances to interact with each other (1 to host the PXE Server and the other to do a network boot and test out the functionality).

In the end, I've come across some confusing information regarding the operation of Porteus over PXE. One article suggested that Porteus uses httpfs to service the files/modules to the diskless client and another suggests that Porteus was going back to the conventional way of using NFS to provide the additional files for Porteus. I checked /etc/exports (found it empty), however I did manage to find the srv directory that contained pxelinux.0, a boot configuration file for it, etc. So having all that information, I guess all I need to know is how Porteus accesses the rest of its files. Does the Porteus PXE Server set a fixed address that all the clients know to look for to obtain the rest of the files or is that option changable via "cheatcode"?

My current linux server configuration is full blown Slackware 13.1 running apache webserver, NFSD, in.tftpd and DHCPD. Within that configuration I host a number of DOS Bootdisks using syslinux memdisk as the loader as well as a BartPE using NTLDR from Windows Server 2003 (which works very nice I might add). I have one "floppy" based linux that is basically the kernel and initrd which is loaded with Busybox, etc. But the interface is completely console with no access to X or anything else. But this modular based distro would be perfect as I can pack new modules for it and add them to the NFS Share or Apache Server to service to all the clients. This would give full Internet and Recovery access to any client in my house that suffers a hard drive crash, etc.

To make this easy on everyone, keep in mind that I'm pretty experienced in setting up PXE Boot Servers, so maybe a list of configuration files (web server, NFS Server files that I'm missing) maybe the best route. The rest will be pretty self explanatory for me after that. Porteus doesn't use apache, and that's what I'm use to. NFS Exports file is empty so no NFS Shares to access. Folders that indicate usefulness in /srv are all empty except the PXE Boot configuration... I may just have to boot into PXE Server mode with it assigned to a dummy ethernet adapter and then look through the process list and exports then, as startup scripts might add the needed options only during PXE Server Mode... Anyhow, any assistance would be nice...

-RayRay-

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: PXE Network Booting Configuration.

Post#2 by fanthom » 29 May 2014, 06:03

yes - Porteus uses NFS now instead of http as NFS allows to save the changes over network giving an option for full persistence to thin clients (and i think this is an awesome feature).
please let me know where did you find info about httpd being still used and we will correct it.

how does it work:
a) in porteus.cfg you will find this cheat in the 'PXE server' entry:

Code: Select all

APPEND initrd=initrd.xz pxe
b) if our booting script (rc.M) finds 'pxe' cheat in kernel command line then launches '/opt/porteus-scripts/pxe-server' script

Code: Select all

rc.M:egrep -qo " pxe( |\$)" /proc/cmdline && sh /opt/porteus-scripts/pxe-server
d) please examine '/opt/porteus-scripts/pxe-server' and that should tell you the rest (if not then please shout)
e) client gets IP of the porteus pxe server from the kernel command line (/srv/pxe/boot/pxelinux.cfg/default has 'IPAPPEND 1') and mounts NFS shares based on this information.

in case when you want to separate dhcpcd from NFS then you have to use 'ip=SERVER:IP_ADDRESS_OF_THE_NFS_SERVER' cheatcode (example 'ip=SERVER:192.168.1.6') on the client side so linuxrc will know where to search for NFS data.

so you have to remove 'IPAPPEND 1' from /srv/pxe/boot/pxelinux.cfg/default and add fixed 'ip=SERVER:192.168.1.6' cheatcode to it.

didn't try myself but should work :)
Please add [Solved] to your thread title if the solution was found.

User avatar
pumbaa2
White ninja
White ninja
Posts: 29
Joined: 08 May 2012, 10:39
Distribution: Slackware 13.37
Location: Melbourne, FL
Contact:

RE: PXE Network Booting Configuration.

Post#3 by pumbaa2 » 30 May 2014, 09:40

That works very nicely. It took me about an hour to tear the script down and figure out all that was going on with it. Instead of decompressing the initrd.xz image just to add the kernel modules for NFS and LAN, it maybe better just to include NFS and LAN Modules in the kernel. I choose the let that part of the script rebuild the initrd.xz image and then copy that over to my TFTP Server. The only time I'd need to rebuild that initrd is if I changed or recompiled kernels, so the need to run that part of the script every time will waste time on Slackware startup not to mention the file structure that is needed to create that rebuild is not available in slackware without decompressing 000-kernel.xzm myself.

The current method of using IPAPPEND works nicely. I was able to move that option out of the global section of the pxelinux.cfg/default to the specific option that boots Porteus so that it does not interfere with any of my other linux based PXE bootable images. However, I did figure out what happens when you forget to add that option to the pxelinux.cfg/default file, lol...

I kept the file structure in tact for the holding location of /srv/pxe/porteus and exported it on Slackware's NFS Server using the same options (ro,fsid=0,no_subtree_check) that the script created in /etc/exports on Porteus and then just copied the file structure there. After that it booted up from LAN very nicely.

Just to take a look at your default bootup for PXE Server from CD, I modprobed dummy and then created dummy0. I attached 2 Virtualbox Sessions to the interface in Bridge Mode. I started one instance in Porteus PXE Server mode from ISO and then created a second instance attached to the same interface in Bridge mode with only Network Boot Selected. Once I was done, I tested my configuration by changing the VirtualBox instance for PXE Boot from dummy0 to eth1 (local lan) and booted my own PXE Server.

I have to admit, I wasn't expecting the PXE Server instance to boot into KDE, I figured it would stay at the prompt. I guess its not a bad idea, it makes the server terminal a useful GUI machine as well, however, init 4 would have likely done that too. Overall, you all made the vesamenu.c32 screen just as nice as the boot screen for Porteus itself (No doubt, syslinux at work here). You all must have spent some time tossing together your boot screens. It makes my PXE boot screen look sad... I may have to import some of your Porteus PXE Boot screen structure into my PXE Boot Menu, especially since Porteus is actually an option on my PXE Server now. :)

I don't have changes setup yet and I didn't see any extra exports for the changes in /etc/exports that was created by that script. The option for /srv/pxe/porteus in exports says read-only so I know it will never commit anything there. I guess I'll create another NFS Export that is RW and pass the changes cheatcode to that path and see if that works out. I didn't try the changes version of of Porteus from the PXE Boot Menu but I will. Still wondering how well that will work since it seems the Porteus PXE Server doesn't create a RW NFS export. Maybe its cause I booted Porteus from the ISO into PXE Server Mode?

Anyhow, thanks for all your help. I may post again if I find complications with the changes cheatcode. It's not really needed but I would like to add the option just in case.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: PXE Network Booting Configuration.

Post#4 by fanthom » 30 May 2014, 11:58

"Instead of decompressing the initrd.xz image just to add the kernel modules for NFS and LAN, it maybe better just to include NFS and LAN Modules in the kernel."
yes but this may be a problem if user go with some custom kernel so i prefer to recreate ramdisk with drivers in it.

"I don't have changes setup yet and I didn't see any extra exports for the changes in /etc/exports that was created by that script. The option for /srv/pxe/porteus in exports says read-only so I know it will never commit anything there. I guess I'll create another NFS Export that is RW and pass the changes cheatcode to that path and see if that works out."
you could save some time by reading our documentation. i'm a nice guy so will give you a shortcut - you need to use 'storage=' cheatcode on the server side pointing to some real filesystem (tmpfs, etx4, xfs, etc..) as i couldnt get aufs to work. for quick testing please use 'storage=/mnt/live/tmp' as tmpfs sits there.

full desc:

Code: Select all

storage=/path/folder
storage=/path/file.dat

   ... This cheatcode takes action only when used together with the
       'pxe' cheatcode. It tells the server to store persistent
       changes from the clients in a specified folder. Changes must
       be saved on a real and writable filesystem (wont work with
       aufs).
       Separate folders for each client will be created with the name
       '/path/folder/client-xxxx' where xxxx is the last 4 characters
       of the clients' NIC MAC address.
       This cheatcode should be used on the server side.
       Example: 'storage=/mnt/sda3/pxe-clients'
reference: /boot/docs/cheatcodes.txt
Please add [Solved] to your thread title if the solution was found.

User avatar
pumbaa2
White ninja
White ninja
Posts: 29
Joined: 08 May 2012, 10:39
Distribution: Slackware 13.37
Location: Melbourne, FL
Contact:

Re: PXE Network Booting Configuration.

Post#5 by pumbaa2 » 31 May 2014, 03:56

Ohhh, thats interesting... I actually fixed the issue by using a piece of code that is located in /mnt/live/initrc that says if "changes" = "/srv/pxe/storage" to attempt to mount such path using NFS as RW. So I edited /tftpboot/pxelinux.cfg/default and added the changes cheatcode to reflect /srv/pxe/storage and made sure to update /etc/exports in slackware to support that export for NFS as RW. Except the small fluke of forgetting to change the fsid, everything has worked perfectly. Aufs isn't giving me any problems about it and I created a file in Porteus, looked on the server under /srv/pxe/storage/client-E8F376 and found the file in real time.

I will look into your option to use the storage cheatcode on the server side. Being that Porteus is being hosted on Slackware now, I'll have to go through the scripts to see how the storage cheatcode is implemented. This will give me an idea of how to modify slackware.

I would recommend making a nfschanges cheatcode that supports a full NFS Path for the storage directory. That cheatcode could be used with flash drives or even Live CD's to provide a NFS Path for storage for true diskless systems.

Anyhow, thank you for your time.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: PXE Network Booting Configuration.

Post#6 by fanthom » 31 May 2014, 09:07

I actually fixed the issue by using a piece of code that is located in /mnt/live/initrc that says if "changes" = "/srv/pxe/storage" to attempt to mount such path using NFS as RW. So I edited /tftpboot/pxelinux.cfg/default and added the changes cheatcode to reflect /srv/pxe/storage and made sure to update /etc/exports in slackware to support that export for NFS as RW. Except the small fluke of forgetting to change the fsid, everything has worked perfectly.
this is exactly what 'storage=' cheatcode does - good job.

Aufs isn't giving me any problems about it and I created a file in Porteus, looked on the server under /srv/pxe/storage/client-E8F376 and found the file in real time.
yes - this is ok.
the problem is when you use Porteus (not Slackware) as NFS server in 'Always Fresh' and want to set NFS RW on aufs in e.g. /home/guest/nfs.
this never worked for me - probably i missed something.
Please add [Solved] to your thread title if the solution was found.

User avatar
pumbaa2
White ninja
White ninja
Posts: 29
Joined: 08 May 2012, 10:39
Distribution: Slackware 13.37
Location: Melbourne, FL
Contact:

Re: PXE Network Booting Configuration.

Post#7 by pumbaa2 » 04 Jun 2014, 06:27

I found this regarding NFS Version 4 Exports:

Kernel Configuration:

> Options regarding AUFS appear under file systems in make menuconfig. Be sure to tune maximum number of branches and check "NFS-exportable AUFS".

Also, they mentioned this:

The crossmnt option is crucial for the process to succeed and tells NFS that other filesystem are mounted under this directory, and NFS should export them.

inside /etc/exports

/mnt/data 0.0.0.0/0.0.0.0(rw,fsid=0,insecure,no_subtree_check,sync,crossmnt)

Note: The export will require a fsid and I believe crossmnt is also required (From Source #2)

I hope this helps, however, I haven't tried this myself.

Source:
http://gdr.geekhood.net/gdrwpl/aufs-nfs.php
http://scratchpad.wikia.com/wiki/Enable ... untu_12.04

-RayRay-

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: PXE Network Booting Configuration.

Post#8 by fanthom » 04 Jun 2014, 08:44

i think i have played with that already but not sure if i applied 'crossmnt' flag....
also - Pat still uses NFS v3 by default in Slackware and upgrading to v4 requires some other package changes.

will try once again just for fun.

thanks.
Please add [Solved] to your thread title if the solution was found.

Post Reply