[CentOS] force a PXE boot

Wed Jul 26 15:56:49 UTC 2006
Steve Huff <shuff at vecna.org>

On Jul 26, 2006, at 11:35 AM, Tom Brown wrote:

> I could be going mad but it there a way to force a PXE boot on next  
> reboot? ie tell the box that next time it reboots try a PXE boot  
> first?

that depends on the BIOS of your system; it's not an issue that  
CentOS can (easily) deal with.  some Dell servers have a utility that  
you can use to change BIOS settings from within the OS, but i can't  
speak to how well it works.

here's how i solved a related problem when setting up a lab of  
machines that would be PXE-booting to reinstall themselves without an  
admin at the console:

1) in the BIOS, set the boot order to PXE,HD (you can put CD/floppy/ 
USB before HD if you want, but PXE must be first)
2) set up your TFTP server such that the default boot target boots  
from the system's hard drive (use the "LOCALBOOT" option as described  
here: http://syslinux.zytor.com/faq.php)
3) created another PXELINUX configuration that performs a network  
boot and give it a name that corresponds to either the machine's MAC  
address or the machine's IP address (as described here: http:// 
syslinux.zytor.com/pxe.php#config)
4) if you're using the PXE boot to kickstart the machine, add a line  
to the %post section of your ks.cfg that will ssh to the TFTP server  
and move aside the PXELINUX config file with the machine's MAC/IP  
address (you can make this process as simple or complicated as you need)

if you follow these steps, then the machine will PXE-boot when the  
special config file is in place, kickstart itself, and then move the  
special config file aside; when it next boots, the TFTP server won't  
find the special config file, so it'll use the default config file,  
which tells the machine to boot from the local hard drive.

does this make sense?

-steve

p.s. there are other ways of having the machine "phone home" to the  
tftp server besides using ssh; one of my colleagues did it with a  
little php script.  alternately, you could have a script running on  
the TFTP server that watches the logfile for evidence of successful  
PXE boots and uses that information to move aside the special config  
file.


---
If this were played upon a stage now, I could condemn it as an  
improbable fiction. - Fabian, Twelfth Night, III,v