# Unable to boot other BSD



## jewsofeast (Dec 18, 2010)

Hi,

I've multiple OS installed on my box spanning over 3 SATA HDDs. On sdc I've installed FreeBSD (sdc1) and DragonFlyBSD (sdc4) along with several Linux on extended. I use SUSE GrUB to boot everything. When I try to boot DragonFlyBSD it boots FreeBSD. I've checked the menu.lst and everything is alright there. I've not installed FreeBSD loader on MBR. 

How do I find out whats messing it up.

Best,

David


----------



## wblock@ (Dec 18, 2010)

Sometimes sysinstall(8) installs the FreeBSD loader even when you tell it not to.


----------



## jewsofeast (Dec 19, 2010)

OKay, how do I fix it? My boot device is sda and GrUB Legacy is in MBR. The BSD install is on sdc. Wonder why it boots FreeBSD from other menu.


----------



## wblock@ (Dec 19, 2010)

I'm thinking that the FreeBSD install came after Dragonfly, and put the FreeBSD MBR on that disk, sdc.  How to repair that depends on what was there first.  Maybe a Grub bootloader or one from Dragonfly.


----------



## jewsofeast (Dec 20, 2010)

wblock said:
			
		

> I'm thinking that the FreeBSD install came after Dragonfly, and put the FreeBSD MBR on that disk, sdc.  How to repair that depends on what was there first.  Maybe a Grub bootloader or one from Dragonfly.



Well, DragonFly install was after FreeBSD. I have 4 Linux on sdc and the GrUB sits on '/'. SUSE GrUB is on sda and it boots everything. 

Correct me if I am wrong -

[cmd=]fdisk -B -b /boot/mbr[/cmd]

Will this remove the BSD loader and leave MBR blank. I've put in a lot of effort on configuring FreeBSD with portupgrade including kde and wont like to mess it up.


----------



## Beastie (Dec 20, 2010)

jewsofeast said:
			
		

> I've put in a lot of effort on configuring FreeBSD with portupgrade including kde and wont like to mess it up.


You are installing more than one system, spending hours maybe on configuration and software installation, and you're making no backups?
1) Ports can be "converted" into easily (re)installable packages (cf. pkg_create(1));
2) Partitions can be dump()ed individually and stored on external media;
3) Single sectors can be backed up (cf. dd(1)). And just because you mess up the first 512 bytes of your disk doesn't mean you've lost the entire multi-GB system. So backup the MBR and restore it if something goes wrong. All you'll need is the livefs disc.

There are tools for everything. Use them.


----------



## jewsofeast (Dec 20, 2010)

Beastie said:
			
		

> You are installing more than one system, spending hours maybe on configuration and software installation, and you're making no backups?
> 1) Ports can be "converted" into easily (re)installable packages (cf. pkg_create(1));
> 2) Partitions can be dump()ed individually and stored on external media;
> 3) Single sectors can be backed up (cf. dd(1)). And just because you mess up the first 512 bytes of your disk doesn't mean you've lost the entire multi-GB system. So backup the MBR and restore it if something goes wrong. All you'll need is the livefs disc.
> ...



Backing up takes a while. I have MBR backed up already but no data back-ups. 

Let me know if [cmd=]fdisk -B -b /boot/mbr [/cmd] will work or how.

Easy fix that I see is changing hdd boot priority in BIOS and using GAG (have it on CD) to fix MBR and then changing the boot priority again.


----------



## Beastie (Dec 20, 2010)

jewsofeast said:
			
		

> Let me know if [cmd=]fdisk -B -b /boot/mbr [/cmd] will work or how.


It should. You can drop the *-b /boot/mbr* as it's there by default.


----------



## jewsofeast (Dec 21, 2010)

Beastie said:
			
		

> It should. You can drop the *-b /boot/mbr* as it's there by default.



Ok so only "fdisk -B" will remove the bootloader from sdc. Is that correct.


----------



## Beastie (Dec 21, 2010)

Like I said, _it should_. But it has been a while since I had to use it. So make a backup of your MBR, just in case, and try it.


----------



## jewsofeast (Dec 21, 2010)

Beastie said:
			
		

> Like I said, _it should_. But it has been a while since I had to use it. So make a backup of your MBR, just in case, and try it.



I have so far tried various things but none has worked. 

1. fdisk /mbr doesnt go nowhere.
2. I removed the loader from mbr using Linux Live CD and by running 

```
dd if=/dev/zero of=/dev/sdX bs=446 count=1
```
but it still boots FreeBSD. 

FreeBSD and DesktopBSD aren't marked as active partitions (there is no boot flag). I guess this has to do with FreeBSD FS and GrUB isnt able to detect the right partition. On sdb I've 2 bsd's with A6 & A9 partition type. 

Here is complete bootinfo for further due diligence- 


```
http://pastebin.ca/2025376
```
Should I change the FS type?


----------



## Beastie (Dec 21, 2010)

jewsofeast said:
			
		

> fdisk /mbr doesnt go nowhere.


Isn't that an MS-DOS command?



			
				jewsofeast said:
			
		

> but it still boots FreeBSD.


Did you try the fdisk command from the Linux Live CD too? Who knows what the *-B* option does there. You can't assume it does the same as the FreeBSD one.
Also, are you sure you ran it on the right disk?


----------



## jewsofeast (Dec 21, 2010)

Beastie said:
			
		

> Isn't that an MS-DOS command?
> 
> 
> Did you try the fdisk command from the Linux Live CD too? Who knows what the *-B* option does there. You can't assume it does the same as the FreeBSD one.
> Also, are you sure you ran it on the right disk?



This is what I have in MBR atm -


```
#
============================= Boot Info Summary: ==============================
#
 
#
 => Grub 0.97 is installed in the MBR of /dev/sda and looks on the same drive
#
    in partition #31 for /boot/grub/stage2 and /boot/grub/menu.lst.
#
 => No known boot loader is installed in the MBR of /dev/sdb
#
 => Testdisk is installed in the MBR of /dev/sdc
```

There is some more twist in this. When it boots FreeBSD from DesktopBSD menu off GrUB it loads correct Xorg and when I boot it off FreeBSD menu off GrUB it returns error saying -

```
Unable to load GreeterUID for kdm
```
After couple of minutes it loads kdm.

I am sure the booting mess up is due to FS type, GrUB boots first UFS on sdc. After fixing GreeterUID thing, I will hide sdc1 with grub cd and see if it boots DesktopBSD or hangs.


----------



## jewsofeast (Dec 22, 2010)

I installed GrUB 0.97 on '/' of FreeBSD. Here is the output of bootinfoscript confirming the install.


```
File system:       
    Boot sector type:  Grub
    Boot sector info:  Grub 0.97 is installed in the boot sector of sdc1 and 
                       looks at sector 785119 of the same hard drive for the 
                       stage2 file. A stage2 file is at this location on 
                       /dev/sdc. Stage2 looks on partition #1 for 
                       /boot/grub/menu.lst.
    Mounting failed:
mount: unknown filesystem type ''
mount: unknown filesystem type ''
mount: unknown filesystem type ''
mount: unknown filesystem type ''
mount: unknown filesystem type ''
```

Here is my menu.lst (sda) entry for FreeBSD -

```
title FreeBSD 8.1
    root (hd2,0)
    configfile /boot/grub/menu.lst
```

When I try to boot that I get error 17 i.e. unknown fs type. Secondly, even after installing GrUB the dekstopbsd menu still chainloads FreeBSD. 

Here is my menu.lst in FreeBSD /boot/grub/menu.lst

```
title FreeBSD 8.1
   root (hd2,0,a)
   kernel /boot/loader  
   makeactive
   savedefault
```

This is getting trivial.


----------



## jewsofeast (Dec 24, 2010)

I can boot DekstopBSD after hiding FreeBSD slice(hd2,0).


----------



## jewsofeast (Dec 30, 2010)

I fixed it -


```
disklabel -B ad8s4
```

and changed menu entry to -


```
title DesktopBSD-1.7-amd64
rootnoverify (hd2,3)
makeactive
chainloader +1
```

Thanks everyone!


----------

