python-libsmbbios bios version check on lucid [backport request]

Bug #813210 reported by Aurelien Guillaume
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libsmbios (Ubuntu)
Fix Released
Medium
Brian Murray
Lucid
Fix Released
Medium
Brian Murray

Bug Description

Hello,

I encountered a bug while updating some Dell server BIOS, with a 3.0.0 BIOS on Ubuntu 10.04 LTS (lucid). The current version of python-libsmbios on lucid suffers of a parsing bug on the bios version string, due to null bytes (.0.0) in the version string.

With the following files:

Works: http://linux.dell.com/repo/firmware/bios-hdrs/system_bios_ven_0x1028_dev_0x0236_version_2.3.12/bios.hdr
Fails: http://linux.dell.com/repo/firmware/bios-hdrs/system_bios_ven_0x1028_dev_0x0236_version_3.0.0/bios.hdr

== SRU Justification ==

* Impact: users needing to upgrade DELL server's firmware to version 3.0.0 on Ubuntu 10.04 LTS are not be able to do so due to parsing issue.

TEST CASE:
  How to reproduce:
     1. wget http://linux.dell.com/repo/firmware/bios-hdrs/system_bios_ven_0x1028_dev_0x0236_version_3.0.0/bios.hdr
     2. smbios-rbu-bios-update --hdr-info=bios.hdr

  Expected results:
     No error messages, and a proper parse output from the bios.
  Actual results:
     Python traceback.

Output from step 2 failing follows:
# smbios-rbu-bios-update --hdr-info=bios-3.0.0.hdr
BIOS HDR file information dump.

Filename: /dev/shm/bios.hdr
File magic header: $RBU
Header length: 84
Header major version: 2
Header minor version: 0
Number of supported systems: 10
Quick check field: Copyright 2011 Dell Inc.
Traceback (most recent call last):
  File "/usr/sbin/smbios-rbu-bios-update", line 185, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-rbu-bios-update", line 138, in main
    dumpHdrFileInfo(h)
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.dumpHdrFileInfo at 0x0184C6E0>", line 3, in dumpHdrFileInfo
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 43, in dumpHdrFileInfo
    print _("BIOS Version: %s") % hdr.biosVersion()
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.biosVersion at 0x018A25F0>", line 3, in biosVersion
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 87, in biosVersion
    ver = "%d.%d.%d" % struct.unpack("BBB", self.hdr.biosVersion)
struct.error: unpack requires a string argument of length 3

On newer Ubuntu versions, libsmbios has a fix about that ; could it be backported to lucid ?

--- /usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py.old 2011-07-19 23:57:50.506269986 +0200
+++ /usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py 2011-07-20 00:14:46.656270075 +0200
@@ -107,7 +107,7 @@
         #char quickCheck[40];
         ("quickCheck", ctypes.c_char * 40),
         #char biosVersion[3];
- ("biosVersion", ctypes.c_char * 3),
+ ("biosVersion", ctypes.c_uint8 * 3),
         #u8 miscFlags;
         ("miscFlags", ctypes.c_uint8),
         #u8 biosInternalUse;

Thanks.

Description: Ubuntu 10.04.2 LTS
Release: 10.04

libsmbios2:
  Installed: 2.2.13-0ubuntu4.1
  Candidate: 2.2.13-0ubuntu4.1
  Version table:
 *** 2.2.13-0ubuntu4.1 0
        500 http://fr.archive.ubuntu.com/ubuntu/ lucid-updates/universe Packages
        100 /var/lib/dpkg/status
     2.2.13-0ubuntu4 0
        500 http://fr.archive.ubuntu.com/ubuntu/ lucid/universe Packages
        500 http://linux.dell.com/repo/community/deb/latest/ Packages

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libsmbios (Ubuntu):
status: New → Confirmed
Revision history for this message
Jose Plans (jplans) wrote :

Thanks Aurelien for the bug report, I am proposing an SRU based on your bug report, I have also confirmed this fixes the issue you have reported. Jose

Revision history for this message
Jose Plans (jplans) wrote :

== SRU Justification ==

* Impact: users needing to upgrade DELL server's firmware to version 3.0.0 on Ubuntu 10.04 LTS would not be able to do so due to parsing issue.

* Fix:
 The fix is a trivial parsing fix of one liner:
--
- ("biosVersion", ctypes.c_char * 3),
+ ("biosVersion", ctypes.c_uint8 * 3),
--

* Test case:
  How to reproduce:
     1. wget http://linux.dell.com/repo/firmware/bios-hdrs/system_bios_ven_0x1028_dev_0x0236_version_3.0.0/bios.hdr
     2. smbios-rbu-bios-update --hdr-info=bios.hdr

  Expected results:
     No error messages, and a proper parse output from the bios.
  Actual results:
     Python traceback.
--
Traceback (most recent call last):
  File "/usr/sbin/smbios-rbu-bios-update", line 185, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-rbu-bios-update", line 138, in main
    dumpHdrFileInfo(h)
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.dumpHdrFileInfo at 0x0184C6E0>", line 3, in dumpHdrFileInfo
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 43, in dumpHdrFileInfo
    print _("BIOS Version: %s") % hdr.biosVersion()
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.biosVersion at 0x018A25F0>", line 3, in biosVersion
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 87, in biosVersion
    ver = "%d.%d.%d" % struct.unpack("BBB", self.hdr.biosVersion)
struct.error: unpack requires a string argument of length 3
--

* Regression potential: none.

Revision history for this message
Jose Plans (jplans) wrote :

Debdiff for Lucid

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Debdiff for Lucid" of this bug report has been identified as being a patch in the form of a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Thanks for the debdiff. I don't think that fix is quite complete. You probably want the following commits:

http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=libsmbios.git;a=commit;h=467b73fee54ec872eaf38e85068b6c0a92da0762
http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=libsmbios.git;a=commit;h=357c5bbbcfd9faf799c414e8ba15d27bdd6a2aca
http://linux.dell.com/cgi-bin/gitweb/gitweb.cgi?p=libsmbios.git;a=commit;h=fe0fe0e3e7f64e38912bb76896b931320a2707db

I am going to unsubscribe ubuntu-sponsors. Once you've uploaded an updated debdiff, please resubscribe ubuntu-sponsors so this can be looked at. Thanks!

Changed in libsmbios (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Jose Plans (jplans) wrote :

Thanks for the pointers Marc! I will check and upload the diff asap. Jose

Revision history for this message
Jose Plans (jplans) wrote :

Updated debdiff for Lucid including commits:
- 467b73fee54ec872eaf38e85068b6c0a92da0762 : fixup bios versioning for new-style versioning with 0's in ver
- 357c5bbbcfd9faf799c414e8ba15d27bdd6a2aca : ver=unknown if rbu version=1 and not alpha chars
- fe0fe0e3e7f64e38912bb76896b931320a2707db : fixup typo
Verified the fix.

Changed in libsmbios (Ubuntu):
status: Incomplete → In Progress
assignee: nobody → Brian Murray (brian-murray)
importance: Undecided → Medium
Changed in libsmbios (Ubuntu Lucid):
status: New → In Progress
importance: Undecided → Medium
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded the debdiff to lucid-proposed.

Changed in libsmbios (Ubuntu Lucid):
assignee: nobody → Brian Murray (brian-murray)
Changed in libsmbios (Ubuntu):
status: In Progress → Fix Released
Changed in libsmbios (Ubuntu Lucid):
assignee: Brian Murray (brian-murray) → nobody
importance: Medium → Undecided
status: In Progress → New
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Bryce Harrington (bryce) wrote :

Looks like sponsoring work has been finished; unsubscribing sponsors team.

Revision history for this message
Bryce Harrington (bryce) wrote :

(Sorry for accidentally duplicating the debdiff upload; my upload should be dropped in favor of brian's)

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Aurelien, or anyone else affected,

Accepted into oneiric-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I tested Lucid package from proposed, and it is not work.

Here is the console output:

~$ smbios-rbu-bios-update --hdr-info=bios.hdr
BIOS HDR file information dump.

Filename: bios.hdr
File magic header: $RBU
Header length: 84
Header major version: 2
Header minor version: 0
Number of supported systems: 10
Quick check field: Copyright 2011 Dell Inc.
Traceback (most recent call last):
  File "/usr/sbin/smbios-rbu-bios-update", line 185, in <module>
    sys.exit( main() )
  File "/usr/sbin/smbios-rbu-bios-update", line 138, in main
    dumpHdrFileInfo(h)
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.dumpHdrFileInfo at 0xB757A80C>", line 3, in dumpHdrFileInfo
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 43, in dumpHdrFileInfo
    print _("BIOS Version: %s") % hdr.biosVersion()
  File "<libsmbios_c._peak_util_decorators.rewrap wrapping libsmbios_c.rbu_hdr.biosVersion at 0xB758117C>", line 3, in biosVersion
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/trace_decorator.py", line 98, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.6/dist-packages/libsmbios_c/rbu_hdr.py", line 87, in biosVersion
    ver = "%d.%d.%d" % struct.unpack("BBB", self.hdr.biosVersion)
struct.error: unpack requires a string argument of length 3
a@a:~$ apt-cache policy libsmbios2
libsmbios2:
  Zainstalowana: 2.2.13-0ubuntu4.2
  Kandydująca: 2.2.13-0ubuntu4.2
  Tabela wersji:
 *** 2.2.13-0ubuntu4.2 0
        500 http://pl.archive.ubuntu.com/ubuntu/ lucid-proposed/universe Packages
        100 /var/lib/dpkg/status
     2.2.13-0ubuntu4.1 0
        500 http://pl.archive.ubuntu.com/ubuntu/ lucid-updates/universe Packages
     2.2.13-0ubuntu4 0
        500 http://pl.archive.ubuntu.com/ubuntu/ lucid/universe Packages

tags: added: verification-failed
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

I missed the python-libsmbios package during upgrade :-P.
After reinstall all packages: python-libsmbios smbios-utils libsmbios2 it works perfectly for me.

Verification done.

Here is the console output:

~$ smbios-rbu-bios-update --hdr-info=bios.hdr
BIOS HDR file information dump.

Filename: bios.hdr
File magic header: $RBU
Header length: 84
Header major version: 2
Header minor version: 0
Number of supported systems: 10
Quick check field: Copyright 2011 Dell Inc.
BIOS Version: 3.0.0
Misc flags: 1
Compatibility flags: 27
System ID: 0x0235 Hardware Revision: 0
System ID: 0x0236 Hardware Revision: 0
System ID: 0x0237 Hardware Revision: 0
System ID: 0x0290 Hardware Revision: 0
System ID: 0x0292 Hardware Revision: 0
System ID: 0x02e9 Hardware Revision: 0
System ID: 0x041d Hardware Revision: 0
System ID: 0x0430 Hardware Revision: 0
System ID: 0x041c Hardware Revision: 0
System ID: 0x045e Hardware Revision: 0

tags: added: verification-done
removed: verification-failed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libsmbios - 2.2.13-0ubuntu4.2

---------------
libsmbios (2.2.13-0ubuntu4.2) lucid-proposed; urgency=low

  * Fixes the BIOS version parsing issue in LP: #813210.
    - fixup bios versioning for new-style versioning with 0's in ver
    - ver=unknown if rbu version=1 and not alpha chars
    - fixup typo
 -- Jose Plans <email address hidden> Wed, 07 Dec 2011 12:41:11 +0000

Changed in libsmbios (Ubuntu Lucid):
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.