You are not logged in.

#1 2020-07-06 22:41:43

Teorax
Member
Registered: 2016-11-15
Posts: 17

[SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

Hi,

I tried to set up a new system on an new device, but struggle getting GRUB2 to boot from an GPT partition in BIOS mode/legacy mode. I know it is an reoccurring topic and I know there was just a thread about 2 weeks ago but after consulting all those I am still stuck. sad The system always returns to the default UEFI boot menu presented when no boot device seems present (which I seem unable to deactivate by the way but I guess that is another topic). I follow the wiki with creating a BIOS_GRUB partition  of 2 MiB at the start of the storage device and think I set all the necessary flags. Here is my output

lsblk /dev/nvme0n1 (the only storage aside from the live usb)

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0 953.9G  0 disk 
├─nvme0n1p1 259:1    0     2M  0 part 
├─nvme0n1p2 259:2    0  1023M  0 part 
└─nvme0n1p3 259:3    0   900G  0 part 

gdisk -l

GPT fdisk (gdisk) version 1.0.5

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

Found valid GPT with protective MBR; using GPT.
Disk /dev/nvme0n1: 2000409264 sectors, 953.9 GiB
Model: INTEL SSDPEKNW010T8                     
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 2CA895C9-7DF5-XXXX-XXXX-5156A6E371DC
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 2048, last usable sector is 2000409230
Partitions will be aligned on 2048-sector boundaries
Total free space is 110871183 sectors (52.9 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            6143   2.0 MiB     EF02  
   2            6144         2101247   1023.0 MiB  8300  
   3         2101248      1889538047   900.0 GiB   8300  

To complicate things /dev/nvme0n1p2 is a separated /boot as /dev/nvme0n1p3 is a LVM on LUKS which more or less follows the wiki (GRUB config modified, cryptdevice and root stated via UUID),

I would be very grateful for any advice on where to look for mistakes. Thank you for your time.
cheers
Teo

PS: I know there is the option to just fall back to MBR but I would really enjoy getting this to run/understand where I failed.

Last edited by Teorax (2020-07-07 12:57:55)

Offline

#2 2020-07-06 22:47:28

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

Are you sure that your system actually supports booting from BIOS/GPT? Not all of them do.

Any reason you're not just going with a UEFI installation?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2020-07-06 22:52:44

Teorax
Member
Registered: 2016-11-15
Posts: 17

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

Thanks for the superfast reply.
No, actually I am not but how do I check? It's a Thinkpad T480s so...

I want to use/test/play around with the Anti-Evil Maid script from Qubes OS which is availabel in AUR or at least dual boot Qubes OS which recommends using legacy boot to set up a multi boot system. I think a regular MBR would work too but I would really like to get this running.

Offline

#4 2020-07-07 08:40:55

frostschutz
Member
Registered: 2013-11-15
Posts: 1,652

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

sometimes you have to set bootable flag on legacy mbr ( parted /dev/nvme0n1 disk_set pmbr_boot on )

the bios actually has to boot it in legacy mode too, if its set to uefi, it won't work... sometimes there is a quick boot menu where you can select either mode

Offline

#5 2020-07-07 09:19:41

Teorax
Member
Registered: 2016-11-15
Posts: 17

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

BIOS is set to legacy_mode only (csm support yes) and I already tried the pmbr_boot flag I think. I just double checked and set it again, also tried moving the legacy_boot flag to nvme0n1p1 too (so it becomes bios_grub, legacy_boot). Still no result. hmm Thanks for your help.

Offline

#6 2020-07-07 09:41:37

frostschutz
Member
Registered: 2013-11-15
Posts: 1,652

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

Another thing you can do is pass it through to Qemu/KVM or other virtual machine (as read only, no network - or it will corrupt data) just to see if it boots there. If it doesn't boot in KVM either, then there's something wrong with your setup in general. If it does boot fine inside VM, then just your mainboard does not like it for some reason.

Offline

#7 2020-07-07 09:51:36

Teorax
Member
Registered: 2016-11-15
Posts: 17

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

That sounds like I should try. As I only run the system from a live usb, can you give me some starting point on how feed the nvme to qemu? thanks for the help

Offline

#8 2020-07-07 10:39:45

frostschutz
Member
Registered: 2013-11-15
Posts: 1,652

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

it depends, maybe something like this (from graphical live environment)

sudo qemu-system-x86_64 -enable-kvm -display gtk -m 1G -nic none -drive readonly,file=/dev/yourdisk,if=virtio

note this is only to test if grub will come up, the kernel itself might well fail booting since different modules are required inside VM environment

Last edited by frostschutz (2020-07-07 10:41:22)

Offline

#9 2020-07-07 10:43:42

Teorax
Member
Registered: 2016-11-15
Posts: 17

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

frostschutz wrote:

Another thing you can do is pass it through to Qemu/KVM [..]

I started a live system, mounted nvme0n1p3 as /mnt and nvme0n1p2 as read-only /mnt/boot. Then I set up a basic xorg and tried to load my system through qemu with

qemu-system-x86_64 -kernel /boot/vmlinuz-linux -initrd /boot/initramfs-linux.img

And the result is

Booting from ROM...
Probing EDD (edd=off to disable)... ok
[    1.663389] Initramfs unpacking failed: write error
:: running early hook [udev]
:: running early hook [lvm2]
:: running hook [udev]
:: Triggering uevents---
:: running early hook [keymap]
:: Loading keymap...done.
:: running early hook [encrypt]
ERROR: device ´´ not found. Skipping fsck
:: mounting '' on real root
You are now being dropped to emergency shell.
[...] 

As this includes the order of hooks I gave with mkinitcpio script, does this tell me something positive? I am not sure how to hand the root partition to qemu as this is where I am running qemu. neutral

EDIT: Sorry, seems we were adding the same time. But I think the result of your suggestion should be similar right?

EDIT2: Ok I see I just loaded the images directly. But your version worked and brought up GRUB. I could select Arch and I loaded till it could not find /dev/mapper/crypto-root

So my Thinkpad seems to not support BIOS/GPT? Or are just some setting is  wrong?

Last edited by Teorax (2020-07-07 11:55:11)

Offline

#10 2020-07-07 12:12:38

frostschutz
Member
Registered: 2013-11-15
Posts: 1,652

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

if you use qemu -kernel -initrd, you're pretty much circumventing the on disk bootloader

for the test to be meaningful, you really have to pass through the whole disk itself (it should not be mounted at all)

But your version worked and brought up GRUB.

if that works, there should be nothing wrong with your partitioning or bootloader install

So my Thinkpad seems to not support BIOS/GPT?

it might have special requirements or a wrong settings. I don't have one to test it myself so, this is a question for owners of your same hardware.

Offline

#11 2020-07-07 12:52:46

Teorax
Member
Registered: 2016-11-15
Posts: 17

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

frostschutz wrote:

if you use qemu -kernel -initrd, you're pretty much circumventing the on disk bootloader

Yes I understand this too now, I never used qemu before and just went with what look resonable from the wiki. There is no data on the system yet so there is not much to break.

it might have special requirements or a wrong settings.

well there are just so many UEFI options I could change... Can you make an educated guess in which direction to look for it? I tried to search for this but it seems a pretty specific problem or I miss the terms do describe it properly. Actually I am not even sure I understand what could possibly interfere with this boot process.

Thank you for you help.

EDIT: So best I found was this. Other people I found facing similar issues also referred to it so I guess that is to be seen as the final answer:

https://forums.lenovo.com/t5/ThinkPad-X … -p/4459527

Thanks for everything I mark this as [SOLVED] then and try and switch to a legacy MBR. What a bummer sad

Last edited by Teorax (2020-07-07 12:57:35)

Offline

#12 2020-07-07 13:38:29

frostschutz
Member
Registered: 2013-11-15
Posts: 1,652

Re: [SOLVED]GRUB2 BIOS/GPT not loading, returns to UEFI boot menu

Yeah that's why I mentioned the pmbr_boot flag (setting boot flag in gpt's legacy msdos table), which the linked post didn't use... that's usually it, some bioses check for boot flag... unfortunate if it refuses to boot completely anyway.

You can also experiment with generating more bogus partitions in the legacy MBR (what gdisk calls hybrid mbr) and see if that changes anything.

from gdisk manpage

       h      Create a hybrid MBR. This is an ugly workaround that enables
              GPT-unaware OSes, or those that can't boot from a GPT disk, to
              access up to three of the partitions on the disk by creating MBR
              entries for them. Note that these hybrid MBR entries can easily
              go out of sync with the GPT entries, particularly when
              hybrid-unaware GPT utilities are used to edit the disk.

otherwise I'm completely out of ideas, sorry

Offline

Board footer

Powered by FluxBB