grub-install fails

Hey,

When I run [cmd=]grub-install hd0[/cmd] it gives me this error in return:

Code:
greenfrog# grub-install hd0
/usr/local/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?).
No path or device is specified.
Try `/usr/local/sbin/grub-probe --help' for more information.
Auto-detection of a filesystem module failed.
Please specify the module with the option `--modules' explicitly.

So I think I need to mount /dev/ad0 ?

Code:
greenfrog# mount /dev/ad0
mount: /dev/ad0: unknown special file or file system

grub-probe of ad0 returns [cmd=]error: unknown filesystem[/cmd]

So I'm not sure what filesystem to mount /dev/ad0 as (if it's the right way to go about it..)? Or the other option I've thought of is to create a livecd and try to install grub from there. What's everyone's opinions on how to go about this?

Currently the MBR is on ad5 and is a windows disk, so I want to change the MBR to ad0 and use a bootloader from there

System info..

Code:
greenfrog# uname -a
FreeBSD greenfrog 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 07:18:07 UTC 2009     root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

Code:
greenfrog# mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)

thanks,
luke
 
greenfrog,

Your device.map is okay. You may only need to swap the mapped devices if Windows will not boot.

However, 'grub-install' is acts merely on the guesswork. If you have installed grub properly in freeBsd partition (hd0,a) (which I manually did under fBSDRelease 6.2) then you may use the simpler and safer grub commands.

Enter into the grub> prompt, then you only need to issue three (3) simple grub commands:

Code:
grub> find /boot/grub/stage1 [I made this folder in fBSDrelease6.2 and copied files into it]
(hd0,a) should be returned by 'find'
grub> root (hd0,a)
grub> setup (hd0) [this writes into the MBR like 'grub-install' does]
grub> quit

done.
reboot.
then configure menu.lst to boot windows at /ad5, you might need to remap/swap devices to trigger windows:
Code:
map (hd0) (hd1)
map (hd1) (hd0)
then rootnoverify.

CAVEAT: My knowledge in Grub is mainly based in previous non-FreeBSD experience. I might have erred somewhere. My sad experience with Grub in FreeBSD 6.2 (over ATI hardware) forced me to manually install grub libraries and files into the bsd hier.
 
I'm wondering whether this is a grub problem or a package install problem, because when I try to run # grub to get into the grub shell I get a "command not found". This should be installed, shouldn't it?

How I installed grub:
# cd /usr/ports/sysutils/grub2
# make
# make install

then I tried
# grub-install hd0
giving the error stated in my first post.

I am doing all of these things as superuser, too.
 
I'm wondering whether this is a grub problem or a package install problem, because when I try to run # grub to get into the grub shell I get a "command not found". This should be installed, shouldn't it?

Yes and No. Supposed to be it should be 'done' by now. However, one thing I observed, the fBSD ports (I don't understand again "WHY" it did not care to make a 'link' to the proper grub directory /boot/*grub-here*) in its installation; as this failure renders grub installation useless outright. But this is easily solved.

How I installed grub:

[cmd=]# cd /usr/ports/sysutils/grub2[/cmd]
[cmd=]# make[/cmd]
[cmd=]# make install[/cmd]

then I tried

[cmd=]# grub-install hd0[/cmd]
giving the error stated in my first post.

I am doing all of these things as superuser, too.

After this, in all Gnu-based OS grub is ready.

Try issue man grub {you'll find out that man pages are there}!

Ports installation places grub important stage files at /usr/local/lib/grub/i386{blah-blah}/ and grub knows nothing about this place.

The binaries are located as follows:
/usr/local/sbin/grub !
/usr/local/sbin/grub-install
/usr/local/sbin/grub-md5-crypt

So, we gnu-OS users must DO these:

1. Create the usual /boot/grub folder. You know how to mkdir
2. Copy ufs_stage1_5 into /boot/grub. Best way is to copy all files found in /usr/local/lib/grub/i386-blah/* into /boot/grub so that your FreeBSD grub becomes the master for loading all systems in the universe.
3. If you find no 'menu.lst' file you may create it your self or copy from previous grub files from other drives running linux. If you have problem doing this you may call my attention back here I can make one.
4. Link 'ln -s' the binaries 'grub', 'grub-install', etc. found in /usr/local/sbin to /bin (this way you'll have universal control of the 'grub>' prompt.
5. Try run the three safe commands to install it into mbr:

[cmd=]grub> find /boot/grub/stage1[/cmd]
[cmd=]grub> root (hd0,a)[/cmd]
{whichever you intend; don't forget to remind grub that it is dealing with FreeBSD, changing (hd0,0) into (hd0,a). In this manner there is no need to call chainload.}
[cmd=]grub> setup (hd0)[/cmd]
{Note this time no more 'a' slice but the whole drive}
[cmd=]grub> quit[/cmd]
[cmd=]reboot[/cmd]

Hope this helps. Good luck.
 
I think there is a misunderstanding between greenfrog and radical. The first tries to work with sysutils/grub2 and the second tells about his experiences with sysutils/grub.

For me the older (legacy) version of grub works nice, the newer version 2 does not. There is at least one other thread about it on this forum.

For the older version you have to create /boot/grub and copy the necessary files as described by radical.
 
rhurlin,

Yea definitely, it is. I did not notice the tailing *2*, how sleepy (silly) I was. :) I never had the slightest thought that someone will ever try to run grub2 in FreeBSD when in fact grub2 is full of disappointments in the linux fora. It appears that grub2 is still very premature (if not misconceived), more time is required for the user just for the sake of controlling the boot ups. :/

Thanks anyway for calling my attention. But it seems greenfrog is also giving it up.
 
Sorry I should've specified that in the first post. I've been trying grub2 all this time. I tried to install grub but I got an error about it not being able to install on an i386 machine, though I'm running an amd64. I'll try again and I'll post the right error soon.

Radical, thanks heaps for the help. Grub2 didn't install the grub shell though (/usr/local/sbin/grub), I did look. I have limited amount of time to dedicate to FreeBSD which is way I'm taking a while to post. It's spring down here in Australia so I've been busy doing things :)

I had no idea that grub2 was still so premature. I'm a bit of a novice so these things are a bit unknown to me. I had the idea that FreeBSD was meant to be more stable in its port releases?
 
Here's what happens when I try to install grub

Code:
greenfrog# cd /usr/ports/sysutils/grub
greenfrog# make
===>  grub-0.97_4 is only for i386, while you are running amd64.
*** Error code 1

Stop in /usr/ports/sysutils/grub.

I'll do searches on the problem in a couple of hours
 
Thanks for chiming in, rhurlin. I've done a search and I found that grub (nor grub2) isn't compatible with amd64 yet. Was barking up the wrong tree ;/ Thanks again radical, sorry to waste your time
 
greenfrog said:
Here's what happens when I try to install grub

Code:
greenfrog# cd /usr/ports/sysutils/grub
greenfrog# make
===>  grub-0.97_4 is only for i386, while you are running amd64.
*** Error code 1

Stop in /usr/ports/sysutils/grub.

I'll do searches on the problem in a couple of hours

I am working with 9.0-CURRENT (amd64). I installed an i386 ready package of grub (legacy) and it works like a charm.

Code:
>file /usr/local/sbin/grub
/usr/local/sbin/grub: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD),
dynamically linked (uses shared libs), for FreeBSD 9.0 (900004), stripped

You could try to find an i386 package for your FreeBSD (7, 8, 9) version and install it on amd64. I could send the package for CURRENT offline (ca. 213KB).
 
Back
Top