Package: efibootmgr
Version: 0.5.4-6
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch saucy

In https://bugs.launchpad.net/bugs/1065261, I got a report that
'efibootmgr -w' overwrites an existing unique MBR signature.  This is
contrary to its documentation, which says "write unique sig to MBR if
needed", and to the ChangeLog entry that introduced it, which said:

- Added test for non-zero signature on MBR-style disks,
  and new -w flag to write a unique signature to the disk if so.

This could be resolved either way: by correcting the documentation or by
correcting the code.  However, overwriting existing unique MBR
signatures breaks Windows installations on the same disk, and the UEFI
specification says of this field that it should be set by the OS rather
than by the firmware.  To satisfy all the requirements here, we want a
way to set an MBR signature if it is not already non-zero.  grub-install
uses the -w option to achieve this, believing the documentation, and if
the documentation were changed to match the code then grub-install would
have to grow some quite complex code to do all the MBR handling itself.
It seems a far superior approach to change efibootmgr's code instead.

  * Fix implementation of -w option to match documentation by leaving an
    existing unique MBR signature intact (LP: #1065261).

diff -Nru efibootmgr-0.5.4/debian/patches/series 
efibootmgr-0.5.4/debian/patches/series
--- efibootmgr-0.5.4/debian/patches/series      2013-01-23 17:30:38.000000000 
+0000
+++ efibootmgr-0.5.4/debian/patches/series      2013-02-01 15:50:25.000000000 
+0000
@@ -1,3 +1,4 @@
 ldflags.patch
 docbook-fixes.patch
 efibootmgr-0.5.4-support-4k-sectors.patch
+w-keep-existing-mbr-signature.patch
diff -Nru efibootmgr-0.5.4/debian/patches/w-keep-existing-mbr-signature.patch 
efibootmgr-0.5.4/debian/patches/w-keep-existing-mbr-signature.patch
--- efibootmgr-0.5.4/debian/patches/w-keep-existing-mbr-signature.patch 
1970-01-01 01:00:00.000000000 +0100
+++ efibootmgr-0.5.4/debian/patches/w-keep-existing-mbr-signature.patch 
2013-02-01 15:51:44.000000000 +0000
@@ -0,0 +1,20 @@
+Description: Fix -w option to leave an existing unique MBR signature intact
+ This makes the implementation match the documentation.
+Author: Colin Watson <[email protected]>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1065261
+Forwarded: no
+Last-Update: 2013-02-01
+
+Index: b/src/lib/disk.c
+===================================================================
+--- a/src/lib/disk.c
++++ b/src/lib/disk.c
+@@ -352,7 +352,7 @@
+               
printf("******************************************************\n\n");
+               
+       }
+-      else if (opts.write_signature) {
++      else if (!mbr->unique_mbr_signature && opts.write_signature) {
+               
+               /* MBR Signatures must be unique for the 
+                  EFI Boot Manager

Thanks,

-- 
Colin Watson                                       [[email protected]]


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to