Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dynabook Gentoo-Windows10 DualBoot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
AndrewAmmerlaan
Developer
Developer


Joined: 25 Jun 2014
Posts: 266
Location: Nijmegen

PostPosted: Thu Dec 03, 2020 9:37 am    Post subject: Dynabook Gentoo-Windows10 DualBoot Reply with quote

I just ""fixed"" the most strange problem that I have been struggling with for two days. And I'd like to share my workaround here.

The Problem

So for some reason my laptop (A Dynabook Satellite pro l50-g-188 (Toshiba)) refuses to boot anything but the windows bootloader if that is available. After installing grub, efibootmgr shows the grub entry and the order is correct. However, upon a reboot it will load the windows bootloader anyway. If I then reboot into a systemrescue cd and look at the output of efboomgr I find that the order has been reset and the windows bootloader is the default entry again. If I remove the windows bootloader entry from efibootmgr it will still boot windows anyway, and I find that the windows bootloader entry has been re-added. If I do the same using EasyUEFI on windows, windows fails to boot and needs to be repaired, but still it does not load grub instead insisting on trying to boot the windows entry that I just deleted (and surprise, surprise has been re-added). This laptop's UEFI-settings menu (accessed by pressing F2) lacks the ability to order UEFI entries, instead it only allows specifying the order of the available disks that it should try to boot (e.g. SSD, HDD, USB, Network), entries like "Windows" or "Gentoo" are not shown there at all (nor in the F12 menu).

Thus this laptop seems to have something in the UEFI firmware that makes it boot \EFI\Microsoft\Boot\bootmgfw.efi if available no matter what settings set by efibootmgr of EasyUEFI.

The Solution

After a lot of trial and error, I found one solution that works:

First we move the windows boot loader:

Code:

mv /boot/EFI/Microsoft/Boot/bootmgfw.efi /boot/EFI/Microsoft/Boot/bootmgfw-win.efi


Then we copy grub to where the system expects the windows bootloader to be

Code:

cp /boot/EFI/gentoo/grubx64.efi /boot/EFI/Microsoft/Boot/bootmgfw.efi


Now we need to add the entry for the windows boot loader to grub, therefore we add this to ls /etc/grub.d/40_custom

Code:

menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os $menuentry_id_option 'osprober-efi-CCBD-2C47' {
   insmod part_gpt
   insmod fat
   if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root  CCBD-2C47
   else
    search --no-floppy --fs-uuid --set=root CCBD-2C47
   fi
   chainloader /EFI/Microsoft/Boot/bootmgfw-win.efi
}


Where you should replace /dev/nvme0n1p1 with your EFI System Partition, and CCBD-2C47 with the UUID of that partition. If you previously had sys-boot/os-prober installed you can copy this entry from /boot/grub/grub.cfg. Note that you should remove sys-boot/os-prober now, otherwise it will detect grub as the Windows Boot Loader and add a entry for it which will be confusing because there would be two entries named "Windows Boot Manager"

Update grub (grub-mkconfig -o /boot/grub/grub.cfg) and reboot, and if everything works you can clean up the EFI partition to save some space (rm -r /boot/EFI/gentoo).

Hope this will be useful to someone somewhere with a similar problem.
_________________
OS: Gentoo 6.7.3-gentoo-dist, ~amd64, 17.1/desktop/plasma/systemd/merged-usr
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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