ipmitool for Cygwin – Updated 9/4/20

I recently ran into an issue with my primary Macbook which I use for ipmi connectivity among other things. I decided to look for a way to install impitool for Cygwin on my work laptop. This not only provides me the ability to invoke ipmi functions such as power commands on my customers servers but on mine as well. This is assuming you have Cygwin already installed if not go to: https://cygwin.com/install.html

Download ipmi source code

Below is the URL for where the code is for the ipmitool for Windows/Cygwin. What I do is clone the source since I have Github on my desktop. This is the most efficient way to manage your code if you have any of your own or want to contribute to someone else’s. You may also just download it to a zip file.

https://github.com/ipmitool/ipmitool

One you go here then clock on the green code button and code or download the source.

Note: If you get an error that it cant access the URL for the tool then your network may be blocking it from authenticating the source. You can issue this to workaround within Windows shell:

git config –global http.sslVerify false

Install packages & compile

Once you get this downloaded change your working directory to where the code is. Here you will compile it, its important to make sure you have the following packages: gcc-g++ make automake autoconf m4 libtool libncurses-devel libreadline-devel libssl-devel dos2unix wget

This information is available in the INSTALL file under the ipmitool directory. Go here to install choco: https://chocolatey.org/docs/installation

To prepare for building in Windows it is recommended to use Chocolatey and do the following using PowerShell.  You can also do this in Cygwin you just need to add the packages through Cygwin's setup i.e. setup-x86_64.exe.
1. C:\ipmitool> choco install cygwin -y
2. C:\ipmitool> choco install cyg-get -y
3. C:\ipmitool> cyg-get gcc-g++ make automake autoconf m4 libtool libncurses-devel libreadline-devel libssl-devel dos2unix wget

Open a Cygwin window

Within your cygwin terminal enter the following:


# cd /home/<USER>/Dist/Code/GitHub/ipmitool
# ls
ipmievd.c* ipmishell.c* ipmitool.exe* Makefile.am* ipmievd.exe* ipmishell.o ipmitool.o Makefile.in ipmievd.o ipmitool.c* Makefile plugins/

The following shell commands should configure, build, and install this package
# dos2unix bootstrap configure.ac csv-revision
dos2unix: converting file bootstrap to Unix format…
dos2unix: converting file configure.ac to Unix format…
dos2unix: converting file csv-revision to Unix format…

You can check out the instructions on how to compile for your particular platform.  In our case we are using it for Cygwin:
# more INSTALL
# ./bootstrap && ./configure && make && make install

checking build system type… x86_64-pc-cygwin
checking host system type… x86_64-pc-cygwin
checking target system type… x86_64-pc-cygwin
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /usr/bin/mkdir -p
checking for gawk… gawk
...
ipmitool 1.8.18.206.g50d8c36
Interfaces (default=lan)
lan : yes
lanplus : yes
open : no
free : no
imb : no
bmc : no
dbus : no
usb : no
lipmi : no
serial : yes
dummy : no
Extra tools
ipmievd : yes
ipmishell : yes

Check for ipmitool.exe

When you run the above commands and if successful it will copy the ipmitool.exe in /usr/local/bin

# cd /usr/local/bin
# ls -l ipmitool.exe
-rwxr-xr-x 1 user Domain Users 3570459 Sep 4 06:45 ipmitool.exe*

Test the ipmitool

Cygwin Terminal
# cd /usr/bin/ipmitool
# ipmitool.exe -U <USER>-H 10.0.1.199 -P <PASSWORD> chassis power status
IANA PEN registry open failed: No such file or directory  (You can ignore this, I have not found a way to get around this yet)
Chassis Power is off
Windows Powershell or Command Prompt

PS C:> cd \cygwin64\usr\local\bin
PS C:\cygwin64\usr\local\bin> ipmitool.exe -U <USER>-H 10.0.1.199 -P <PASSWORD> chassis power status
IANA PEN registry open failed: No such file or directory  (You can ignore this, I have not found a way to get around this yet)
Chassis Power is off

Useful ipmitool Options

Proceed each option below with the following: ipmitool.exe -U <USER>-H 10.0.1.199 -P <PASSWORD>

chassis statusGet chassis status and set power state
selPrint event log
sel elistPrints more verbose information
sensor listPrint detailed sensor information
sdrPrint Sensor Data Repository entries and readings
chassis power onPower on
chassis power offPower off
chassis power resetToggle power
chassis power softGraceful shutdown
You can see what options are available just by typing in ipmitool (option).  Example:
# ipmitool.exe -U <USER>-H 10.0.1.199 -P <PASSWORD> chassis
Chassis Commands:
status, power, policy, restart_cause
poh, identify, selftest,
bootdev, bootparam, bootmbox

# ipmitool.exe -U <USER>-H 10.0.1.199 -P <PASSWORD> chassis power
chassis power Commands: status, on, off, cycle, reset, diag, soft

That’ it have fun!

Advertisement