Friday, November 4, 2011

PXE booting

I wanted to be able to PXE boot distros of my choice for testing.

Using PXE booting is quite handy. Keep a stock of distros on your server, boot your client, select a distro of choice and go play.

It's also excellent if you need to do repeat installs etc etc. Forget all that boot from CD or USB nonsense. Whack a PXE enable network card in if you don't have one on board and life is a breeze.

Well, almost.........

Personally my server runs www.contribs.org - formally e-smith, taken in & spat out by Mitel, but still given development assistance by them (so I believe).

A nice simple distro for your first linux server, and quite flexible if you want to do a bit more, as it is CentOS based.

There are a couple of contribs to add PXE server capabilities which I won't bore with but am happy to help if someone needs a hand.

There are loads of guides around on PXE booting so again I won't reinvent the wheel.

For my own setup I want to run a distro, and pull in the files via NFS. Again, grab the NFS stuff which available.

The trick is knowing what goes where. I couldn't be arsed with all that loop mounting nonsense. I just wanted to extract the files from an ISO into some folder, boot the basic system & then grab the rest via NFS. Yes, http & GPXe etc are meant be faster, but I don't need that much speed - it's for fun & testing.

I just wanted to put some notes here on the config files as that is the tricky bit and varies by distro.

Mint linux was first up and quite easy. Extracted the ISO to /some/folder and put initrd.lz & vmlinuz in my /tftpboot/images/debian_mint folder

then in my pxelinux.cfg/my_linux_disks I put the following line :


label Debian Mint
 menu label ^Debian Mint
 kernel images/debian_mint/vmlinuz
 append boot=casper netboot=nfs nfsroot=192.168.0.1:/some/folder/debian_mint initrd=images/debian_mint/initrd.lz

Note you can modify the append line as per the options available when you boot the CD normally - e.g. the above boots to the 'Live' system but you could boot it direct to the installer. Pesistent features are available, and you can even mount your NFS folder as above to save your docs etc if need be.

I whacked in Xubuntu and Ubuntu rescue and they are almost identical to the above but you get the gist.

Next I thought I'd try Damn Small Linux. Been a fave toy for ages. Think I could get it to go ? Can't find KNOPPIX. Not on your life, and after quite some time I decided to try something different and went on the hunt for some other Tiny distros.

The two I found were Slitaz and Tiny Core, the latter being founded by a disgruntled DSL developer, so I understand.

Anyhow, there was lots of stuff about PXE booting them (Slitaz can actually do a basic boot off a USB etc and then get the rest of itself from an online server - MUST try that sometime !) but I failed to get my head round the simple fact that both only need two files. Good review here

Slitaz :

bzImage
rootfs.gz

Pop them in /tftpboot/images/slitaz

Here are the PXE lines :

label Slitaz Std
 menu label Slita^z
 kernel images/slitaz/bzImage
 append initrd=images/slitaz/rootfs.gz vga=792 lang=uk kmap=uk

Change vga & lan/kmap to suit your taste.

That will get it to boot. The only problem I have had is getting the home folder too map to the NFS server on boot. In a word or two, it can't, unless you are prepared to hack the system and add a mount option in the init files.

Next up is TinyCore. Slitaz is prettier but Tiny packs a big punch. Read here for a reasonable review

TinyCore :

tinycore.gz
vmlinuz

label Tiny
 menu label ^Tiny Multi
 kernel images/multicore_current/vmlinuz
 append initrd=images/multicore_current/tinycore.gz  nfsmount=192.168.0.1:/some/folder/multicore_current

That gets it running nicely. You can easily add packages which get stored in a persistent folder on your NFS share and then decide what is loaded and when. Very neat. 

Just need to figure out booting with the user that I want instead of the default, but it's documented and just a matter of time. Though Slitaz looks a little more funky and has undoubtedly got some nice features, it's not quite as friendly for my system.

I also think that Tiny might be better suited to booting off a USB and I think that it will become my emergency USB boot system.

Older page but some interesting links. Guess that Puppy is next on the try list, but I'm not sure whether to go with the known Ubuntu or the unknown Slackware. Maybe Ill try both, now that I can :-)

Enjoy


No comments:

Post a Comment