0

I have a liveusb, it currently works on an uefi computer. I encountered more and more computers which are uefi only and which are configured to boot only from gpt with password locked bios. But in the same time I still have a sometimes legacy bios computers which boots only from mbr.

As I have a 16mb drive, this sounds to be the ideal solution to have a general purpose legacy loader which would be able to load a uefi loader from an other usb.

5
  • Generally, a LiveUSB should work on both MBR and UEFI computers? Have you tested this LiveUSB on a legacy bios? Please clarify your question so people can help you.
    – Natsu Kage
    Jan 25, 2020 at 23:51
  • @NatsuKage the liveusb I have works through uefi boot mode. Not the legacy mode. Because grub is installed through uefi. Jan 26, 2020 at 0:23
  • I think they call the type of liveusb you are thinking of a hybrid iso: wiki.osdev.org/…
    – Natsu Kage
    Jan 26, 2020 at 0:40
  • 1
    In short if you are trying to boot gpt disks on legacy bios computers then use hybrid mbr : rodsbooks.com/gdisk/hybrid.html
    – Madhubala
    Jan 26, 2020 at 1:43
  • @Madhubala thank you. If you know how to install grub as hybrid mbr, then I would accept your answer. Jan 26, 2020 at 12:27

1 Answer 1

1

I will suggest you to follow a detailed manual of hybrid MBR here - https://www.rodsbooks.com/gdisk/hybrid.html

But as an example you can have a look (i have not mentioned any details here.)

sudo gdisk /dev/sdd
[sudo] password for root: 
GPT fdisk (gdisk) version 1.0.4

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): r

Recovery/transformation command (? for help): p
Disk /dev/sdd: 15130624 sectors, 7.2 GiB
Model: Storage Media   
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 4A7748B4-58A5-4521-B555-CAC28D452779
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 15130590
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          411647   200.0 MiB   0700  
   2          411648         4605951   2.0 GiB     AF00  
   3         4605952         7489535   1.4 GiB     8300  
   4         7489536        10332159   1.4 GiB     0700  
   5        10332160        12089343   858.0 MiB   8300  
   6        12089344        15128575   1.4 GiB     8300  

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 1 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): n

I selected no since i already had EFI GPT partition with bootloader.If you don't have that partition then you have select yes,something like this -

Creating entry for partition #1
Enter an MBR hex code (default AF): af
Set the bootable flag? (Y/N): n

A note from hybrid MBR

GPT fdisk can create the EFI GPT (0xEE) placeholder partition either before or after the hybridized partitions in the MBR table. (Note that this has nothing to do with the disk sectors this partition protects.) Each placement has its advantages. Putting the 0xEE partition first in the table works best with GRUB Legacy and GRUB 2, which treat the disk as an MBR disk if the first slot in the MBR is not a 0xEE partition. This first-position placement of 0xEE, however, can render Windows unable to read subsequent partitions if the disk is a removable disk, such as a USB flash drive. Overall, if the disk is a hard disk, I recommend putting the 0xEE partition first; if it's a removable disk, putting it later in the table may work better.

Creating entry for GPT partition #1 (MBR partition #1)
Enter an MBR hex code (default 07): 
Set the bootable flag? (Y/N): y

Creating entry for GPT partition #3 (MBR partition #2)
Enter an MBR hex code (default 83): 
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #4 (MBR partition #3)
Enter an MBR hex code (default 07): 
Set the bootable flag? (Y/N): n

Recovery/transformation command (? for help): o

Disk size is 15130624 sectors (7.2 GiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1      *           2048       411647   primary     0x07
   2               4605952      7489535   primary     0x83
   3               7489536     10332159   primary     0x07
   4                     1         2047   primary     0xEE

Recovery/transformation command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdd.
The operation has completed successfully.
1
  • Getting hybrid mbr and loading the same grub configuration through are 2 different things. I perfectly understand the concept, the problem is having a hybrid grub in practice. Jan 28, 2020 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .