LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Blogs > Musings on technology, philosophy, and life in the corporate world
User Name
Password

Notices

Hi. I'm a Unix Administrator, mathematics enthusiast, and amateur philosopher. This is where I rant about that which upsets me, laugh about that which amuses me, and jabber about that which holds my interest most: Unix.
Rate this Entry

My little PXE experiment?

Posted 11-24-2012 at 03:28 AM by rocket357

My wife recently started having odd issues with her main gaming rig rebooting during intensive pvp fights, so she asked me to look into diagnostics programs so we can see what the issue is. (After discussing the issue with a friend, my wife determined that it was her power supply, and we've ordered one).

Unfortunately, the bug to setup a PXE environment, loaded with diagnostics, utilities, antivirus, etc... had been planted, and I couldn't let the idea go. I've never set one up, so it'll be a fun little experiment (and perhaps prove handy down the road, too).

First up, I'm already running dhcpd on an OpenBSD machine on my network, so the only thing I had to do there was set next-server and filename to point to my tftpd server (at the moment, my Ultra5):

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.150 192.168.1.199;
next-server 192.168.1.4;
filename "pxelinux.0";
<snip>
}

Ok, I'm primarily running OpenBSD, so what's this pxelinux stuff, anyways? Shouldn't a "masturbating monkey" such as myself run OpenBSD's pxeboot like a good little BSDer?

Yes and no. Yes, pxeboot is cool. No, it doesn't do all the stuff pxelinux does. pxeboot, in typical OpenBSD team fashion, does exactly what it was designed to do (boot OpenBSD via pxe), nothing more and nothing less.

Unfortunately, I want to do more than pxe boot OpenBSD. I want to load up ubcd, or g4l, or bootable antivirus cds! Yes, I want to be able to install OpenBSD from pxelinux, too, and that is possible without too much hassle.

Ok, dhcpd is configured and ready, now on to tftpd. I shoved the following into /etc/rc.conf.local (you're not editing /etc/rc.conf directly, are you?):

tftpd_flags="-v /tftp"

-v is for verbose (log file accesses) and /tftp is the tftpd root folder. Under /tftp I have the following:

menu.c32 (from the syslinux download)
pxelinux.0 (from the syslinux download)
memdisk (from the syslinux download)
images (directory for isos)
pxelinux.cfg (directory containing the default config file)

I spent a few hours testing different boot cds (I want to use really solid isos that don't require trickery just yet...perhaps when I get this "burned in" for a bit I'll revisit and shove in some fancy live cd's or somesuch...but for now I want something simple). The following isos worked without hassle:

Ultimate Boot CD: ubcd511.iso
Ghost 4 Linux: g4l-v0.43.iso
AVG Antivirus: avg_arl_cdi_all_120_120823a5411.iso
OpenBSD-5.2/i386: cd52.iso

The problem is, with pxelinux you have to load memdisk as the "kernel", which uses the iso as the initrd (internally, as I understand it, memdisk just sets up a memory block to store the iso then transfers control to it). This leads to complications if files are required on the iso (which isn't readily available in the usual locations immediately after the real kernel takes over). There are ways around this (nfs exporting a loop mounted filesystem of the iso? Good grief!), but for now let's keep this simple, shall we?

The above four isos (well, ok, perhaps the amd64 OpenBSD-5.2 cd52.iso as well) will be downloaded and stored in the images directory.

Here is the file /tftp/pxelinux.cfg/default:

Code:
DEFAULT menu.c32
prompt 0

MENU title PXE Boot Menu
MENU AUTOBOOT Starting Local System in # Seconds

LABEL local_disk
    MENU label ^Boot local hard drive
    MENU default
    LOCALBOOT -1

LABEL ghost4linux
    MENU label ^Backups
    LINUX memdisk
    INITRD images/g4l-v0.43.iso
    APPEND iso

LABEL ubcd
    MENU label ^Hardware Diagnostics
    LINUX memdisk
    INITRD images/ubcd511.iso
    APPEND iso

LABEL avg
    MENU label ^AVG Antivirus
    LINUX memdisk
    INITRD images/avg_arl_cdi_all_120_120823a5411.iso
    APPEND iso

LABEL i386-cd52.iso
    MENU label ^Install OpenBSD-5.2/i386
    LINUX memdisk
    INITRD images/openbsd-i386-cd52.iso
    APPEND iso
Next, be sure to start up tftpd:

/etc/rc.d/tftpd start

And test out PXE boot!

One thing of note: UEFI machines will not boot properly via PXE boot with pxelinux.0. RedHat has a bootx64.efi file that can be used, but I've not messed with it (yet). Perhaps for a later post? For now, this is just for legacy BIOS x86/x64 systems.

Anyways, enjoy!
Posted in Uncategorized
Views 5643 Comments 3
« Prev     Main     Next »
Total Comments 3

Comments

  1. Old Comment
    I managed to get BitDefender 2013 working (sort of) properly (it boots to the GUI now, at least) by mounting the iso (vnconfig for openbsd) and copying the iso contents out to a directory in /tftp, then exporting the directory via nfs. It's a brutally ugly hack, but it appears to work.

    More to follow if I can get some of these other isos working.
    Posted 11-24-2012 at 05:44 AM by rocket357 rocket357 is offline
  2. Old Comment
    I now have Linux Mint 14 and BackTrack 5 livecd's booting via PXE, and I've broken everything out into sub-menus and swapped menu.c32 for vesamenu.c32 (including obligatory OpenBSD boot backgrounds).

    Followup blog post to come...
    Posted 11-25-2012 at 04:52 AM by rocket357 rocket357 is offline
  3. Old Comment
    Update: if you look hard enough, you will find the UEFI settings for your motherboard that allow you to pxeboot legacy bootloaders. I have done this, and my wife's machine now pxeboots the menu I have setup.
    Posted 12-04-2012 at 06:31 PM by rocket357 rocket357 is offline
 

  



All times are GMT -5. The time now is 07:34 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration