Hybrid BIOS-UEFI Boot Fails on USB Drive

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Mon Sep 23, 2019 10:08 am

My Computer
  • Motherboard: ASUS ROG Maximus VII Ranger; UEFI BIOS
  • Processor: Intel i7-4790K; 4GHZ
  • RAM: 16GB DDR3
  • GPU: nVidia GTX960
  • SDD: 500GB, MBR, Windows7
  • HDD1: 600GB, MBR, NTFS data storage
  • HDD2: 500GB, MBR, Ubuntu 18.04, Mint 19.2 Tessa, KDE Neon
I am trying to create a USB flash memory stick with Linux Mint 19.2 Tina so that it will boot from either legacy BIOS or UEFI. I'm following the method described in a tutorial written by pbear for a hybrid boot described in this link: viewtopic.php?t=287353

Four partitions were created using Gparted from the installation media: One for bios_grub, one for UEFI, one for swap, and one ext4 (refer to the attachment). Installation of Linux Mint 19.2 progressed as expected. The next step is to boot into the newly installed OS via MBR/BIOS. The memory stick is not recognized as a bootable device and thus I cannot proceed to install the UEFI bootloader.

I tried to mount the bios_grub partition to see what is in there but received an error message saying the file system is unknown because it's not listed in /etc/fstab. Thus I am stalled at this point because I cannot boot into the Mint installed on the USB memory stick.

As noted in my system description, Linux Mint 19.2 Tessa (not Tina) is installed on a multi-boot hard drive and runs as expected. The only difference between the HDD and the flash memory installs is that the HDD uses an msdos partition table while the USB memory uses gpt per instructions found in the tutorial.

Firmware on the motherboard is:
64Mb UEFI AMI BIOS, PnP, DMI2.7, WfM2.0, SM BIOS 2.7, ACPI5.0a, Multi‐Language BIOS

I set the eeprom to legacy BIOS boot only given that I do not need UEFI on this machine. The boot device order is set to look at the USB port first, but I can select it manually. I also attempted this hybrid boot using KDE Neon instead of Mint, but it still will not boot. And, I created a USB installation allowing the installer to set the partitions and format – didn't use “something else” during install. This version boots as expected which I assume is due to the fact the partition table is not gpt in that instance.

Any help on how to fix this problem would be appreciated.
Attachments
parted_out.png
Last edited by theYogster on Tue Sep 24, 2019 3:18 pm, edited 2 times in total.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 11:15 am

pbear will be the best one to answer here, but...

All looks good (I assume you picked the stick as the bootloader location) so I expect you may here have run into a BIOS oddity. I have encountered more than one BIOS that needs a MBR partition active to even consider booting from it. Yes, it shouldn't, but well, that's old BIOS for you. Fortunately the GPT includes a so-called "protective MBR" for compatibility, with a single type 0xee partition taking up the entire drive. I have not encountered a BIOS for which simply setting that partition active wasn't enough...

I.e., use fdisk -t dos /dev/sdz on the stick, "p" to verify said single 0xee partition, "a" to mark it active, "w" to write it out and quit. Chances are relatively fair your BIOS will then consider it blessed...

User avatar
BG04PF
Level 1
Level 1
Posts: 33
Joined: Thu Aug 08, 2019 1:46 am

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by BG04PF » Mon Sep 23, 2019 11:25 am

Did you disable the voice "Secure Boot" in the bios?
Last edited by BG04PF on Mon Sep 23, 2019 1:44 pm, edited 1 time in total.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 12:09 pm

Unfortunately I need to be away so I can't wait longer for confirm/deny of the protective MBR trick. It it worked, I suppose pbear may want to include it in the tutorial. I believe quoting him as per below should "summon" him here...
pbear wrote:
Tue Feb 05, 2019 3:23 am
viewtopic.php?f=42&t=287353

User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Mon Sep 23, 2019 12:18 pm

rene-
I apologize for the delay, but, being unfamiliar as I am with all the intricacies of Linux, I'm having trouble executing the fdisk commands. To Wit:
root@ccc-UbuLTS:~# fdisk -t dos /dev/sdd1

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xbb4fbab8.

Command (m for help): p
Disk /dev/sdd1: 2 MiB, 2097152 bytes, 4096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbb4fbab8

Command (m for help): o 0xbb4fbab8
Created a new DOS disklabel with disk identifier 0xca6e8d01.

Command (m for help): a 0xbb4fbab8
No partition is defined yet!
I'm stuck there and can't seem to give fdisk what it needs to flip the 'a' switch

User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Mon Sep 23, 2019 12:20 pm

BG04PF-
Secure boot is disabled by default in that I'm booting in BIOS/MBR.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 12:24 pm

(from a tablet, excuse brevity)

/dev/sdd if that's (still) the disk, not /dev/sdd1

Oh, q to exit fdisk now

User avatar
pbear
Level 8
Level 8
Posts: 2465
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by pbear » Mon Sep 23, 2019 12:34 pm

rene wrote:
Mon Sep 23, 2019 12:09 pm
I believe quoting him as per below should "summon" him here...
You rang? Will do what I can but haven't had to understand protective MBR till now, so will be more learning than helping on this round.

Anyhoo, Yogster, looking at your partition scheme, I'm puzzled about sdd2. What is that? As for your mount question, I believe you can do that with sudo mount -o loop /dev/sdd1 /mnt. Release with sudo umount /mnt.

Aside, no need for a swap partition and I'd leave it off a flash drive. Installer will create a swapfile, which is a more efficient use of space.

Another aside, secure boot will have to be disabled on any UEFI machine you use the hybrid drive with, as it's using the backup bootloader. Not much point pursuing this if you can't expect to be allowed access to the firmware settings.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 12:40 pm

No, you can't mount a bios_grub partition. It does not contain a file system, is pure reserved space to which the second stage grub binary is directly written (before GPT, said second stage used to embed itself between the actual MBR, the first sector, and the start of the first partition; with GPT no such "guaranteed" available space remained, so the bios_grub partition was introduced to be such). His /dev/sdd2 is just unpartitioned space, supposedly alignment dictated.

And please stop being interesting; I can't be here...

User avatar
pbear
Level 8
Level 8
Posts: 2465
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by pbear » Mon Sep 23, 2019 12:51 pm

I'll take your word for it on the mount command. Thought I remembered it working for this, but my memory ain't what it used to be.

ETA: Testing, nope, it doesn't work with the BIOS boot partition, though it does work with the EFI partition. Sorry for the confusion, Yogster.

By the way, for comparison, here's what I get when I run fdisk on a hybrid USB drive:

Code: Select all

pbear@miss-gulch:~$ sudo fdisk -t dos /dev/sdb
[sudo] password for pbear:         

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 1.8 TiB, 2000398931968 bytes, 3907029164 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1           1 3907029163 3907029163  1.8T ee GPT
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 1:03 pm

phd21 just decided to respond to the other open interesting thread so, ah, well. Yes, that's a valid protective MBR with the disk-spanning 0xee partition. From that screen, "a" to make it active....

User avatar
pbear
Level 8
Level 8
Posts: 2465
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by pbear » Mon Sep 23, 2019 1:14 pm

rene wrote:
Mon Sep 23, 2019 1:03 pm
Yes, that's a valid protective MBR with the disk-spanning 0xee partition. From that screen, "a" to make it active....
Don't mind doing that as a test, provided it's reversible. (Understand, my hybrid drive boots fine.) How would I do that? I did check the fdisk man page first and (rather annoyingly) it doesn't cover any of what you're doing here. BTW, I'm off to work soon myself.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 1:20 pm

Really just "a" from that screen, then "w" to write and quit; see below. Note though that you won't experience any sort of change if yoyr BIOS also boots the disk fine in BIOS mode without the protective partition marked active...

Code: Select all

rene@t5500:~$ fdisk -t dos image

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk image: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start     End Sectors  Size Id Type
image1              1 2097151 2097151 1024M ee GPT

Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk image: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start     End Sectors  Size Id Type
image1     *        1 2097151 2097151 1024M ee GPT

Command (m for help): w
The partition table has been altered.
Synching disks.

User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

[SOLVED] Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Mon Sep 23, 2019 1:29 pm

Technically speaking, I would have to say the specific problem I inquired about has been solved. After following rene's instructions to select the entire device instead of just the partition I was able to set it active. Being active, the USB memory stick with Linux Mint now boots properly in the BIOS/MBR machine. The next step will be to install the UEFI bootloader and give it the ultimate test on my Windows 10 laptop. I'll follow up on that if you are interested.

I understand that swap isn't needed for the version Mint I'm dealing with. It was needed when I used the same stick to install another distro of Linux (KDE Neon) for testing purposes. I just left it in place when I installed Mint on the same stick because it was expedient to do so.

Also, I added an unformatted 1 MB partition to the end of the memory because I read somewhere (written by less enlightened people) that it is needed for backup of the GRUB partition, or some such thing. Don't know why "parted" lists it the way it does.

Much of what I am doing in this instance is proof of concept and experimental. The final product will indeed be cleaner and sans the extra partitions. Thank you all for your help. It certainly is an interesting project.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Mon Sep 23, 2019 1:32 pm

Great. Now really off then... :)

User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Mon Sep 23, 2019 1:41 pm

pbear-
And for what it's worth

Code: Select all

root@ccc-UbuLTS:~# sudo mount -o loop /dev/sdd1 /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop14, missing codepage or helper program, or other error.
root@ccc-UbuLTS:~# 
Don't know what it is about that partition, but it refuses to be mounted by mere mortals. Not that I REALLY need to, but I figured it should work.

User avatar
pbear
Level 8
Level 8
Posts: 2465
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: [SOLVED] Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by pbear » Mon Sep 23, 2019 8:02 pm

Congratulations, glad it worked out. As for the mount command, rene explained already. The BIOS boot partition doesn't have a file system, so there's nothing to mount. Twas a simple matter of my recollection being incorrect.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

rene
Level 12
Level 12
Posts: 4338
Joined: Sun Mar 27, 2016 6:58 pm

Re: [SOLVED] Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by rene » Tue Sep 24, 2019 7:23 am

And as to the bit about the free partition at the end of the disk: no, don't worry, GPT arranges to backup itself at the end of the disk and doesn't allow you to partition the space it needs for itself anyway. Specifically it reserves the first and last 34 33 512-byte sectors of your disk; all that can be partitioned/used may be.

[EDIT] Off by one once more; disks clumsily number blocks from 1 rather than 0; 34 is the first useable sector, totalsectors-34 the last.

User avatar
theYogster
Level 1
Level 1
Posts: 45
Joined: Mon Sep 23, 2019 9:49 am
Location: Missouri USA
Contact:

Re: [SOLVED] Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by theYogster » Tue Sep 24, 2019 12:59 pm

Not sure if a new thread is required for this, but another problem popped up that is related to the original mission of creating a USB installed Linux Mint OS that is bootable using either legacy BIOS or UEFI.

the problem of booting from legacy BIOS seems to have been resolved by the above methods. After that fix I was able to populate the UEFI partition and switch to the computer with UEFI firmware - yes, secure boot is disabled. The option to boot from the esp partition on the memory stick was no longer available from the Windows boot manager. It was available prior to the above fix, but of course was not populated at that time and I could not boot therefrom. Now that MBR is set active apparently the UEFI boot on the USB memory stick is disabled.

Any suggestions for how to proceed would be greatly appreciated.

My Computer
  • Model: Msi GL72 7QF
  • Processor: Intel i7-7700HQ; 2.8GH
  • RAM: 16GB DDR4
  • GPU: nVidia GTX960M, Optimus enabled
  • SSD: 500GB, UEFI, Windows10 Insider Preview; Ubuntu 19.04; Kali Linux, Mageia 7

Code: Select all

root@GL72-7QF:~# parted /dev/sda print
Model: ATA CT500MX500SSD1 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name     Flags
 1      17.4kB  134MB  134MB                            msftres
 2      135MB   450MB  315MB   fat32                    boot, esp
 3      450MB   294GB  294GB   ntfs                     msftdata
 4      294GB   295GB  944MB   ntfs                     diag
 5      295GB   311GB  16.0GB  linux-swap(v1)
 6      311GB   361GB  50.0GB  ext4            UBU1904
 7      361GB   401GB  40.0GB  ext4
 8      401GB   470GB  68.4GB  ext4
 9      481GB   500GB  19.2GB  ntfs                     diag

root@GL72-7QF:~# parted /dev/sdb print
Model: SanDisk Ultra USB 3.0 (scsi)
Disk /dev/sdb: 61.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  3146kB  2097kB                        bios_grub
 3      3146kB  213MB   210MB   fat32                 boot, esp
 4      213MB   4504MB  4291MB  linux-swap(v1)
 5      4504MB  61.5GB  57.0GB  ext4
 2      61.5GB  61.5GB  1049kB

root@GL72-7QF:~# 
Same USB memory stick, different computer.

User avatar
pbear
Level 8
Level 8
Posts: 2465
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: Hybrid BIOS-UEFI Boot Fails on USB Drive

Post by pbear » Tue Sep 24, 2019 1:01 pm

rene wrote:
Mon Sep 23, 2019 12:09 pm
[If the protective MBR trick works], I suppose pbear may want to include it in the tutorial.
Done. Thanks for the tip.

ETA: Oops, maybe spoke too soon.

Give me some time, Yogster, to digest your latest post.
Time flies like an arrow. Fruit flies like a banana.
If your problem has been solved, please edit the thread title.

Post Reply

Return to “Installation & Boot”