Solved fighting with grub2 ...

ramon navaros

New Member

Reaction score: 2
Messages: 19

Hello,

I'm trying to install FreeBSD but I cannot boot it !!
My laptop is UEFI based on GPT partition. I'm using currently a Linux which use grub2 and EFI to boot.

I already install last version of FreeBSD 11, but it's impossible to boot into it.
- I have configured my BIOS to allow both legacy and UEFI boot.
- my grub2 is not shipped with kfreebsd command, so I have to use chainloader
- when I try to boot using chainloader, I always have an error message saying something like invalid path for UEFI
But, why is grub trying to use UEFI while I'm also allowing legacy boot? And I never asked for UEFI boot on my config file for FreeBSD

Here is my 40_custom config file
Code:
menuentry "FreeBSD 11" {
    insmod part_gpt
    set root='(hd1,gpt2)'
    chainloader (hd1,gpt2)+1
}

Do you have any idea on what to do?
Any help will be very appreciated.
Thanks
 
A

ASX

Guest


I have used chainloading from grub2 to FreeBSD, but in my case the FreeBSD used the whole disk, so I used something like:

Code:
menuentry "FreeBSD hd1 Chainloading" {
    set root=(hd1)
    chainloader +1
}


This is actually working for me, but please note that hd1 is the second disk, if your laptop has only one disk that should be hd0, not hd1

Alternatively, you could install an updated grub2 on a USB flashdrive, and use that to test without risk to damage either of the current installations.
 
OP
ramon navaros

ramon navaros

New Member

Reaction score: 2
Messages: 19

Thank you.
Even with your configuration, I have the same problem (error message saying something like invalid path for UEFI)

Code:
menuentry "FreeBSD Chainloading" {
   set root=(hd0)
    chainloader +1
}


For now I can boot into my FreeBSD using the installation usb-memstick of FreeBSD, even if it's annoying and inconvenient to do so.

But yes, it's a good idea to play with grub in an usb memstick. I will try with that.

thanks
 

T-Daemon

Daemon

Reaction score: 545
Messages: 1,171

(error message saying something like invalid path for UEFI)
chainloader can’t find a path to the UEFI file in the FreeBSD partition, you need to set it.

After the graphical GRUB menu appears select the "FreeBSD 11" entry, press "e" to edit the
commands, alter the menu entry as shown below, and boot.
Code:
menuentry "FreeBSD 11" {
    set root=(hd0,gpt2)
    chainloader /boot/boot1.efi
}
(/boot/boot1.efi is the first stage uefi() bootstrap)

If all goes well make the menu entry permanent in the config file.
 
OP
ramon navaros

ramon navaros

New Member

Reaction score: 2
Messages: 19

Thank you T-Daemon, this will be very helpful
Unfortunately it's still not working, but this time the problem is only a fedora linux issue because it seems that i cannot load module ufs2, so I grub2 say unknow file system and cannot load boot1.efi

I cannot understand why fedora guys are acting as microsoft and dont think about other less used OS.

So, I don't have other choice than building my own version of grub with all needed modules.
 

scottro

Daemon

Reaction score: 597
Messages: 1,611

I found, the one time I tested this, in a VirtualBox, that if I hit escape a number of times while the machine was booting, I'd get to a UEFI (an UEFI?) menu that offered FreeBSD as a choice.

That being said, everything I have with FreeBSD multibooting on it uses legacy rather than UEFI.
 
OP
ramon navaros

ramon navaros

New Member

Reaction score: 2
Messages: 19

I found, the one time I tested this, in a VirtualBox, that if I hit escape a number of times while the machine was booting, I'd get to a UEFI (an UEFI?) me? nu that offered FreeBSD as a choice.

That being said, everything I have with FreeBSD multibooting on it uses legacy rather than UEFI.

When do you press escape ? After selecting and bootingo your linux ? isn't it too late ?
I tried everywhere escaping without success.

Have you tried
Code:
insmod ufs2

Yes, I tried, and it doesnt work. grub2 cannot find ufs2. So thats why I think I will have to build my own version of grub2 :(
 

scottro

Daemon

Reaction score: 597
Messages: 1,611

I am sorry, I explained it very poorly. I was testing UEFI, so I created a Fedora Virtual Machine, but didn't use the whole hard drive. After that, I installed FreeBSD-11 to the remaining free space on the drive.

Then if I open VirtualBox, select the Fedora install, and click the start button, I was able to hit escape while the VM was booting up. I haven't tried it on bare metal.
 
OP
ramon navaros

ramon navaros

New Member

Reaction score: 2
Messages: 19

Problem solved.

So I was already using koji package mentioned by T-Daemon, but when looking into this package, I saw that there is also a package called something like grub2-efi-modules (I dont remember the name), which was already installed in my laptop.
All needed modules where located into a directory which I dont remember the name. (something like /usr/lib/grub/x86_64-efi/*.mod, but for some reason they are not in /boot directory.

So the fix was to manually copy theses *.mod into /boot/efi/EFI/fedora/x86_64-efi/ and ... it's working !!

Here is my config:

Code:
menuentry "FreeBSD 11" {
   insmod ufs2
   insmod bsd
   set root=(hd0,gpt2)
   chainloader /boot/boot1.efi
}


Note: insmod bsd is maybe not needed.

Thanks to you T-Daemon
 

Nameyho

New Member

Reaction score: 1
Messages: 1

Juste posting to thanks ramon navaros. i was blocked with my grub wich didn't load my freeBSD. i did what he explained and it's worked.

i just signed up to say this and thanks him.

ps: sorry for my bad english i'm not a native speaker
 
Top