ipmptool get the Board Serial using raw command

14,661

To read the FRU you need to use the following command:

ipmitool raw 0xa 0x11 <offset lsb> <offset msb> <count>

You will need to calculate the offset of the board serial but that you can do with some trial and error (or actually do the math).

The response will be

  • First byte: number of bytes read.
  • Second byte onwards: the raw data that was read.
Share:
14,661

Related videos on Youtube

charles.cc.hsu
Author by

charles.cc.hsu

Updated on September 18, 2022

Comments

  • charles.cc.hsu
    charles.cc.hsu almost 2 years

    I would like to use ipmitool to get the Board Serial Number, currently I can use $ sudo ipmitool fru to query the information as below:

    $ sudo ipmitool fru
    FRU Device Description : Builtin FRU Device (ID 0)
     Chassis Type          : Main Server Chassis
     Chassis Part Number   : 01234567
     Chassis Serial        : 01234567890123456789AB
     Board Mfg Date        : Wed Jan  7 13:07:00 2015
     Board Mfg             : GIGABYTE
     Board Product         : MB10-DS4
     Board Serial          : GG3P8800012
     Board Part Number     : 01234567
     Product Manufacturer  : GIGABYTE
     Product Name          : MB10-DS4
     Product Part Number   : 000000000001
     Product Version       : 0100
     Product Serial        : 01234567890123456789AB
     Product Asset Tag     : 01234567890123456789AB
    

    Because in my project, I need to use OpenIPMI API in C code to get the Board Serial, I think that should be unique. So, I use the raw command:

    $ sudo ipmitool raw
    Not enough parameters given.
    RAW Commands:  raw <netfn> <cmd> [data]
    
    Network Function Codes:
    
      VAL   HEX     STRING
    ==============================================
      0     0x00    Chassis
      2     0x02    Bridge
      4     0x04    SensorEvent
      6     0x06    Application
      8     0x08    Firmware
      10    0x0a    Storage
      12    0x0c    Transport
    
    (can also use raw hex values)
    

    Then, try to issue following command for to know more about the raw command format

    $ sudo ipmitool raw 0 0
     01 20 20 20 20 20
    $ sudo ipmitool raw 0 1
     21 00 00 70
    $ sudo ipmitool raw 0 2
    Unable to send RAW command (channel=0x0 netfn=0x0 lun=0x0 cmd=0x2 rsp=0xc7): 
    Request data length invalid
    

    I've googled for several days, but can not find any information, and I've downloaded the source code of ipmitool, maybe I'll try to read the source code more clearly.

    BTW, I've downloaded the IPMI utility 'IPMICFG' from SuperMicro, and follow the guide Supermicro IPMI Device Configuration using IPMICFG, and read A Gentle Introduction with OpenIPMI.

    My Question is, what is the netfn code should I use, and what is the command to get the Board Serial, is this case, the value should be GG3P8800012.

    Any advice?

    Thanks in advance.


    Thanks @Lenniey

    Here is the output of sudo ipmitool fru -vvv:

    $ sudo ipmitool fru -vvv
    Using ipmi device 0
    Set IPMB address to 0x20
    OpenIPMI Request Message Header:
      netfn     = 0x6
      cmd       = 0x1
    Iana: 15370
    Running Get PICMG Properties my_addr 0x20, transit 0, target 0
    OpenIPMI Request Message Header:
      netfn     = 0x2c
      cmd       = 0x0
    OpenIPMI Request Message Data (1 bytes)
     00
    Error response 0xc1 from Get PICMG Properities
    Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
    OpenIPMI Request Message Header:
      netfn     = 0x2c
      cmd       = 0x0
    OpenIPMI Request Message Data (1 bytes)
     03
    Invalid completion code received: Invalid command
    Acquire IPMB address
    Discovered IPMB address 0x0
    Interface address: my_addr 0x20 transit 0:0 target 0x20:0 ipmb_target 0
    
    FRU Device Description : Builtin FRU Device (ID 0)
    OpenIPMI Request Message Header:
      netfn     = 0x6
      cmd       = 0x1
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x10
    OpenIPMI Request Message Data (1 bytes)
     00
    fru.size = 2048 bytes (accessed by bytes)
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 00 00 08
     FRU DATA (9 bytes)
     08 01 00 01 07 0e 00 00 e9
    fru.header.version:         0x1
    fru.header.offset.internal: 0x0
    fru.header.offset.chassis:  0x8
    fru.header.offset.board:    0x38
    fru.header.offset.product:  0x70
    fru.header.offset.multi:    0x0
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 08 00 02
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 08 00 21
    Retrying FRU read with request size 25
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 08 00 19
    Retrying FRU read with request size 24
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 08 00 18
    Retrying FRU read with request size 23
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 08 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 1f 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 36 00 02
     Chassis Type          : Main Server Chassis
     Chassis Part Number   : 01234567
     Chassis Serial        : 01234567890123456789AB
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 38 00 02
    OpenIPMI Request Message Header:
      netfn     = 0xa
       cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 38 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 4f 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 66 00 0a
     Board Mfg Date        : Wed Jan  7 13:07:00 2015
     Board Mfg             : GIGABYTE
     Board Product         : MB10-DS4
     Board Serial          : GG3P8800012
     Board Part Number     : 01234567
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 70 00 02
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 70 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 87 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 9e 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 b5 00 17
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x11
    OpenIPMI Request Message Data (4 bytes)
     00 cc 00 04
     Product Manufacturer  : GIGABYTE
     Product Name          : MB10-DS4
     Product Part Number   : 000000000001
     Product Version       : 0100
     Product Serial        : 01234567890123456789AB
     Product Asset Tag     : 01234567890123456789AB
    
    OpenIPMI Request Message Header:
      netfn     = 0x6
      cmd       = 0x1
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x20
    SDR free space: 14864
    SDR records   : 25
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x22
    SDR reservation ID 0002
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 00 00 00 05
    SDR record ID   : 0x0000
    SDR record id mismatch: 0x0001
    SDR record type : 0x12
    SDR record next : 0x0002
    SDR record bytes: 16
    Getting 16 bytes from SDR at offset 5
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 00 00 05 10
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 02 00 00 05
    SDR record ID   : 0x0002
    SDR record type : 0xc0
    SDR record next : 0x0003
    SDR record bytes: 11
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 03 00 00 05
    SDR record ID   : 0x0003
    SDR record type : 0x01
    SDR record next : 0x0009
    SDR record bytes: 52
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 09 00 00 05
    SDR record ID   : 0x0009
    SDR record type : 0x01
    SDR record next : 0x000a
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 0a 00 00 05
    SDR record ID   : 0x000a
    SDR record type : 0x01
    SDR record next : 0x000c
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 0c 00 00 05
    SDR record ID   : 0x000c
    SDR record type : 0x01
    SDR record next : 0x000d
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 0d 00 00 05
    SDR record ID   : 0x000d
    SDR record type : 0x01
    SDR record next : 0x003b
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 3b 00 00 05
    SDR record ID   : 0x003b
    SDR record type : 0x01
    SDR record next : 0x003c
    SDR record bytes: 47
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 3c 00 00 05
    SDR record ID   : 0x003c
    SDR record type : 0x01
    SDR record next : 0x003d
    SDR record bytes: 46
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 3d 00 00 05
    SDR record ID   : 0x003d
    SDR record type : 0x01
    SDR record next : 0x003e
    SDR record bytes: 47
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 3e 00 00 05
    SDR record ID   : 0x003e
    SDR record type : 0x01
    SDR record next : 0x0040
    SDR record bytes: 51
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 40 00 00 05
    SDR record ID   : 0x0040
    SDR record type : 0x01
    SDR record next : 0x0041
    SDR record bytes: 49
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 41 00 00 05
    SDR record ID   : 0x0041
    SDR record type : 0x01
    SDR record next : 0x0043
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 43 00 00 05
    SDR record ID   : 0x0043
    SDR record type : 0x01
    SDR record next : 0x0047
    SDR record bytes: 52
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 47 00 00 05
    SDR record ID   : 0x0047
    SDR record type : 0x01
    SDR record next : 0x0048
    SDR record bytes: 53
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 48 00 00 05
    SDR record ID   : 0x0048
    SDR record type : 0x01
    SDR record next : 0x0049
    SDR record bytes: 52
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 49 00 00 05
    SDR record ID   : 0x0049
    SDR record type : 0x01
    SDR record next : 0x004a
    SDR record bytes: 57
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 4a 00 00 05
    SDR record ID   : 0x004a
    SDR record type : 0x01
    SDR record next : 0x0088
    SDR record bytes: 56
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 88 00 00 05
    SDR record ID   : 0x0088
    SDR record type : 0x01
    SDR record next : 0x008a
    SDR record bytes: 51
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 8a 00 00 05
    SDR record ID   : 0x008a
    SDR record type : 0x01
    SDR record next : 0x00b9
    SDR record bytes: 51
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 b9 00 00 05
    SDR record ID   : 0x00b9
    SDR record type : 0x02
    SDR record next : 0x00ba
    SDR record bytes: 31
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 ba 00 00 05
    SDR record ID   : 0x00ba
    SDR record type : 0x02
    SDR record next : 0x00bd
    SDR record bytes: 31
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 bd 00 00 05
    SDR record ID   : 0x00bd
    SDR record type : 0x02
    SDR record next : 0x00ca
    SDR record bytes: 36
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 ca 00 00 05
    SDR record ID   : 0x00ca
    SDR record type : 0x01
    SDR record next : 0x00cd
    SDR record bytes: 51
    OpenIPMI Request Message Header:
      netfn     = 0xa
      cmd       = 0x23
    OpenIPMI Request Message Data (6 bytes)
     02 00 cd 00 00 05
    SDR record ID   : 0x00cd
    SDR record type : 0x02
    SDR record next : 0xffff
    SDR record bytes: 30
    

    Follow the advice from @Lenniey, I issue following command:

    $ sudo ipmitool -v raw 0xa 0x11
    Running Get PICMG Properties my_addr 0x20, transit 0, target 0
    Error response 0xc1 from Get PICMG Properities
    Running Get VSO Capabilities my_addr 0x20, transit 0, target 0
    Invalid completion code received: Invalid command
    Discovered IPMB address 0x0
    RAW REQ (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 data_len=0)
    Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 rsp=0xc7): 
    Request data length invalid
    

    Here raises another question: How to get raw command clues from the output of sudo ipmitool fru -vvv ?

    • Lenniey
      Lenniey about 7 years
      I don't think you can use raw to extract this information. But anyway, could you edit the output of sudo ipmitool fru -vvv? Also: you can try your luck with this document: intel.com/content/www/us/en/servers/ipmi/…
    • charles.cc.hsu
      charles.cc.hsu about 7 years
      @Lenniey, thanks for your quick response, I've added the output of ipmitool fru -vvv in my question.
    • Lenniey
      Lenniey about 7 years
      try sudo ipmitool -v raw 0xa 0x11 or something like that.
    • Lenniey
      Lenniey about 7 years
      Sorry, I really don't know more but I think with some tinkering you might be able to get what you need
    • charles.cc.hsu
      charles.cc.hsu about 7 years
      @Lenniey, it's OK. I installed the ipmitool from the source, modified the C code in the lib folder, added some func to get the information from the func call by ipmitool sensor, ipmitool mc info ,plus, I parsed the file /proc/cpuinfo to get the CPU model type. It's good enough for me to continue my project. Thanks, anyway.
    • Lenniey
      Lenniey about 7 years
      Woah, alright, sounds a bit extreme but whatever works :) You could add it as an answer, maybe.