# FreeBSD won't boot after fresh install



## motaito (Sep 22, 2015)

Hi,

I am completely new to BSD and first installed it in VirtualBox. This worked without any problems and I wanted to try FreeBSD on actual hardware. I have a MSI GT60. If you need more specs, I will have to look it up somewhere. Not sure about it. It's a couple years old. I think the main thing to know is, that it's an UEFI notebook. The problem is that the system won't boot after the BSD install. I have tried the FreeBSD-10.2-RELEASE-amd64-uefi-memstick.img which I wrote to a USB stick. It doesn't boot like the one I used in VirtualBox. I guess this is normal? Instead of the install options I get into a terminal. Here I entered the command "boot" which seams to have started the installation. During the installation I don't encounter any issues. Mostly I just use the default settings. I do however partition manually. Because it's an UEFI system, I select GPT. When I make the first freebsd-ufs partition, I get asked to add an UEFI-boot partition to which I agree. I don't further change the options for that boot partition. The partitions look like this:

```
ada0           750GB    GPT
ada0p1        800kB    efi
ada0p2        100GB    freebsd-ufs     /
ada0p3        8GB      freebsd-swap    none
ada0p4        640GB    freebsd-ufs     /home
```
(the above partition sizes are not exact except for the efi partition, I don't know the sizes from memory. The rest should be accurate.)

After the system did not boot, I tried the same again. But this time I entered the shell instead of exiting the install at the end. Here I used these guides:
http://unix.stackexchange.com/questions/125608/freebsd-10-does-not-boot-after-clean-install
https://glenbarber.us/2011/11/12/Dual-Booting-OS-X-and-FreeBSD-9.html

and used these commands in order:
`gpart set -a active /dev/ada0
gpart set -a bootme -i 1 /dev/ada0
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0`
(1 referring to the boot partition)

Absolutely nothing has changed. I don't even know how to get a useful error message. When booting the system is stays with a black screen and a tiny text "booting PXE offer IPv6" for about a minute and then enters the BIOS (UEFI firmware settings). I did not configure IPv6 btw. I only use IPv4. I assume, it can't find the boot partition. But how do I fix that? Should I use ZFS instead? Do I have to manually add a boot loader? How do I get the installation to boot?

As I am new to FreeBSD, please use small words  I am not familiar with the FreeBSD/Unix jargon. But I really want to learn how to use FreeBSD.

I have done some googling, but could not find anything that helped. Any input is greatly appreciated!


----------



## tingo (Sep 22, 2015)

Have you tried mounting the efi partition (ada0p1) and checking out what's on it?
It should be an msdosfs partition, and there should be an (U)EFI bootloader on it in a directory.
Also, is the BIOS / UEFI on your laptop updated?


----------



## motaito (Sep 22, 2015)

Thanks for your reply.



> It should be an msdosfs partition


When installing the type of the partition is automatically given as "efi". I assumed it would have the right format. Not sure how I can check the format.
`gpart show`
displays the partition as "efi".



> there should be an (U)EFI bootloader on it in a directory


I can enter the shell after an install and I see (amongst other entries in /boot)
`boot1.efi
boot1.efifat
loader.efi`
Are these the files you are referring to?

--- Edit ---
I just noticed, that `ls` may just list the files after an install. How can I check, that /boot is actually on the boot partition and not in another place?

I tried editing /etc/fstab and adding the boot partition manually after install by adding the line:
`/dev/ada0p1 /boot msdosfs rw 0 2`
That made no difference.
--- End of Edit ---



> Also, is the BIOS / UEFI on your laptop updated?


I have never updated the BIOS/UEFI. I did have a Linux install prior on the laptop, and it worked fine with UEFI. I don't think I have to update. At least I hope, I wouldn't know how to...

I guess, I could switch to legacy boot and try that way, but I would prefer to install with UEFI. Mainly, because I want to know how to do it.


----------



## motaito (Sep 24, 2015)

I have tried to install with legacy boot, just to see if it works. Unfortunately in this case the USB stick doesn't boot at all. I have used the win 32 disk imager to create the USB stick which shows that the image has been written successfully. I used the FreeBSD-10.2-RELEASE-amd64-memstick.img in this case. Is there a known problem with USB installs?

I had ISO files on USB sticks when installing Linux. Not sure why BSD is using img files instead. Can I try to write one of the ISO files to a USB stick instead of the memstick.img? What is the difference between them?


----------



## scottro (Sep 24, 2015)

No, the ISO file is for, oddly enough, ISOs (like CDs and DVDs).  The memstick IMG is specifically designed to be copied with the dd(1) command (or equivalent on non-Unix-ish systems) to a USB.

FreeBSD  does it a bit differently than Linux. At present, I _think_ that almost all Linux distributions have an ISO image that can either be burned to an optical disk or, with a different method, to a USB.  FreeBSD still has different images, so using the ISO image on a USB won't work.  (There might be workarounds, but I've never looked into it as I've never had trouble booting from the USB image unless a machine itself had problems booting from a USB).


----------



## motaito (Sep 25, 2015)

Thanks for the input.

In legacy mode I can't boot from the USB stick at all and in UEFI mode the system won't boot after install. I have also tried to follow https://wiki.freebsd.org/UEFI and used
`dd if=/boot/boot1.efifat of=/dev/ada0p1`
After the install. There is still no change. I guess the only thing left is to try a CD instead of an USB stick. I am not hopeful about it but I will try this weekend.


----------



## pvoigt (Sep 26, 2015)

motaito said:


> In legacy mode I can't boot from the USB stick at all



Please keep in mind that there are not only different images for CD/DVD and USB stick but also different USB stick images for UEFI and legacy boot, e.g. for FreeBSD 10.2-RELEASE (amd64):
ftp://ftp.freebsd.org/pub/FreeBSD/r.../FreeBSD-10.2-RELEASE-amd64-uefi-memstick.img
ftp://ftp.freebsd.org/pub/FreeBSD/r.../10.2/FreeBSD-10.2-RELEASE-amd64-memstick.img

Peter


----------



## tingo (Sep 26, 2015)

In the old days (before FreeBSD got separate install images for USB sticks) I just used the ISO images and wrote them to USB sticks with dd(1). It worked then. Worth a try at least.


----------



## motaito (Sep 27, 2015)

pvoigt
I saw the different images for UEFI and legacy boot and used them respectively. But thanks for pointing it out and providing direct links.

tingo
Meanwhile I tried all combinations, UEFI and legacy boot with USB and CD to boot from. I always get the same result  I guess I can also try with an ISO file on a USB stick.

Right now I go by the assumption (really just a wild guess) that the boot partition is not recognized. Not sure how to ensure that the boot partition is written properly though. What I find odd also is that in VirtualBox I got a splashscreen with a menu. On the actual hardware I get into a terminal and have to type the command "boot" to start the installer. I don't see why it is different but the installer starts just the same so I don't think there is a problem with that. I wonder if I can install GRUB2 after the installation and override the boot loader from the install medium? How would I do that?

Also, the boot partition is shown as "efi" shouldn't that be "FAT32" instead?


----------



## tingo (Sep 27, 2015)

No, "efi" is the correct partition type. If you want to mount it, it has a fat32 filesystem on it (yeah, it is a bit confusing).
And as you have already found out virtual hardware (VirtualBox in this case) and real hardware differ - you can't always compare them. Various real hardware also differ - some works, and some don't. For boot issues that are not related to bad usb sticks or writing the image incorrectly, many can be fixed by upgrading the bios / uefi on the machine to the latest version.
For the remaining percentage - it just don't work (for now at least).


----------



## motaito (Sep 28, 2015)

Thanks for the input.

I have now tried all possible combinations. The only thing left is updating the BIOS/UEFI. I haven't found the proper file for the update yet. I have an older MSI GT60 with a 660M Graphics card. The only BIOS updates that I have found are for the newer models. I am not sure there is a newer version for my system than the one I already have. I will do some more searching during this week.


----------



## t_pete (Sep 28, 2015)

After bouncing through numerous distributions trying to find a modern OS that would support my extremely old x86 laptop, at some point along the way, I started to run into unusual and random complications after installing some distributions. Each OS installation was using the entire hard drive and creating new partitions. The complications I ran into after installing an OS were basically unexpected performance or complete failure to load/run. It took a while to track it down but the fix, in my situation, was overwriting the entire hard drive with zeros (not just the first few sectors/mbr/etc as that didn't suffice). The only way I can explain to myself what happened it is that one of my OS installations had left a "sticky bit" that wasn't being dealt with by any OS installation after that point. After writing zeros to the drive, the OS installations that had had the unexpected performance issues worked as expected (maybe not good enough for the old laptop but they ran/functioned). In the end, after bouncing through many OSs looking for one to breathe life back into this old laptop, FreeBSD was the OS that did it. I don't know if this is any help in your situation, but it seems like you're at a loss with not many more options to try. It may be worth the time to write zeros to the drive and attempting a new installation just to rule out some kind of "sticky bit" problem. Hope this helps.


----------



## motaito (Sep 29, 2015)

Thanks for the tip. I tried everything now. Including
`dd if=/dev/zero of=/dev/ada0 bs=1M`
to zero out the entire disk. Nothing changes the result I get. I guess it's back to linux now. What a shame... FreeBSD looked awesome in VirtualBox.


----------

