Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Grub2 issues with dual booting Gentoo and WIN10
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
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Sun Oct 02, 2016 7:12 pm    Post subject: [SOLVED] Grub2 issues with dual booting Gentoo and WIN10 Reply with quote

Hello all, I've been meaning to do a complete system overhaul for a while now - so today I sat down and installed windows 10, then gentoo, with the intention of them both booting from the same GPT drive through UEFI.
Booting windows 10 through the windows boot manager was fine until I installed gentoo (until I installed grub2 to a boot partition on the drive I assume), which then caused grub to boot - despite both having their own boot entries in my bios.
I figured that grub rendered windows boot manager obsolete, and would allow me to choose between gentoo and win10 anyway, but when I updated my grub configuration file (using grub-mkconfig) I found that windows 10 wasn't mentioned in the output, this problem persisting even after I installed os-prober, which seemed like the solution.
Does anyone have any idea why win10 isn't being detected, or maybe some work-arounds I could use?
Thanks for reading.

Output of lsblk:
Code:
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 111.8G  0 disk
├─sda1   8:1    0   500M  0 part /boot
├─sda2   8:2    0     4G  0 part [SWAP]
├─sda3   8:3    0    20G  0 part /
├─sda4   8:4    0    40G  0 part
└─sda5   8:5    0    16M  0 part

sda1 is my fat32 efi boot partition, and is where grub is installed.
sda2 is just a swap space.
sda3 is my ext4 gentoo root partition.
sda4 was an NTFS partition created by myself in gparted at one point, and was used to install windows 10 on.
sda5 appears to be a "Microsoft reserved partition" from what blkid can gather, and was not created by myself - possible efi boot partition?

Updating grub2:
Code:
bladesy@linsheath ~ $ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.21-gentoo
Found linux image: /boot/vmlinuz-4.4.21-gentoo.old
done


If I'm missing any vital information just say, and I'll get on it.


Last edited by Bladesy on Tue Oct 04, 2016 7:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
lovelytux
Tux's lil' helper
Tux's lil' helper


Joined: 23 Aug 2013
Posts: 93
Location: Westwoods of Germany

PostPosted: Mon Oct 03, 2016 11:24 am    Post subject: Reply with quote

Hey,
what says ?
Code:
emerge --ask --newuse sys-boot/os-prober
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Mon Oct 03, 2016 5:54 pm    Post subject: Reply with quote

Nothing seems to happen - I was expecting the package to rebuild, but maybe since I didn't change my use flags - emerge saw no need to.
Code:
bladesy@linsheath ~ $ sudo emerge -a --newuse os-prober

These are the packages that would be merged, in order:

Calculating dependencies... done!
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Mon Oct 03, 2016 7:58 pm    Post subject: Reply with quote

did you run os-prober? what was output?
_________________
Defund the FCC.
Back to top
View user's profile Send private message
jonathan183
Guru
Guru


Joined: 13 Dec 2011
Posts: 309

PostPosted: Mon Oct 03, 2016 8:15 pm    Post subject: Reply with quote

I'd try installing efibootmgr, once installed you can use
Code:
efibootmgr -v

to show boot entry information
Code:
efibootmgr -n number_for_windows_boot

will allow you to try booting Windows next time you restart the machine
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Mon Oct 03, 2016 9:10 pm    Post subject: Reply with quote

What really confused me about os-prober was the fact that it gave no output no matter what I tried:
Code:
bladesy@linsheath ~ $ sudo os-prober
bladesy@linsheath ~ $ sudo os-prober -v
bladesy@linsheath ~ $ sudo os-prober --help
bladesy@linsheath ~ $ sudo os-prober --verbose

However, it did at least give an error message when I didn't run it as root:
Code:
bladesy@linsheath ~ $ os-prober
unshare failed: Operation not permitted
mkdir: cannot create directory ‘/var/lib/os-prober/mount’: Permission denied
mkdir: cannot create directory ‘/var/lib/os-prober/mount’: Permission denied
mkdir: cannot create directory ‘/var/lib/os-prober/mount’: Permission denied

As for efibootmgr, the verbose output gave the following, but I'm not sure what it means exactly:
Code:
bladesy@linsheath ~ $ sudo efibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0002,0003,0005,0001
Boot0000* gentoo   HD(1,GPT,3cc0010e-37ef-45e7-92e3-6abeddab871c,0x800,0xfa000)/File(\EFI\gentoo\grubx64.efi)
Boot0001  Hard Drive    BBS(HD,,0x0)..BO
Boot0002* Windows Boot Manager   HD(1,GPT,3cc0010e-37ef-45e7-92e3-6abeddab871c,0x800,0xfa000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0003* UEFI: Built-in EFI Shell    VenMedia(5023b95c-db26-429b-a648-bd47664c8012)..BO
Boot0005  Hard Drive    BBS(HD,,0x0)..BO

Should I just try passing 0002 to efibootmgr -n to see if I can get into my windows install?

EDIT: Passing 0002 appeared to set the next boot to windows, but in actuality grub just appeared again - similar to how choosing windows boot manager in the bios would again return me to grub.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1368
Location: Montréal

PostPosted: Tue Oct 04, 2016 4:11 am    Post subject: Reply with quote

Maybe this link can give you ideas about how to use Grub2 to boot Windows 10 EFI.
Is it possible to use Grub to run an EFI binary?

It seem's like os-prober only work for Bios mode. You need GRUB-EFI: os-prober-efi to autodetect Windows 10 EFI.
_________________
Paul
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Tue Oct 04, 2016 9:10 am    Post subject: Reply with quote

It turns out that grub wiped out the windows boot manager efi binary stored in /boot/EFI when it was installed.
Logicien's post pointed me towards checking the EFI directory, which I found to contain only gentoo/grubx64.efi.
After searching around for a bit, I found that restoring the boot manager files was as easy as booting the windows install disc (or in my case, usb), pressing shift + F10 to access a console, and entering "bcdboot c:\windows".
After that, 2 new directories (Boot and Microsoft) appeared in the EFI directory, and upon updating the grub config - my windows install was found.
My windows install was then available through grub, and booted fine.

However, new problems occurred.
After I exited windows and booted back into gentoo, I got a kernel panic:
Code:
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Thinking I could maybe fix it myself, I chrooted into my gentoo install and updated the grub config - however, this time the windows install was not found, and when I returned to grub to boot my gentoo install, I received a slightly different ouput. The same error remained, but this time I was told to "append a correct "root"= boot option".
How exactly would I go about doing the above? If I can get my main install running, then I can attempt to fix the windows install again.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1368
Location: Montréal

PostPosted: Tue Oct 04, 2016 11:43 am    Post subject: Reply with quote

When you are at the Grub2 menu screen, select the entry you want to use and press the e letter to edit the entry. Than you will see if there is a root= parameter et the line starting with linux. root= can be a UUID or a device file, the LABEL is not use I think.

If there is no root= what I think will not be, add root=/dev/sda1 for exemple, changing sda1 for the good root Gentoo partition / or /boot partition. Be sure to follow the path to the kernel (and initramfs) correctly.Than press Ctrl+x to boot the modified entry only once.

If you miss some kernel options in your Linux configuration, you can have a panic not based on missing root= but on mandatory support not available.
_________________
Paul
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Tue Oct 04, 2016 12:20 pm    Post subject: Reply with quote

"append a correct "root"= boot option" may be happy with /dev/sda3 or the try again option of just 'enter'
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Tue Oct 04, 2016 5:57 pm    Post subject: Reply with quote

I did what Logicien suggested and edited gentoo's grub entry at the "linux" line, replacing the corresponding "root=UUID=..." with "root=/dev/sda1".
It seemed to get rid of the first kernel panic, but now I have another one:
Code:
---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Tue Oct 04, 2016 6:03 pm    Post subject: Reply with quote

init should be on the root / partition which was /dev/sda3 in your first post
when I was learning to use UEFI and GPT the kernel needed to be told root=PARTUUID= instead of root=UUID= . As that has worked ever since I have not researched it further.
_________________
Defund the FCC.


Last edited by DONAHUE on Tue Oct 04, 2016 6:47 pm; edited 1 time in total
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Tue Oct 04, 2016 6:06 pm    Post subject: Reply with quote

Quick update, I tried what Donahue suggested straight after my last reply, and it worked perfectly.
I just replaced the UUID with /dev/sda3 - I don't know why I thought I should put my /boot partition as root, that was my mistake.
I also managed to update the grub config and it detected my windows install again.
The only problem I'm having right now is how to keep that fix permanent - I think maybe the UUID got changed or something during the bcdboot step, so the UUID points no where and gives the kernel panic.
Whereabouts are the boot entries stored?
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 7550
Location: Goose Creek SC

PostPosted: Tue Oct 04, 2016 6:51 pm    Post subject: Reply with quote

echoing myself, as my edit crossed in the mail: when I was learning to use UEFI and GPT the kernel needed to be told root=PARTUUID= instead of root=UUID= . As that has worked ever since I have not researched it further.
as far as blkid and the like are concerned, PARTUUID points to a partition; UUID points to the filesystem on the partition
_________________
Defund the FCC.
Back to top
View user's profile Send private message
Bladesy
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2015
Posts: 113

PostPosted: Tue Oct 04, 2016 7:19 pm    Post subject: Reply with quote

I think this is about solved - I found out that uncommenting GRUB_DISABLE_LINUX_UUID=true permanently edited in /dev/sda3, which saved me having to edit /boot/grub/grub.cfg every time I ran grub-mkconfig.
I think this is just about solved now, since I've booted in and out of gentoo and windows over and over again, just to be sure that it's all working fine.
If anyone wants to avoid going through this, I imagine installing gentoo first would avoid the chain of problems.
Thanks to everyone for replying, I had no idea where to start when I suddenly couldn't boot anymore.
Back to top
View user's profile Send private message
rafaelzigx
n00b
n00b


Joined: 09 Apr 2015
Posts: 11

PostPosted: Fri Nov 04, 2016 3:09 pm    Post subject: Reply with quote

Hello Guys,

I see the topic is solved already, but I just want to show how I managed to make this work perfectly:

First i run:

grub-probe --target=fs_uuid /boot/efi/efi/Microsoft/Boot/bootmgfw.efi

.. to get the UUID of windows 10;

then..

add this to /etc/grub.d/40_custom:

menuentry "Windows x86_64 UEFI-GPT" {
search --fs-uuid --no-floppy --set=root UUID
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}


grub-mkconfig -o /boot/grub/grub.cfg
grub-install --target=x86_64-efi --efi-directory=/boot

All good.

I hope I could add something to help.

Rafael
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