# Installing FreeBSD and corrupt BCD



## idakan (Oct 7, 2013)

Yesterday, I installed 9.2-RELEASE onto my Dell Inspiron laptop. Install went fine. When I rebooted, I was (and still am) unable to boot into Windows 8 because of a corrupt BCD. I've been running FreeBSD for many years and never had anything like this happen. This laptop is UEFI and has secure boot. I changed to legacy mode to install FreeBSD, and then went back to UEFI and secure boot to boot into Windows. I used GPT to install FreeBSD also. I can get into FreeBSD via my SuperGrub2 disk, but not Windows, because of the corrupt BCD. Any ideas how to repair it? I don't have a Windows CD yet, since this is a new laptop. I tried searching here and via Google, but didn't turn up anything without Windows CD.


----------



## wblock@ (Oct 7, 2013)

If the machine has a recovery partition like most, there is a potential to rebuild the BCD: http://pcsupport.about.com/od/fixtheproblem/ht/rebuild-bcd-store-windows.htm.

As always, restoring from a backup made previous to the incident is the easiest solution.  Clonezilla will back up GPT Windows disks.  Dell will likely sell recovery disks for a nominal price.


----------



## kpa (Oct 8, 2013)

FreeBSD does not have support for UEFI boot yet so it's to be expected that installing on machines with UEFI and secure boot turned on will fail in mysterious ways.


----------



## mrmagoo (Oct 8, 2013)

idakan said:
			
		

> Yesterday, I installed 9.2-Release onto my Dell inspiron laptop. Install went fine.
> When I rebooted, I was (and still am) unable to boot into Windows 8 because of a corrupt bcd.
> I've been running FreeBSD for many years and never had anything like this happen.
> This laptop is UEFI and has secure boot. I changed to legacy mode to install FreeBSD, and then went back to uefi and secure boot to boot into Windows.
> ...



http://superuser.com/questions/460762/how-can-i-repair-the-windows-8-efi-bootloader

It's not going to be pleasant. If you can find a Windows 8 PE image you hopefully can follow above. There are packages on the net that have "freeware" PE images, if you trust them. Getting one direct from Microsoft will be difficult, if you can provide authenticity, maybe the right tech will throw you a bone if you call them, but that may be optimistic. Other option is to find a Windows 8 install disk, and pick drop to command prompt, then follow as above.

I think UEFI Secure is not required for windows 8 to function, it is just recommended. I Seem to recall reading an article with MS stating they will not block dual booting, but thought they stated secure boot had to be disabled. As already stated FreeBSD is not going to be "secured", not sure how Windows plays with insecure boot target found, but MS typically doesn't play nice. 

Once windows is restored, you'll have to use BCDEDIT to add the FreeBSD system to the Windows bootloader, I don't believe there is any option. This requires a dd(1) of the bootcode (possibly just the correct bootloader code from /boot, never tried) or I think windows BCD can chainload partitions it can see. I've heard windows 8 will install on GPT but haven't tried yet. I don't use windows much, but know Vista was a bear.

Not sure if grub would work, I found surrendering and using BCDEDIT isn't that horrible once you get the hang of it, and MS doesn't seem to like anything but their boot menu, at least from my experience. You just can't usually make changes to a running system, so when you get going again at least make a PE image for yourself using their kit (need a base running system or it won't work used to call AIK) I've found Grub2 to be harder to use then MS's loader.


----------



## wblock@ (Oct 8, 2013)

kpa said:
			
		

> FreeBSD does not have support for UEFI boot yet so it's to be expected that installing on machines with UEFI and secure boot turned on will fail in mysterious ways.



Doh, I read the part about using legacy mode and skipped over the part about re-enabling secure boot.  But the error should not be mysterious, it ought to give some kind of security warning.

In any case, yes, disable secure boot.  And hope that Windows 8 will still boot after that.


----------



## wblock@ (Oct 8, 2013)

EasyBCD supports Windows 8.  There's a free version: click on Register at the bottom of the page.  It requests but does not require a registration.


----------



## idakan (Oct 8, 2013)

I installed with secure boot off. Turned it back on to boot into Windows 8 and install easybcd 
4th sentence explains what I did.

No, Windows won't load with secure boot on or off


----------



## Erratus (Oct 12, 2013)

In BIOS setup disable UEFI at all. This means devices will be booted with legacy BIOS. 
Install Windows on a cleaned disk and choose an installation on MBR when asked.
No brainers anymore with FreeBSD after that, even when choosing to install FreeBSD on GPT scheme. No more switching bootmode in BIOS needed after that.


----------

