Set the boot device via IPMI (next boot and future boots)
If for example as part of your baremetal automation you need to change the boot order of the machine, for example to force it to boot from network or remote ISO, you can use ipmitool
to set the boot order (or just force for the next reboot a specific boot method).
Get the current boot device
One can query the current BIOS boot device order using ipmi, with the `bootparam` option,
bootparam Get or set various system boot option parameters. get Get boot parameter. Currently supported values for are: 0 - Set In Progress 1 - Service Partition Selector 2 - Service Partition Scan 3 - BMC Boot Flag Valid Bit Clearing 4 - Boot Info Acknowledge 5 - Boot Flags 6 - Boot Initiator Info 7 - Boot Initiator Mailbox
# IPMI_HOST=10.20.30.40 # IPMI_USER=root ipmitool -H $IPMI_HOST -U $IPMI_USER chassis bootparam get 5 chassis bootparam get 5 Boot parameter version: 1 Boot parameter 5 is valid/unlocked Boot parameter data: c008000000 Boot Flags : - Boot Flag Valid - Options apply to all future boots - BIOS PC Compatible (legacy) boot - Boot Device Selector : Force Boot from default Hard-Drive - Console Redirection control : System Default - BIOS verbosity : Console redirection occurs per BIOS configuration setting (default) - BIOS Mux Control Override : BIOS uses recommended setting of the mux at the end of POST
Set the boot device for next boot
# ipmitool chassis bootparam set bootflag force_pxe Set Boot Device to force_pxe
And if we read the above option again, will get
# ipmitool chassis bootparam get 5 Boot parameter version: 1 Boot parameter 5 is valid/unlocked Boot parameter data: 8004000000 Boot Flags : - Boot Flag Valid - Options apply to only next boot - BIOS PC Compatible (legacy) boot - Boot Device Selector : Force PXE - Console Redirection control : System Default - BIOS verbosity : Console redirection occurs per BIOS configuration setting (default) - BIOS Mux Control Override : BIOS uses recommended setting of the mux at the end of POST
Set fixed boot device (persistent)
# ipmitool chassis bootdev cdrom options=persistent Set Boot Device to cdrom
# ipmitool chassis bootparam get 5 Boot parameter version: 1 Boot parameter 5 is valid/unlocked Boot parameter data: c014000000 Boot Flags : - Boot Flag Valid - Options apply to all future boots - BIOS PC Compatible (legacy) boot - Boot Device Selector : Force Boot from CD/DVD - Console Redirection control : System Default - BIOS verbosity : Console redirection occurs per BIOS configuration setting (default) - BIOS Mux Control Override : BIOS uses recommended setting of the mux at the end of POST
What about UEFI
Almost the same just add the `efiboot` to the options parameter.
ipmitool chassis bootdev pxe options=efiboot #or ipmitool chassis bootdev pxe options=efiboot,persistent