7

So, I use Systemimager to provision new CentOS 5.3 hosts via PXE. We have a couple servers that are just test targets that we'll reimage a couple-dozen times a day, and normally, getting them to PXE-boot is as simple as logging onto their iLO interfaces, rebooting, and hitting F12 at the appropriate time. My question is, is it possible to tell the server via the linux commandline to perform a "one-time PXE boot" during its next reboot? Each reimage cycle this would save me many minutes of clicking, typing, waiting for Java to load the ilo console, etc. I know Dell has this capability via OpenIPMI, but I was wondering if HP had similar functionality.

Many thanks! --Lee

4 Answers 4

7

This should be possible with ipmitool. Just run:

ipmitool chassis bootdev pxe

And your next boot should be a PXE boot.

Edit: This doesn't seem to work for HP iLO2. However, you can SSH in to the iLO2 interface and reconfigure it there by issuing

set /system1/bootconfig1/bootsource5 bootorder=1

On systems that don't support booting from USB key it will be bootsource4 instead. For complete details, see the iLO2 Scripting Reference

You can issue this command as an argument to ssh and that should work as well.

7
  • 1
    HAPPY DANCE, HAPPY DANCE!
    – Insyte
    Aug 19, 2009 at 20:16
  • It looks like this command is not supported on HP: root@test02:~# ipmitool -I open chassis bootdev pxe Set Chassis Boot Parameter 4 failed: Invalid command
    – Insyte
    Aug 19, 2009 at 20:21
  • Does that flag stay set for all subsequent boots, or will it change back to the 'regular' boot order after it successfully PXEs once?
    – law
    Aug 20, 2009 at 2:57
  • Not sure. I believe it's all subsequent boots, so you'd have to change the boot order again when exiting the PXE environment. Aug 20, 2009 at 15:20
  • Yes, it is a permanent change. You need to run set /system1/bootconfig1/bootsource5 bootorder=5 to switch back. One advantage for the HP servers being so slow to boot is that you have quite a long time to change this back! Feb 19, 2013 at 15:16
6

So I figured this out with the help of a coworker. Its a dirty, dirty hack, but it works! HP Proliants (at least now, at the end of 2009) will try to boot from a CDROM, then try the harddisk, then try a USB stick, and then they'll do a PXE boot. Since I am reimaging servers anyway, I've figured out that if we zap the boot sector anyway and immediately reboot, HP boxen will go through the boot process, bypass the harddisk because there's no MBR, and immediately PXE-boot. I've written a script that issues the dd commands thusly:

#!/bin/bash

# This is meant to assist in re-imaging a server.  This will blow away the
# main partition of a given box, forcing it to pxe-boot next boot.
# Naturally, don't be an idiot and run this on a machine you DON'T want nuked
# from orbit

echo "Nuking from orbit will commence in 5 seconds.  Ctrl-C if this NOT what you want."
echo "You have been warned!"
sleep 8

dd if=/dev/urandom of=/dev/cciss/c0d0 bs=512 count=2

dd if=/dev/urandom of=/dev/cciss/c0d0p1 bs=512 count=2
dd if=/dev/urandom of=/dev/cciss/c0d1p1 bs=512 count=2
dd if=/dev/urandom of=/dev/cciss/c0d2p1 bs=512 count=2
sync

echo "Nuke complete!  Rebooting in 5..."
sleep 5
reboot

HTH! --Lee

3

Alternatively, use the tools from the HP Proliant Support Pack (rpm named hp-health) ... there's a CLI program called 'hpbootcfg' that will do exactly what you want: USAGE: bootcfg [-F -C -H -T] [-S -Q -R -P] [-r -d -n -b] -D Set Defaults everywhere

    -F Floppy first
    -C CD ROM first
    -H Harddrive first
    -T Tape first

    -S one time boot to system configuration utility
    -Q one time boot to quick configuration utility
    -R one time boot to RBSU
    -P one time boot to PXE

    -r one time remote
    -d one time remote dial out
    -n one time remote network
    -b bypass F1/F2
1
  • So the -P option is what is needed here. Does this only work from the server itself? Feb 19, 2013 at 15:18
1

You can use Ansible to boot your machines from network through their HP iLO interfaces, by using "python-hpilo" module.

In order to do that you can use some Ansible roles such as:

- name: boot from netwrok through HP iLO interface only if the system is an HP server
  hpilo_boot:
    force: yes #make sure what you are doing, it will reboot a running machine
    host: YOUR_ILO_ADDRESS
    login: YOUR_ILO_LOGIN
    password: YOUR_ILO_PASSWORD
    media: network
    state: boot_once #default behaviour
  when: cmdb_hwmodel.startswith('HP ')
  delegate_to: localhost

For more information please check: https://docs.ansible.com/ansible/latest/modules/hpilo_boot_module.html

You can also boot many machines from network, by using an inventory file. For more information on Ansible roles and tasks please visit https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html and https://docs.ansible.com/ansible/latest/user_guide/basic_concepts.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .