PXE and gPXE

Boot menu

So we’ve been using PXE booting on our network for the last couple of years and it has made life much easier.  We use pxelinux and vesamenu.c32 to have a pretty boot menu show up (specific to the system’s ip address).  Any school computers only see “Boot from hard drive” and “Administrative tools” (and choose the first option after five seconds).  An unknown computer (or a new computer) will get the menu on the right.  Administrative tools is password-locked so students/teachers can’t reinstall the operating system.

This system is incredibly efficient when it comes to imaging a new system (I go to “Administrative tools”, type the password, and then choose “Image system” and walk away).

We have run into several problems, though.  The main one was that several of our newer Intel motherboards have odd BIOS bugs that can occasionally be tripped up by PXE booting.  My favorite was the systems that completely froze when you chose “Boot from hard drive”.  We bought twenty of them.  My theory is that pxelinux is overwriting the RAM that contains the BIOS code for booting off of the hard drive.  And then there were the computers that would hang when trying to access “Administrative tools”.  The worst part is that I couldn’t replace the network boot rom with something from etherboot because I couldn’t find any tools that would allow me to modify Intel BIOSes this way.

It finally got to the point where half of our computers had PXE booting turned off by default, which made life fun when I needed to re-image one of those systems.  Enter gPXE.  gPXE is an open source network bootloader, and is the successor to etherboot.

I was playing around with it one day and came across this page.  I realized that I could cunningly have PXE load the gPXE boot rom over the network, and then replace the manufacturer’s PXE code in memory with gPXE code, which seems to be far more robust.

So, now all of our systems can boot off of the network, and then boot from the hard drive without hanging.  All of our systems can access Administrative tools.  And we even get a few bonuses (data gets loaded over http rather than tftp).

Tyre Computers

I’ve just spent the last three days setting up LESSON (our web based marking system) at our sister school in Tyre.  In the process, I’ve learned several things about web applications:

  1. Make sure to get your database right at the beginning.  I’ve been working on LESSON on and off over the last five years, and there are some things that have been added onto it.  Most of the time, I’ve extended the database in a nice, clean way, but there were a few times where I didn’t.  I decided to fix these problems before doing a new deployment, and there have been several things I’ve had to fix as a result.
  2. Make sure your frontend is modular.  I seem to have a real problem with writing modular code.  I don’t know why it is, but my normal tendency is to write One Big Page.  In writing LESSON’s frontend, I do include things like the header and footer, but I have liberally copied and pasted similar pages rather than abstracting out common functions.  When I changed the database, it took 30 minutes to make the changes to the necessary tables and convert the data.  It took 5 hours to get the frontend back into a semi-working state.  I spent another few hours over the weekend on it.  And I will need to spend even more time over the coming weeks, mainly doing search and replace (with enough issues that much of it is manual).
  3. Don’t take shortcuts.  So, yeah, at some point our school needed a way of checking past days’ attendance.  I was obviously in a hurry to implement it and somehow decided that the fastest way was to create a “calendar” table.  This table contained every day from January 1, 2005 (shortly before LESSON was deployed in our school) to January 1, 2065.  When I saw this over the weekend, I almost threw myself over the balcony (five stories up).  I ended up fixing the one(!) page that used this table and running a DROP TABLE.

The good news is that everything seems to have come together with few glitches, and, along with their new Fedora 11 desktop roll-out, Tyre has a great new system.