# FreeBSD grub problem



## LeFroid (May 27, 2010)

Alright, so I just replaced the default FreeBSD boot manager with grub, and now I can't boot into any other operating system :s

Is there anything special I need to do to boot into another OS with grub? I set up grub so it's in the MBR and my computer will boot up to grub, but no matter what OS I select I always end up booting into FreeBSD.

This is my menu.lst

```
default 1
 timeout 10

 title FreeBSD
 root(hd1,0)
 kernel /boot/loader
 
 title Windows
 root(hd1,1)
 savedefault
 makeactive
 chainloader +1
 
 title Ubuntu
 root(hd0,0)
 savedefault
 makeactive
 chainloader +1
```


----------



## JimW (May 27, 2010)

How did you install Grub? Did you do it from FreeBSD?

If so, it was not necessary. Since you have Ubuntu installed, you already had a working version of Grub on the machine and you could have just added a menu item for FreeBSD in Ubuntu's version of Grub.

What version of Ubuntu are you running? The last couple of releases use Grub2.

I would suggest bringing back the Ubuntu version of Grub and customizing the menu items there. That would be the least headache free method of solving your problem.

There are instructions for doing so at this link.....

https://help.ubuntu.com/community/Grub2


----------



## LeFroid (May 27, 2010)

JimW said:
			
		

> How did you install Grub? Did you do it from FreeBSD?
> 
> If so, it was not necessary. Since you have Ubuntu installed, you already had a working version of Grub on the machine and you could have just added a menu item for FreeBSD in Ubuntu's version of Grub.
> 
> ...



Ubuntu was screwing up my computer (it deleted freebsd from my system for no reason) so after reinstalling freebsd I installed grub from the ports system and tried to set it up. I don't have a live cd or anything so idk if I can set ubuntu's grub as the default again :S

Before buying more cd's I'd like to know if grub can be fixed on my freebsd os.


----------



## JimW (May 27, 2010)

LeFroid said:
			
		

> Ubuntu was screwing up my computer (it deleted freebsd from my system for no reason) so after reinstalling freebsd I installed grub from the ports system and tried to set it up. I don't have a live cd or anything so idk if I can set ubuntu's grub as the default again :S
> 
> Before buying more cd's I'd like to know if grub can be fixed on my freebsd os.



Usually your Ubuntu install CD is also a Live CD. However, I'm not sure what disks you may have.

Yeah... We'll give it a try to fix your current version of Grub and the menu.lst file.

You say that FreeBSD loads up and the others do not. Is it also true that Windows is located on the second partition of your second hard drive? We'll go with that assumption.

Make a backup copy of your menu.lst file and change the file to the following....



```
default 1
timeout 10

title FreeBSD
root(hd1,0)
kernel /boot/loader
 
title Windows
rootnoverify (hd1,1)
makeactive
chainloader +1
 
title Ubuntu
rootnoverify (hd0,0)
makeactive
chainloader +1
```

I've never loaded Ubuntu by chainloading, so I am not sure that menu item will work. Give it a try and see what happens.

Good Luck.


----------



## LeFroid (May 27, 2010)

Didn't work 
The weird thing is that even when I hit enter after selecting Windows (or Ubuntu) grub will freeze for like 5-10 seconds and then boot into FreeBSD

BTW yeah, I threw out my Ubuntu install/live cd


----------



## zeiz (May 27, 2010)

Instead of having legacy grub I used GAG bootmanager for years.
It's standalone bootmanager capable of booting up to 9 OSs. Install it and then you may delete all your OSs and reinstall them. GAG stays on MBR.
Recently I moved to grub2 only because GAG currently cannot boot grub2 from root partitions of my OSs.
I understand your goal but I'm in doubts that somebody is interested in fixing legacy grub on FreeBSD at the moment.
So let's say it just doesn't work and nobody cares


----------



## JimW (May 27, 2010)

LeFroid said:
			
		

> Didn't work
> The weird thing is that even when I hit enter after selecting Windows (or Ubuntu) grub will freeze for like 5-10 seconds and then boot into FreeBSD
> 
> BTW yeah, I threw out my Ubuntu install/live cd




Hmmm... Interesting.

Maybe try the following sysctl variable then re-installing grub to your MBR as according to the link below...


```
sysctl kern.geom.debugflags=16
```

http://administratosphere.wordpress.com/2008/02/25/installing-grub-on-freebsd/


----------



## LeFroid (May 27, 2010)

@JimW: Tried that a few times and it didn't work 

@zeiz: Thanks for the advice, I'm gonna give GAG a try

edit: I just installed it from the ports. How do I install it to the MBR?


----------



## JimW (May 27, 2010)

Do you have any CD that will boot up a live system of any version of Linux?

I've never used GAG. See if it loaded it's files in a directory like /boot/gag and check if there are any install scripts.


----------



## zeiz (May 28, 2010)

LeFroid, it not that GAG.
The gag in ports is in security group and GAG bootmanager has nothing to do with security.
I gave a link to GAG in my first post.
Download, burn to CD (the easiest way) boot with it and follow very simple instructions (sorry I forgot).
The only you should know: what is on your first partition, second partion etc.
When GAG ask about Windows "do you want to swap disks?" answer "YES".

Just noticed something wrong:


```
default 1
 timeout 10

 title FreeBSD
 root(hd1,0,a)
 kernel /boot/loader
 chainloader +1
 
 title Windows
 root(hd1,1)
 makeactive
 [color="Red"]map (hd0) (hd1)
 map (hd1) (hd0)[/color]
 chainloader +1
 
 title Ubuntu
 root(hd0,0)
 makeactive
 chainloader +1
```
Windows cannot be on hd1 without tweaking grub. Windows wants to be #1 i.e hd0,0.

So the layout must be like this:
Ubuntu hd0,0 
Windows hd1,0 (primary partition)
FreeBSD hd1,1 (primary partition)


----------



## sw2wolf (Jun 3, 2010)

```
timeout   5
default   0
color light-blue/black light-cyan/blue

title Arch Linux
root   (hd0,4)
kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/752ae3a4-d2ae-487a-8de5-a59a1ed2631f ro
initrd /boot/kernel26.img

title FreeBSD 8.0
rootnoverify (hd0,2,a)
chainloader +1

title Windows XP Professional
rootnoverify (hd0,0)
chainloader /ntldr
boot
```

it works great for me!


----------

