bug-xorriso
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-xorriso] [bug #46716] Protective MBR partition is not marked as


From: Alexander E. Patrakov
Subject: Re: [Bug-xorriso] [bug #46716] Protective MBR partition is not marked as bootable
Date: Sat, 19 Dec 2015 21:28:41 +0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

19.12.2015 20:23, Thomas Schmitt пишет:

For the investigation i could need:

- An ISO produced by grub-mkrescue as used by Alexander.
   Lean would be nice. Please post download URL.
   Newest xorriso releases can deduce the used options from the
   ISO and replay them.
   Please also tell your exact grub-mkreascue arguments.

- A quick starter for Debian Jessie or Sid how i get to the same
   GRUB2 environment in which Alexander runs grub-mkrescue.
   (This is on my todo list since half a year. I apologize.)

I think that the easiest option would be to describe the way how to produce the minimal iso that can only boot to GRUB command line, as that's enough to reproduce the issue.

1. Make yourself a virtual machine, install Debian Jessie i386 there from the official CD. Install "standard system utilities", ssh server if you want, and nothing else.

2. Install some additional packages:

apt-get -y install mtools xorriso \
  grub-efi-amd64-bin grub-efi-ia32-bin grub-pc-bin grub2-common

3. Make a minimal iso image:

mkdir minimal
touch minimal/empty-file.txt
grub-mkrescue --modules="part_gpt part_msdos" -o output.iso minimal

The --modules="part_gpt part_msdos" argument is a workaround for the fact that Debian Jessie doesn't have the fix from grub commit eeea31b2. It isn't needed with modern grub.

The iso, if you still need it, is available at http://82.193.153.141/minimal.iso

4. Copy it out of the VM, try to boot it several ways. Here "boots" = "displays GRUB command prompt", which is exactly the purpose of the test ISO.

qemu-system-x86_64 -enable-kvm -hda minimal.iso  # boots
qemu-system-x86_64 -enable-kvm -cdrom minimal.iso  # boots
qemu-system-x86_64 -bios OVMF.fd -enable-kvm -hda minimal.iso # boots, both for 32-bit and 64-bit OVMF qemu-system-x86_64 -bios OVMF.fd -enable-kvm -cdrom minimal.iso # boots, both for 32-bit and 64-bit OVMF

Then, write the iso to the USB flash stick with dd, try to find an old PC with a braindamaged BIOS that checks for bootable partitions, and test it there. Result: the USB flash drive is not recognized as bootable.

If you don't have such old PC, you can simulate the BIOS bug by rebuilding seabios with this patch (just apply the patch and run "make"):

diff --git a/src/boot.c b/src/boot.c
index e0f73a3..4e60143 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -627,6 +627,13 @@ boot_disk(u8 bootdrv, int checksig)
             printf("Boot failed: not a bootable disk\n\n");
             return;
         }
+        if (!GET_FARVAR(bootseg, mbr->partitions[0].status) &&
+            !GET_FARVAR(bootseg, mbr->partitions[1].status) &&
+            !GET_FARVAR(bootseg, mbr->partitions[2].status) &&
+            !GET_FARVAR(bootseg, mbr->partitions[3].status)) {
+                printf("Boot failed: no bootable partition\n\n");
+                return;
+        }
     }

     tpm_add_bcv(bootdrv, MAKE_FLATPTR(bootseg, 0), 512);

Then:

qemu-system-x86_64 -bios seabios/out/bios.bin -enable-kvm -cdrom minimal.iso # boots qemu-system-x86_64 -bios seabios/out/bios.bin -enable-kvm -hda minimal.iso # fails

P.S. the BIOS bug is documented in Arch wiki: https://wiki.archlinux.org/index.php/GUID_Partition_Table#Workarounds

--
Alexander E. Patrakov



reply via email to

[Prev in Thread] Current Thread [Next in Thread]