Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Grub2 os-prober cannot find grub drive
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
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Wed Oct 23, 2019 5:14 pm    Post subject: [Solved] Grub2 os-prober cannot find grub drive Reply with quote

I've been trying to install Gentoo on my desktop that already has Windows 10. The install went fine but running mkconfig keeps giving me the same error: grub-probe: ERROR: Cannot find a GRUB drive for /dev/sdc1. /dev/sdc1 is the usb I flashed the installation cd on so not sure why it's looking there. Running os-prober by itself returns the exact same error.

/dev/sda is a 2TB HDD, currently only used by Windows but gonna partition this once this finally works
/dev/sdb1 Windows Recovery Partition NTFS
/dev/sdb2 EPS: contains Boot, gentoo, Microsoft and grub
/dev/sdb3 Windows C:/ NTFS
/dev/sdb4 bios_grub partition
/dev/sdb5 swap partition
/dev/sdb6 gentoo root ext4

etc/fstab

Code:
/dev/sdb2     /boot/efi      vfat         defaults,noatime     0,2
/dev/sdb5     none           swap        sw                         0,0
/dev/sdb6     /                 ext4        noatime                  0,1

Legacy mode is turned off on the motherboard, secure boot is turned off, I've checked to make sure the EFI partition is formatted for GPT. I've looked through the handbook and the separate page specifically for grub2 installation multiple times as well as scouring every forum post on the internet that mentioned this error or anything related to grub not finding the images and I've come up with nothing. Any help would be amazing, thanks

[Moderator edit: added [code] tags to preserve output layout. -Hu]

edit: Thank you, Mr moderator. Looks way prettier


Last edited by Dyspy on Thu Nov 14, 2019 6:12 pm; edited 2 times in total
Back to top
View user's profile Send private message
Arvo
n00b
n00b


Joined: 30 Sep 2019
Posts: 9

PostPosted: Wed Oct 23, 2019 6:03 pm    Post subject: Reply with quote

That's really unfortunate. Hopefully we can resolve this issue! Have you run these commands in the host environment to provide the required files (example shows Gentoo mounted on /mnt/gentoo like in the Handbook):
Code:

root #mkdir -p /mnt/gentoo/run/udev
root #mount -o bind /run/udev /mnt/gentoo/run/udev
root #mount --make-rslave /mnt/gentoo/run/udev


Have you also mounted the Windows partitions already?


Last edited by Arvo on Wed Oct 23, 2019 6:10 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Wed Oct 23, 2019 6:09 pm    Post subject: Reply with quote

I had mounted and bound udev yes, didn't work
Back to top
View user's profile Send private message
Arvo
n00b
n00b


Joined: 30 Sep 2019
Posts: 9

PostPosted: Wed Oct 23, 2019 6:42 pm    Post subject: Reply with quote

Does the error persist if you remove the usb drive which contains the installation cd?
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7686
Location: Saint Amant, Acadiana

PostPosted: Wed Oct 23, 2019 7:55 pm    Post subject: Reply with quote

I have to say I do not multiboot, I do not have Windows and I do not use Grub. Meaning I'm not sure what exactly Windows does in your ESP partition and whether it can coexist with other bootloaders.
Anyhow, if Grub install fails you can always set it up by hand. Copy its EFI executable next to Windows bootloader, this is the place where your motherboard firmware is looking for it and it may automagically appear in your EFI boot menu. If it does not - use efibootmgr to add it by hand. Then write a simple grub.cfg which loads your kernel and that's it.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Thu Oct 24, 2019 8:39 am    Post subject: Reply with quote

Jaglover wrote:
I have to say I do not multiboot, I do not have Windows and I do not use Grub. Meaning I'm not sure what exactly Windows does in your ESP partition and whether it can coexist with other bootloaders.
Anyhow, if Grub install fails you can always set it up by hand. Copy its EFI executable next to Windows bootloader, this is the place where your motherboard firmware is looking for it and it may automagically appear in your EFI boot menu. If it does not - use efibootmgr to add it by hand. Then write a simple grub.cfg which loads your kernel and that's it.


So I am very certain it's not a problem as I have seen a lot of people on the internet with EFI multiboot setups and it doesn't appear to be a problem. Copying the EFI executable is unnecessary as grub does actually install and run fine and is already accessible from the EFI boot menu, it just can't find either Linux or Windows. As for using efibootmgr, I already set it up using efibootmgr and it works, however this is pretty cumbersome to use and I wasn't really looking for a workaround, I was looking on how to fix grub2, specifically the os-prober script. I appreciate the help anyways, though, thank you and I may end up writing a custom grub.cfg file with the menu entry.

Edit: Just to make clear, I was not trying to install grub2 and setup efibootmgr at the same time, I am aware that can cause conflicts. I uninstalled grub2 and got the efibootmgr setup running, however, I would like to get just grub working.


Last edited by Dyspy on Thu Oct 24, 2019 9:02 am; edited 1 time in total
Back to top
View user's profile Send private message
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Thu Oct 24, 2019 8:42 am    Post subject: Reply with quote

Arvo wrote:
Does the error persist if you remove the usb drive which contains the installation cd?


It does, unfortunately :(
Back to top
View user's profile Send private message
Marlo
Veteran
Veteran


Joined: 26 Jul 2003
Posts: 1464

PostPosted: Thu Oct 24, 2019 6:39 pm    Post subject: Reply with quote

Dyspy!

Never use the command in your configuration
Code:
grub-setup '<DEVICE>'

It will overwrite the MBR and can destroy your system!

Stop! --> Read carefully and check them before you doing anything.

Also read this: https://www.gnu.org/software/grub/manual/grub/grub.html#Installing-GRUB-using-grub_002dinstall

Scroll down to: "On EFI systems for fixed disk install you have to mount EFI System Partition....." and read word by word: twice!
-----------


After the chroot the mtab has to be renewed.

        
Code:
cp /proc/mounts  /etc/mtab



In your configuration, boot is a directory of root, without a separate partition. -> /boot.
In the directory of /boot a subdirectory "/boot/efi" has to be created.

Code:
mkdir /boot/efi


Connect /dev/sdb2 to /boot/efi

Code:
mount -a
or
mount /dev/sdb2 /boot/efi



Grub wants to install with the command:
Code:

grub-install --efi-directory=/boot/efi


and then:
Code:
grub-mkconfig -o /boot/grub/grub.cfg


If you are unsure. Do not do anything.

greetings
Ma
_________________
Thank you for your attention, interest and support.
------------------------------------------------------------------
http://radio.garden/
Back to top
View user's profile Send private message
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Fri Nov 08, 2019 1:23 pm    Post subject: Reply with quote

Marlo wrote:
Dyspy!

Never use the command in your configuration
Code:
grub-setup '<DEVICE>'

It will overwrite the MBR and can destroy your system!



I never actually said I ran grub-setup, only grub-install and grub-mkconfig. I'm not sure why you're worried about this. Also, as I mentioned, the device is formatted with GPT Partitioning Scheme. The only MBR I could think of that would be present on the device would be the protective MBR on the GUID partitioning table though it's pretty protected and is also redundant and exists for backwards compatibility.

Marlo wrote:


After the chroot the mtab has to be renewed.

        
Code:
cp /proc/mounts  /etc/mtab



In your configuration, boot is a directory of root, without a separate partition. -> /boot.
In the directory of /boot a subdirectory "/boot/efi" has to be created.

Code:
mkdir /boot/efi


Connect /dev/sdb2 to /boot/efi

Code:
mount -a
or
mount /dev/sdb2 /boot/efi



Grub wants to install with the command:
Code:

grub-install --efi-directory=/boot/efi


and then:
Code:
grub-mkconfig -o /boot/grub/grub.cfg


If you are unsure. Do not do anything.

greetings
Ma


I checked that /etc/mtab hadn't been modified just in case and it hadn't.
Otherwise, everything else was exactly what I did for the initial install. I repeated the process again and, while running grub-mkconfig, I get the same device.map error.

Unfortunately, the error still exists
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7686
Location: Saint Amant, Acadiana

PostPosted: Fri Nov 08, 2019 6:18 pm    Post subject: Reply with quote

Quote:
Edit: Just to make clear, I was not trying to install grub2 and setup efibootmgr at the same time, I am aware that can cause conflicts. I uninstalled grub2 and got the efibootmgr setup running, however, I would like to get just grub working.

I see some confusion here, efibootmgr is a tool to set up EFI Boot Manager in motherboard firmware. In case you want to use Grub2 in EFI mode efibootmgr must be available as dependency, Grub2 install scripts use it to configure EFI Boot Manager (the boot manager built into firmware). OTOH, you can use efibootmgr from a removable media to set up your EFI boot, and once you are done there is no need for it any more.

I personally love simplicity, thus I boot my Gentoo directly from firmware without using any middlemen. I used efibootmgr to add another entry into firmware EFI Boot Manager for my backup kernel and that's it. Now my box boots straight into Gentoo, unless I hit F11 during boot to access EFI Boot Manager menu, then I have choices to boot new or old kernel.
You could boot your Windows and Gentoo the same way, without using any additional bootloders.
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Fri Nov 08, 2019 7:33 pm    Post subject: Reply with quote

Dyspy wrote:
Copying the EFI executable is unnecessary as grub does actually install and run fine and is already accessible from the EFI boot menu, it just can't find either Linux or Windows.
Does this mean that you can boot and run the installed gentoo system (no chroot or install media {usb} involved)?
If so, suggest you boot the installed gentoo system, run
Code:
emerge wgetpaste os-prober efivar
, mount or remount the EFI Systems Partition (ESP) read/write. Then use wgetpaste to collect and publish results of grub reruns, filesystem structure, disk structure as in:
Code:
fdisk -l | wgetpaste
mount | wgetpaste
os-prober | wgetpaste
grep -i CONFIG_EFI_VARS /usr/src/linux/.config
grub-install --efi-directory=/boot/efi --target=x86_64-efi
grub-mkconfig -o /boot/grub
tree /boot | wgetpaste
cat /boot/grub/grub.cfg | wgetpaste
I've been dual/multibooting since 2012. Running the commands above my terminal shows:
Code:
> fdisk -l | wgetpaste
< Your paste can be seen here: http://dpaste.com/3DRX2GX
> mount | wgetpaste
< Your paste can be seen here: http://dpaste.com/0V4CYX6
> os-prober | wgetpaste
<  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
< Your paste can be seen here: http://dpaste.com/3NDH97J
> grep -i CONFIG_EFI_VARS /usr/src/linux/.config
< CONFIG_EFI_VARS=m
> grub-install --efi-directory=/boot/efi --target=x86_64-efi
< Installing for x86_64-efi platform.
< Installation finished. No error reported.
> grub-mkconfig -o /boot/grub
< Generating grub configuration file ...
< Found linux image: /boot/vmlinuz-5.4.0-rc6
< Found linux image: /boot/vmlinuz-5.4.0-rc4
< Found linux image: /boot/vmlinuz-5.3.8-gentoo
< Found linux image: /boot/vmlinuz-5.3.7-gentoo
<  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
< Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
< done
> tree /boot | wgetpaste
< Pasting > 25 kB often tend to fail with dpaste. Use --verbose or --debug to see the
< error output from wget if it fails. Alternatively use another pastebin service.
< Your paste can be seen here: http://dpaste.com/0F450KJ
> cat /boot/grub/grub.cfg | wgetpaste
< Your paste can be seen here: http://dpaste.com/0DCPQET
If problem does not clear suggest you copy and post your terminal equivalent.
_________________
Defund the FCC.


Last edited by DONAHUE on Thu Nov 14, 2019 7:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dyspy
n00b
n00b


Joined: 23 Oct 2019
Posts: 7

PostPosted: Thu Nov 14, 2019 6:11 pm    Post subject: Reply with quote

I deleted all the kernel images and system maps on the uefi partition and reinstalled them. I'd done this a few times before while trying to fix it and, for some reason, this one worked. Strangely enough, os-prober found windows as well this time despite not finding it before. Loads into Gentoo fine now. I'll mark as solved
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


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

PostPosted: Thu Nov 14, 2019 7:39 pm    Post subject: Reply with quote

Best guesses: adding --target=x86_64-efi or mounting the ESP read write or sequence of commands was the magic. Grub sometimes says an error occurred so politely that it seems to report success.
_________________
Defund the FCC.
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