Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't get Thinkpad to boot to grub2
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
seansmr
n00b
n00b


Joined: 04 Dec 2011
Posts: 52
Location: Bangkok

PostPosted: Mon Jan 21, 2019 5:25 am    Post subject: Can't get Thinkpad to boot to grub2 Reply with quote

I am trying to install Gentoo on a Thinkpad T420. It seems to have UEFI, however the only option in the setup is:
Boot mode: Both, UEFI, Legacy

What I have done is follow the AMD64 install guide exactly, to the point of boot following Grub setup.

I have set the fdisk -t msdos to make the MBR partition bootable, to no effect.

UEFI boot immediately return to boot menu. Legacy boot takes a few seconds and returns to the boot menu.
Booting to Gentoo on disk from the systemrescuecd fails in this case.

Other than that, I don't know what to report and I have no idea of what to try next.
Any help would be much appreciated.
Back to top
View user's profile Send private message
niku
n00b
n00b


Joined: 23 Dec 2018
Posts: 38

PostPosted: Mon Jan 21, 2019 11:38 am    Post subject: Reply with quote

Hi

In the BIOS options, 'Legacy' is what you are used to. UEFI is the new way to boot. You don't need 'Both'.

MBR is used only for the legacy (or 'both') booting method.

I suggest you stick to one and get it working. So, let's stick with UEFI. (Select UEFI boot in the BIOS.)

Quote:
UEFI boot immediately return to boot menu.

What does the boot menu say? Is it one generated by Grub? Does it list Gentoo?

If you can boot into Gentoo using the systemrescuecd, check if /sys/firmware/efi exists. Next, check if a grub binary file exists in /boot/EFI/gentoo/ (mine is named grubx64.efi). Then, check the output of `efibootmgr -v'.

For the last command, in the output for me, there is the following line:
Code:
Boot000E* gentoo        HD(1,GPT,9a96007d-0dc2-4339-acaf-2226db9368ff,0x800,0xf3800)/File(\EFI\gentoo\grubx64.efi)


If it is missing for you, you'd have to add it by hand. For that, first remount the efivarfs rw, via `mount -o remount,rw efivarfs', Then, add your gentoo-grub entry with efibootmgr. (check link)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Mon Jan 21, 2019 2:30 pm    Post subject: Reply with quote

seansmr,

There is broken firmware around that won't let you mix legacy and GPT.

If you want to test, change the msdos protective partition type from ee to 83.
It still won't boot but you should get messages from grub.
If that happens, you have one of these broken firmwares that won't let you mix legacy and GPT.

There are two ways forward.

Change to UEFI booting. That's the way of the future. Go with it. Put the ee back in the msdos protective partition type.
Write a real MSDOS partition table under your existing install. Its a bit of a hack, its only possible if you have at most four partitions and is in general a bad thing.

Neither option requires a reinstall.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
seansmr
n00b
n00b


Joined: 04 Dec 2011
Posts: 52
Location: Bangkok

PostPosted: Tue Jan 22, 2019 6:41 pm    Post subject: Reply with quote

First, I want to apologize for being only half there, my comprehension of what I read, do and see was compromised due unrelated problems. I have seen hints of how UEFI works, but I didn't understand quick enough. So I may have been asking questions that I need not have if I had had my full attention.

The fog has lifted, this is what I think now:
You may want to skip my explanation and my replies to your comments, it's all moot now, and just see my new question at the very end.

Thanks to niku's comment, I now have finally understood what I have been missing, you have to write to NVRAM on the otherboard. If I don't see /sys/firmware/efi, it can't be done. Following the install handbook works if you have, by chance, booted the boot media in UEFI mode. If you have booted in legacy mode, the efivars remount step fails and grub setup doesn't write in the NVRAM. (I am guessing now, since I am away from home)
I have had a quick relook at the various UEFI guides in the wiki. None of them state the concept that writing to the motherboard is now a part of setup. (Now I am guessing again) Because of this, you must be sure that your boot medium is booted in UEFI mode. I noted that the systemrescuecd booted in 2 modes, but had no idea why to choose one or another.

niku:
On the Thinkpad, the systemrecuecd on usb cannot be booted in UEFI mode, so I won't be getting any UEFI install working.
How do you get your first UEFI boot, if you can't boot to UEFI to write to NVRAM?

The GPT drive is the second drive, the main one is MBR. I was just using it for testing, it will not stay in the notebook, moot now.
Apparently the T420 does UEFI non standard. It may want the boot file here: /boot/bootx64.efi
I have tried that and it doesn't work. I will wast no more time on it. I will instead try to install Gentoo on the MBR disk.
https://superuser.com/questions/737565/how-can-i-get-my-thinkpad-t420-to-boot-directly-to-grub-skipping-the-boot-menu
I never got to grub, the UEFI boot was the bios setting. The Thinkpad will not boot to either UEFI capable drive. I will stop this now.

NeddySeagoon:
Maybe bad firmware. My main purpose here was to get UEFI booting on that drive so it would work on my desktop. re: the other post you helped me in: now, I think that I will go home and have it working in 5 minutes. Since I was booting the systemrescuecd in non UEFi mode to run the memchk, I did grub install that way too, so it didn't work with efivars remount step.

On my Thinkpad, since Windows in on MBR, I will not pursue UEFI booting at this time. However,
I don't understand this: "Write a real MSDOS partition table under your existing install." (but it seems interesting)

My new question:
Since I have been using Gentoo so much, I now find Windows unbearable. I have empty partitions on my main, MBR, drive waiting for Gentoo to be installed. I would just like to ask if you could confirm that my plan will work.

I have Windows 7 with its 100MB bootable partition, Windows, then a 3rd primary partition that I intend to boot with grub. The Gentoo system will be in an extended partition.
Can I set the boot flag to the third partition and do grub-install /dev/sda3? This way I can set the boot flag back to partition 1 and Windows should be unaffected, if need be. I know that I could do this with Grub.97
Does this sound like a workable plan?

I don'r come here expecting people to help, I greatly appreciate everyone who takes some of their time to reply and help me out. Thanks so much.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Tue Jan 22, 2019 6:57 pm    Post subject: Reply with quote

seansmr,

Essentially, don't try to mix Legacy BIOS and GPT.
Legacy BIOS and MBR works.
UEFI and GPT works.
UEFI and MBR fails by design.

Legacy BIOS and GPT has extra steps and puts you up against broken firmware.

If you succeed in a Legacy BIOS and GPT install then find you firmware is broken, you have two choices.
Convert to UEFI and GPT.
Convert to Legacy BIOS and MBR

You can only boot in UEFI mode if your BIOS is set to allow it.
With your BIOS in UEFI mode, you can boot System Rescue CD in UEFI mode and write your efivars.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
niku
n00b
n00b


Joined: 23 Dec 2018
Posts: 38

PostPosted: Wed Jan 23, 2019 5:54 am    Post subject: Reply with quote

If I got it right, you wish to boot with an MBR in one of the disks, and UEFI (if necessary) on another.

On the MBR disk, if you are installing grub, the grub configuration would take care of everything. If the os-prober finds all your OSs, you'd good to go. You'd set the default boot, etc in the grub configuration files.

Quote:
Can I set the boot flag to the third partition and do grub-install /dev/sda3?

You probably wish to install grub on /dev/sda, not /dev/sda3. You want grub to overwrite the mbr and take over. If you install it on a partition, the original mbr stays, and then you'd have to find a way to get to grub.

A nice, comprehensive installation guide is [url=https://wiki.archlinux.org/index.php/GRUB#Master_Boot_Record_(MBR)_specific_instructions]here[/url]. It too specifically says that it must be installed on /dev/sda and not /dev/sdaN.

You'd probably need to explicitly specify that you wish to install an MBR with the --target switch.
Code:
grub-install --target=i386-pc /dev/sda
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum