parsing of dmidecode fails on SMBIOS warning

Bug #882574 reported by Lorax
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OCS Inventory: Unified Unix Agent
Fix Released
Medium
mortheres

Bug Description

If SMBIOS 2.7 is present, the dmidecode utility adds warning in the form of comments to the output which are included in fields like serial number and bios version.

Warning free output from dmidecode:

# dmidecode 2.10
SMBIOS 2.6 present.
78 structures occupying 4581 bytes.
Table at 0xBF49C000.

Handle 0xDA00, DMI type 218, 11 bytes
...

With the warning comments:
# dmidecode 2.10
SMBIOS 2.7 present.
# SMBIOS implementations newer than version 2.6 are not
# fully supported by this version of dmidecode.
55 structures occupying 2703 bytes.
Table at 0x000E66D0.

Handle 0x002C, DMI type 218, 11 bytes
...

This appears in the systems table like:

http2.mtl 2011-10-27 08:34:51 http2 CentOS release 5.6 (Final) 16041 3400 # SMBIOS implementations newer than version 2.6 are not # fully supported by this version of dmidecode. 7XXG8Z5 # SMBIOS implementations newer than version 2.6 are not # fully supported by this version of dmidecode. 1.1.1

mortheres (mortheres)
Changed in ocsinventory-unix-agent:
assignee: nobody → mortheres (mortheres)
Revision history for this message
mortheres (mortheres) wrote :

Hi,

Thanks a lot for your report. Since I cannot reproduce the problem for the moment, I will need you to give me some informations:

- OCS Unix agent version
- Operating system on which the problem occurs (CentOS right ?)
- An example of data and the fields on which the problem occurs (memory, bios etc...)

Thanks a lot in advance.

Kind regards,

Guillaume

Changed in ocsinventory-unix-agent:
importance: Undecided → Medium
Revision history for this message
Matt Renfrow (mrenfrow) wrote :

I've run into the same issue with our CentOS deployment. Here's some relevant info:

OCS Unified Agent version 2.0.3
CentOS release 6.1 (Final)

The extra lines appear wherever the OCS agent pulls a string from dmidecode. For example, the "Manufracturer" or "Model" section include the extra two lines before the output:

# SMBIOS implementations newer than version 2.6 are not
# fully supported by this version of dmidecode. ProLiant BL460c G6

For example, in Bios.pm it's running the following command to pull the manufacturer info:

dmidecode -s system-manufacturer

And the result should be "HP", for example, however the result ends up being:

# SMBIOS implementations newer than version 2.6 are not
# fully supported by this version of dmidecode.
HP

.....

I've noticed that the serial number, manufacturer, model, BIOS manufacturer, BIOS version, BIOS data, ASSETTAG, and Uuid fields all include this extra noise.

Revision history for this message
Frank (frank-bourdeau) wrote :

Can you test the latest trunk version of the agent, please?

Changed in ocsinventory-unix-agent:
status: New → Fix Committed
mortheres (mortheres)
Changed in ocsinventory-unix-agent:
milestone: none → 2.1rc1
Revision history for this message
Daniel Rich (drich-u) wrote :

I'm fighting the same problem, and I still this in the 2.1 release. The worst part is the embedded newlines in data.

    <BIOS>
      <ASSETTAG># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
                                </ASSETTAG>
      <BDATE># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
12/20/2013</BDATE>
      <BMANUFACTURER># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
HP</BMANUFACTURER>
      <BVERSION># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
P70</BVERSION>
      <MMANUFACTURER># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.</MMANUFACTURER>
      <MMODEL># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.</MMODEL>
      <MSN># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.</MSN>
      <SMANUFACTURER># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
HP</SMANUFACTURER>
      <SMODEL># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
ProLiant DL380p Gen8</SMODEL>
      <SSN># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
XXXXXXXXXX </SSN>
      <TYPE># SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
Rack Mount Chassis</TYPE>
    </BIOS>

Revision history for this message
Daniel Rich (drich-u) wrote :

I should mention, this is on RHEL6.4 with the 2.1 agent. The value shows up in all of the BIOS entries as seen above, as well as in the UUID. At my site, I'm seeing this in 187 hosts out of the nearly 8000 I have in OCS Inventory.

 User agent: OCS-NG_unified_unix_agent_v2.1

Revision history for this message
Daniel Rich (drich-u) wrote :

I believe the problem is that the regexp that was added doesn't really match the output of dmidecode since the newlines make it multiline output. The following patches should fix it:

--- /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Bios.pm.orig 2014-06-16 11:23:09.901219209 -0700
+++ /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Bios.pm 2014-06-16 11:23:28.592457680 -0700
@@ -18,15 +18,15 @@
   $Type = `dmidecode -s chassis-type`;

   chomp($SystemModel);
- $SystemModel =~ s/^#+\s+$//g;
+ $SystemModel =~ s/^#[^\n]*\n//msg;
   chomp($SystemManufacturer);
- $SystemManufacturer =~ s/^#+\s+$//g;
+ $SystemManufacturer =~ s/^#[^\n]*\n//msg;
   chomp($SystemSerial);
- $SystemSerial =~ s/^#+\s+$//g;
+ $SystemSerial =~ s/^#[^\n]*\n//msg;
   chomp($AssetTag);
- $AssetTag =~ s/^#\s+$//g;
+ $AssetTag =~ s/^#[^\n]*\n//msg;
   chomp($Type);
- $Type =~ s/^#\s+$//g;
+ $Type =~ s/^#[^\n]*\n//msg;

   #Motherboard DMI
   $MotherboardManufacturer = `dmidecode -s baseboard-manufacturer`;

and

--- /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/UUID.pm.orig 2014-06-16 11:25:30.334009447 -0700
+++ /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/UUID.pm 2014-06-16 11:23:37.520571563 -0700
@@ -12,7 +12,7 @@

   $uuid = `dmidecode -s system-uuid`;
   chomp($uuid);
- $uuid =~ s/^#+\s+$//g;
+ $uuid =~ s/^#[^\n]*\n//msg;

    $common->setHardware({
       UUID => $uuid,

Revision history for this message
Daniel Rich (drich-u) wrote :

I missed a couple of replacements in that first patch, I will attach clean versions of the patch momentarily.

Revision history for this message
Daniel Rich (drich-u) wrote :
Revision history for this message
Daniel Rich (drich-u) wrote :
Frank (frank-bourdeau)
Changed in ocsinventory-unix-agent:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.