# Help needed with FreeBSD boot manager recovery



## kadupl (Nov 20, 2012)

Hi.

I hereby apologize for a very nooby question. I'll start with saying that I did look at the similar posts on this forum (and elsewhere), and none of the solutions worked for me. I am clearly missing something important. Here is what has happened:

My primary OS is FreeBSD 9 installed on the only HDD in the laptop. So the disk was partitioned so that 70% of space was assigned for FreeBSD. The rest was unpartitioned.

I wanted to install Ubuntu 10.04 on the *external* drive that I've connected via USB.

For some mysterious reason (or not that mysterious -- I could have done that accidentally), Ubuntu installed itself on my internal HDD (in the free, unpartitioned space), even though I'm pretty sure I've asked the installer to use the external HDD.

That itself -- would not be a problem, but GRUB was installed, overriding FreeBSD boot manager. To make things worse, menu list presented by GRUB included all the OSes that were installed on my external drive, but NOT FreeBSD.

I tried playing with GRUB configuration (as described in many threads here), but none of it worked. Since I didn't really wanted to have UBUNTU installed on my internal HDD, I was ready to just wipe off grub, and restore the original FreeBSD boot manager. So I used a FreeBSD installation CD to fire up shell, and perform:

`boot0cfg -B -b /boot/boot0`

However, after restarting, boot manager displayed only one, unknown option (F1:  ?), and was not able to boot anything (pressing anything caused '#' to appear on the screen).

So I am confused. Can anyone please explain, or point me to some resources, how do we call that program presenting nice little menu (with freebsd logo, and choices to go to loader prompt, boot normally, etc.)? Isn't it boot manager? Is it about stage 0 vs stage 1 boot manager?

And most important: How do I make my FreeBSD boot again?


----------



## SirDice (Nov 20, 2012)

Getting it booting again is a little different depending on GPT or MBR. Which one did you use?


----------



## kadupl (Nov 20, 2012)

SirDice said:
			
		

> Getting it booting again is a little different depending on GPT or MBR. Which one did you use?



To be honest.. I have no idea. Which one did I use when ?
I don't think I've made any concious choice here. How can I check that ?

Thank you for your help!


----------



## SirDice (Nov 20, 2012)

Have a look with `# gpart show`

For MBR the boot0cfg(8) command should be used. Note however that you cannot use the bootmanager on GPT disks.

For GPT you'll need something like this:
`# gpart bootcode -b /boot/pmbr ad0`


----------



## kadupl (Nov 20, 2012)

OMG ! It was as simple as that ! Thank you SirDice. It helped ! It turned out I had to use gpart instead of boot0cfg.


----------

