# FreeBSD 10 won't boot



## mrjayviper (Apr 17, 2014)

I have an Intel DQ35 motherboard (socket 775) with 6GB of RAM and I'm using the built-in VGA connector. I have installed FreeBSD 9.x on an IDE HDD and it boots and works fine.

I also have another IDE HDD which I wiped clean using an app called "dban". No errors were found during the process.

Anyway, I have installed FreeBSD 10 successfully (i.e. no errors were encountered during any part of the install process) on this 2nd HDD. But no matter what I try, the HDD won't boot. Seems the BIOS cannot find a bootloader. I have tried installing using the automatic partitioning option and I've also tried the "ZFS-on-root" multiple times without any luck. Reading the other threads, seems this is a common problem.

I am installing FreeBSD using the 600+MB ISO file available in an official and local FreeBSD mirror that's available in my country.

Does anyone have a suggestion on how to fix my problem? thanks


----------



## unquestioned (Apr 17, 2014)

MBR or GPT? Have freebsd-boot partition just behind partition table?


----------



## mrjayviper (Apr 17, 2014)

unquestioned said:
			
		

> MBR or GPT? Have freebsd-boot partition just behind partition table?


Using ZFS on root, I chose GPT. Using the auto-partition feature, I don't know. It doesn't give me the option to choose.


----------



## unquestioned (Apr 17, 2014)

Open shell, and execute `gpart show` and paste whole result here.

What message does the BIOS display?


----------



## obsigna (Apr 17, 2014)

mrjayviper said:
			
		

> I have an Intel DQ35 motherboard (socket 775) with 6GB of RAM and I'm using the built-in VGA connector. I have installed FreeBSD 9.x on an IDE HDD and it boots and works fine.
> 
> ...
> 
> ...



I had a similar situation with another Intel board. FreeBSD 9.2 was running nicely, and a new installation of FreeBSD 10 on exactly the same disk (GPT scheme) did not boot, the BIOS did not recognize it as the boot disk. In my case, the BIOS did not recognize FreeBSD 10 on any other GPT formatted drives, e.g. other HDD or USB-Pendrives either, while FreeBSD 10 on MBR formatted drives did startup.

I resolved the issue of GPT 10 with my Intel board, by simply copying over the FreeBSD 9.2 boot code onto the FreeBSD 10 GPT drive. While booted into FreeBSD 9, I did as the root user:

`gpart bootcode -b /boot/pmbr -p /boot/gptboot -i X adaY`

Notes:

You said that you want to boot into ZFS, so I guess you need to replace `-p /boot/gptboot` with `-p /boot/gptzfsboot`.
The `-i` parameter denotes the partition number, so replace `X` by the number of the partition of type *freebsd-boot*.
Finally, you need to replace the device identifier `adaY` by the one of the respective FreeBSD 10 GPT drive in your system.
This does not touch the content of the volumes, so there is no need to repeat the whole installation.


----------



## unquestioned (Apr 17, 2014)

Exactly. Also important to freebsd-boot partition was first (just behind partition table). I have little empty space before this partition and the system does not boot.


----------



## wblock@ (Apr 17, 2014)

unquestioned said:
			
		

> Exactly. Also important to freebsd-boot partition was first (just behind partition table). I have little empty space before this partition and the system does not boot.



That might be a different problem.  I've been told (by the guys who work on this code) that it does not matter where the freebsd-boot partition is located, even after the other partitions should work.  I have not tested that, though.


----------



## trh411 (Apr 17, 2014)

wblock@ said:
			
		

> That might be a different problem.  I've been told (by the guys who work on this code) that it does not matter where the freebsd-boot partition is located, even after the other partitions should work.  I have not tested that, though.


Back when I was doing my first FreeBSD-9.1 install, I somehow ended up with the freebsd-boot partition as the last partition without even realizing it. It booted fine. I have not had a reason to test this on later versions of FreeBSD.


----------



## mrjayviper (Apr 18, 2014)

I would've thought though that using the auto partitioning feature would've prevented any problem. I never had a problem with it before since using FreeBSD since version 6.x (I can't remember when this was introduced since it's been a long time since I've been using FreeBSD. But I've been using the feature on 8.x and 9.x installs).

I'll try the suggestions. Thanks again

edit: I just installed 9.2 and I remembered the proper name for the auto-partitioning feature. It's called "Guided" partitioning.


----------



## SirDice (Apr 18, 2014)

wblock@ said:
			
		

> unquestioned said:
> 
> 
> 
> ...


It should work. It's even mentioned in the gpart(8) man page:

```
Both types of bootstrap code are used to boot from the GUID Partition Ta-
     ble.  First, a protective MBR is embedded into the first disk sector from
     the /boot/pmbr image.  It searches through the GPT for a freebsd-boot
     partition (see the PARTITION TYPES section) and runs the next bootstrap
     stage from it.  The freebsd-boot partition should be smaller than 545 KB.
     It can be located either before or after other FreeBSD partitions on the
     disk.  There are two variants of bootstrap code to write to this parti-
     tion: /boot/gptboot and /boot/gptzfsboot.
```

So it doesn't matter where the freebsd-boot partition is, before, after or in between other partitions.


----------



## wblock@ (Apr 18, 2014)

Check out `svn blame` to see who wrote that.


----------



## helizeg (Apr 20, 2014)

I can confirm that it doesn't really matter where the boot-partition is. Mine is at ada0p6 for a newly installed ZFS-on-root FreeBSD 10 release.

BTW,  

```
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot <freebsd-boot partition>
```
Does it mean asking `gpart` to insert some of the boot code into the protective MBR of the GPT disk while the remaining boot code (for the ZFS root) into the freebsd-boot partition?

The reason I'm asking this is that before the FreeBSD installation, my HD was GPT formatted with Windows and linux partition and grub2 installed into the EFI system partition. Before the FreeBSD installation, I thought I'd need to chainload from grub to the freebsd-boot partition on the same disk. But the fact is all I need to do to boot into the new FreeBSD partition after the installation is to switch to legacy/CSM mode in the UEFI "BIOS" and pointed it to the whole disk. :q


----------



## wblock@ (Apr 20, 2014)

helizeg said:
			
		

> ```
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot <freebsd-boot partition>
> ```
> Does it mean asking `gpart` to insert some of the boot code into the protective MBR of the GPT disk while the remaining boot code (for the ZFS root) into the freebsd-boot partition?



Yes.



> The reason I'm asking this is that before the FreeBSD installation, my HD was GPT formatted with Windows and linux partition and grub2 installed into the EFI system partition. Before the FreeBSD installation, I thought I'd need to chainload from grub to the freebsd-boot partition on the same disk. But the fact is all I need to do to boot into the new FreeBSD partition after the installation is to switch to legacy/CSM mode in the UEFI "BIOS" and pointed it to the whole disk. :q



That actually makes sense.  Legacy mode boots the disk like a BIOS, from the MBR bootcode in the PMBR.  It sounds like you have it set up so that grub is only involved with UEFI booting.


----------



## helizeg (Apr 20, 2014)

wblock@ said:
			
		

> ....  It sounds like you have it set up so that grub is only involved with UEFI booting.



Yeah, that's where I'm right now....still can't figure out how to chainload to the freebsd-zfs from the Grub in the UEFI mode.

So basically my bootmanager at this moment is the UEFI "bios" :\ ;
              1/ UEFI mode : Grub2 for the linux(Gentoo with zfs-root) or Windows EFI bootloader 
              2/ Legacy mode : boot straight into freebsd-zfs.


----------



## mrjayviper (May 10, 2014)

helizeg said:
			
		

> ```
> gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot <freebsd-boot partition>
> ```



I just tried this when I partition another box using the experimental ZFS-on-root. My Intel board still can't boot. I haven't tried using basic GPT partition yet. I suppose the result will be the same so I'll stick to MBR.

edit: I forgot to say I tried the FreeBSD LiveCD on the code above and it didn't work. But using 9.2 solved my problem!


----------



## wblock@ (May 10, 2014)

Avoid MBR whenever possible.  GPT is much better.  But some BIOS or UEFI systems try to be clever and are confused by GPT, so it's not always possible.  Sometimes updating the BIOS will help.


----------



## mrjayviper (May 10, 2014)

thank you


----------



## akosh (May 13, 2014)

...to continue the "FreeBSD won't boot after install" theme:

Trying to install FreeBSD 10.0 on an older Intel D945GCLF2 Atom dual-processor mini-itx motherboard.  Onto a fresh/empty 64GB SSD.

When the OS tries to auto-assign the disk setup, it uses GPT for the boot type.  If I change the disk setup to MBR, and select "Automatic", it switches back to GPT.

But as it's older I'm trying to assign MBR to the boot record (turns out this is unnecessary--GPT works just fine, but I get ahead of myself).  So how do I setup a MBR drive setup with Automatic partitioning?

So selecting MBR for the entire disk is the first step, then I try to setup a freebsd boot partition layout like:

Disk: allocated as MBR...
freebsd-boot   512kb
freebsd-ufs  40gb /
freebsd-swap 1gb  

This setup is the same as what GPT would setup, but with MBR for the underlying boot setup.

When I try to assign either of the first two partition types, the partitioning utility comes back with "Error:" and "Invalid argument" dialog box.

What is this looking for? Which argument is incorrect? The partition types assign correctly under GPT with auto-assign, but not under MBR with a manual assign? 

What are the allowed types (the old install utility used to at least show you the various partition types you could assign).

So what is this error?  And how do I get around it?

After looking at the gpart(8) man page, I decided to try setting the GPT type on the disk (the same that gets assigned when "Automatic" is selected), but instead of freebsd-boot, I put in bios-boot.

So now it looks like:

bios-boot  64kb
freebsd-ufs  40gb /
freebsd-swap 1gb

Lets see if the install works now.  Alas: no.

Working with FreeBSD 10.0 and GPT for the install type didn't work.  And I cannot get past unknown errors when I try to specify a drive setup using MBR with 10.

Just to try other versions, attempting an install with FreeBSD 9.1 and GPT, it *does* work (creates a layout as described at the top of this discussion, with GPT as the boot partition type).

So what changed going to FreeBSD 10.0 that stopped the boot sequence from working? And how to fix it?


----------

