How to talk to a local IPMI under OpenBSD
Much like Linux, modern versions of OpenBSD are theoretically able to talk to a suitable local IPMI using the standard ipmi(4) kernel driver. This is imprecise although widely understood terminology; in more precise terms, OpenBSD can talk to a machine's BMC (Baseboard Management Controller) that implements the IPMI specification using one of a number of standard interfaces, as covered in the "System Interfaces" section of ipmi(4). However, OpenBSD throws us a curve ball in that the ipmi(4) driver is normally present in the default OpenBSD kernel but not enabled.
If the ipmi driver is present but not enabled and your machine nas an IPMI that OpenBSD can talk to, the kernel boot messages will report something like:
ipmi at mainbus0 not configured
If you don't see any mention of 'ipmi' in the boot messages and you're using a normal kernel, your machine almost certainly doesn't have a recognized IPMI and you can stop here. If you do see this 'not configured' message, you most likely have an IPMI that OpenBSD can talk to and you now need to enable the IPMI driver.
If you're using OpenBSD 7.0 or later, you enable the driver by creating or editing the file /etc/bsd.re-config (see bsd.re-config(5)) to contain:
(This will often be the only line in bsd.re-config, partly because the file format doesn't allow comments.)
After you've set up bsd.re-config, you need to reboot at least once and perhaps twice. After this the kernel will recognize your IPMI with messages that look something like this:
ipmi0 at acpi0: version 2.0 interface KCS iobase 0xca8/8 spacing 4 ipmi at mainbus0 not configured iic0: skipping sensors to avoid ipmi0 interactions
(You may not see the iic0 message.)
In OpenBSD 6.9 and previous versions there is no bsd.re-config, so
you need to manually create a new kernel image with config(8) that has the ipmi driver
specifically enabled. A typical usage would be (with 'ukc>' being
the prompts from
# config -e -o /bsd.new /bsd [...] ukc> enable ipmi [some messages about it] ukc> quit # mv /bsd /bsd.last && mv /bsd.new /bsd # reboot
(Then you'll see the same sort of kernel messages as in OpenBSD 7.0.)
Unfortunately using config(8) this way conflicts with OpenBSD's KARL kernel relinking. Enabling the ipmi driver this way will survive reboots (or it has so far for me), but it will apparently be lost if you use syspatch to apply at least kernel patches and perhaps any patch.
Once your IPMI is configured under any OpenBSD version, you can do
at least two new things. The first is that you can see IPMI sensors
sysctl hw.sensors', usually under hw.sensors.ipmi0. OpenBSD seems
to be able to read IPMI sensors quite readily and without delays,
which is a nice change from the usual Linux situation. The output of
this on one of our machines looks like:
hw.sensors.ipmi0.temp0=26.00 degC (CPU Temp), OK hw.sensors.ipmi0.temp1=32.00 degC (PCH Temp), OK [...] hw.sensors.ipmi0.fan0=9800 RPM (FAN1), OK [...] hw.sensors.ipmi0.volt0=12.29 VDC (12V), OK hw.sensors.ipmi0.volt1=5.12 VDC (5VCC), OK [...] hw.sensors.ipmi0.indicator0=Off (Chassis Intru), OK
(Unfortunately, the Prometheus host agent currently doesn't read and report any of the hw.sensors sysctls. As always, the sensors you get will vary between server models and not all of them may make sense or be valid.)
The second thing is that you can install and use ipmitool, with it working the same as on Linux (and probably other *BSDs). Ipmitool comes from OpenBSD's ports collection and can be added with pkg_add. Once installed it will automatically use the /dev/ipmi0 device that OpenBSD has set up and everything just works. This can let you take an OpenBSD machine's IPMI from an unconfigured state to being up and on your management network without having to take the machine down into BIOS (although you do have to reboot at least once).
(In theory, you can also do things like control what will happen to the machine if power goes out and then comes back on. Your mileage may vary as to whether your BMC really supports this portion of IPMI and it works right.)