LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   I can't get grub2 to boot FreeBSD (https://www.linuxquestions.org/questions/%2Absd-17/i-cant-get-grub2-to-boot-freebsd-827059/)

j1alu 08-18-2010 01:44 PM

I can't get grub2 to boot FreeBSD
 
I installed FreeBSD on the third partition of the second internal hard-disk (in linux-speak /dev/sdb3 from fdisk -l, i seem to remember it was ad6 during FreeBSD installation).
My entry for grub2 looks like this:
Code:

menuentry "FreeBSD" {
insmod ufs2
set root=(hd1,3)
chainloader +1
}

But when i choose FreeBSD from grubs menu it just hangs, no error message.
Version is FreeBSD-8.1.
I tried different changes to the set-root-line, i also tried "freebsd /boot/loader", but then get different kind of errors.
I am able to mount /dev/sdb3 from Debian and have a look at it.

Thanks

In case it helps: The installation CD says its ad6s3

rocket357 08-18-2010 04:08 PM

Quote:

Originally Posted by j1alu (Post 4070491)
Code:

menuentry "FreeBSD" {
insmod ufs2
set root=(hd1,3)
chainloader +1
}


You need to specify the slice as well. root=(hd1,3,a)

j1alu 08-18-2010 10:53 PM

I tried that as well:
i used
set root=(1,3,a) and set root=(0,3,b)
and what not.

Everything else i try gives me an error message. Mostly that the partition would not exist.
On my other PC it works with the syntax i posted above (without the slice letter). Also grub2, also Debian/FreeBSD.

pr_deltoid 08-19-2010 01:36 AM

I'm using Kubuntu/FreeBSD and have root set as (hd0,3) and chainloader + 1 and nothing else and it works fine. It looks like this:
Code:

menuentry "FreeBSD" {
    set root=(hd0,3)
    chainloader +1
}


j1alu 08-19-2010 03:19 AM

Quote:

Originally Posted by prdeltoid (Post 4070935)
I use Kubuntu/FreeBSD and have root set as (hd0,3) and chainloader + 1 and nothing else and it works fine. It looks like this:
Code:

menuentry "FreeBSD" {
    set root=(hd0,3)
    chainloader +1
}


Like said: exactly that syntax works fine on my second PC.
I want a bit more of horse-power for BSD, so i put it on my main PC too.

Now the problem is the following:
1)i am rather lousy with the output of "fdisk" from BSD. I am better with the output of "fdisk -l" in linux-speak.
The partiton(s) BSD is/are installed on is:
/dev/sdb3
Wherever the no 6 in sd6a3 from the BSD-installation is coming from is beyond me.

2) If there would be an grub-error i could search for it. But it just hangs, and nothing happens

3) I am not so sure about /boot/grub/device.map, as it comes with UUID now.
In my eyes it looks ok.

4) During FreeBSD installations there are three options:
install to mbr, something else and don't install a boat- loader at all.
I don't know what to use in case i already know i will boot it from Debian's grub.
I tried different options, but to no avail.

j1alu 08-19-2010 03:23 AM

I already tried all i can think of. The installation is sitting in the box and ready to explode (aka: to be booted).
If no one helps me to get it booted i will have to remove it again. No biggie, sure, but a bit of a pity, cause i will have to use FreeBSD on my other PC, with less specs, and in Vbox and Qemu, with "more of less specs".

So, BSD-folks, take the chance and give a Linuxer a hand, so he will get convinced of the amazing BSD.
Pluaeze.....:)

anomie 08-19-2010 01:05 PM

@j1alu: Before you throw in the towel on that, at least give the shorter form chainloader approach (mentioned earlier) a try. It's a little more simplistic, but sometimes you need a blunt tool.

-------

edit: Actually, after reading here and here, your initial syntax (minus the insmod, perhaps) looks fairly sane.

For grins, read the following (short) article and accompanying comments:
http://www.cyberciti.biz/tips/config...d-freebsd.html

j1alu 08-19-2010 02:28 PM

Hmm... bit of an update.
I tried again to edit the grub menu entry by hitting <e>. No avail.

Then i re-installed BSD.
When i can choose the hard-disk there is:
ad4
ad6
I choose ad6 (which is the second hard-disk).
This time i have chosen to install the freebsd-boot-loader to mbr (might well be i already did that... not sure).
I rebooted: No freebsd-boat-loader, but grub menu. Huh?
(the last time grub was replaced by freebsd-boot-loader, i booted a live-CD and re-installed grub)

Then i have chosen to boot from the second hard-disk:
Voila, the freebsd boot-menu (F1; F2; F3 and so on).
I hit enter: nothing.
The keyboard is dead. Really.
OMG.... :)

linus72 08-19-2010 02:33 PM

I had something similar happen when I installed
Calculate Linux Scratch
for some reason no matter what OS I installed, even to where Calculate used to be, a Calculate
grub menu always came up
this is even after reformatting partitions and reinstalling grub

in desperation I finally had to DD the hard drive
and then it was normal again...

j1alu 08-20-2010 06:26 AM

thanks, linus72.
Well: i got two other partitions on that hard-disk.
The one contains a backup of my Documents and Music
The other contains a monthly backup of my OS from January to now and a lot of iso's.
So i would rather not want to dd it (besides that i did never use dd :) ).

That said: it might well be that you are right (and that that would be the solution. If i would know for sure i could move the data around, go for dd and move the data back... but just as a test... bit much of work)


Another option would be to use a stick.
As my main purpose is to use FreeBSD with more horse-power, would that make sense?
Debian is slower on a stick than on a hard-disk (not much, but it is).

j1alu 08-20-2010 11:11 AM

Ok, now it gets weird.
I installed a debian-based distribution on said device (/dev/sdb3) and i run into the exactly same problem.
I choose it from the grub-menu, no error-message whatsoever, but the screen, including the grub-image, just hangs there.

For how to figure out what might be wrong there: i am pretty clueless.
Is there a difference if i delete all the three partitions and create them again (say with gparted)
and the usage of dd?

kostya 02-11-2011 06:46 PM

Don't know if it helps...
Try to REINSTALL the FreeBSD bootcode onto your MBR (using FreeBSD Fixit DVD and following the procedures well decribed in many places), then copy it with dd utility, after which you can fearlessly overwrite that MBR with your GRUB installation, and your copied bootcode of MBR will do the job to boot into the FreeBSD bootloader.
Code:

dd if=/dev/sdb of=/boot/sdb.mbr bs=512
Thus I saved it into the /boot/sdb.mbr on the same partition where GRUB files were installed.
Then you can use a "chainloader" directive in /boot/grub/menu.lst:
Code:

root (hd1,8)
chainloader (hd1,4)/boot/sdb.mbr

where (hd1,8) is the FreeBSD partition, and (hd1,4) is where the GRUB's own files reside, there I also placed the MBR bootcode copy.
Or maybe you need to supply the FreeBSD root partition? Like
Code:

rootnoverify (part/slice)
Not sure which will work.
For me the above works, but I'm using a GPT disk with FreeBSD root partition on (hd1,8).
On the other hand, from my experience I know, that once you boot into the FreeBSD bootloader, it will not care what root device you gave to GRUB. And if confused, it will prompt you for root device anyway!!

A! Don't forget to reinstall GRUB and overwrite your FreeBSD made MBR after you're done with the FreeBSD bootcode - hope you know how to do that?

Hope this trick will work for you just like it worked for me several times.

kostya 02-11-2011 06:50 PM

Yeah, I just noticed the date... anyway, the trick works fine and may be helpful to others :D


All times are GMT -5. The time now is 03:46 PM.