Wednesday, November 5, 2008

How to fix FreeBSD "Can't work out which disk we are booting from"

I had just installed a fresh FreeBSD 7.0-RELEASE, cvsup the latest sources and ports and followed my standard procedure to build and install a new world and kernel (without any big changes).

Everything ran beautifully and after installworld I was ready to reboot and here's where the problem started. Upon reboot, the system wouldn't load!

It was getting stuck with the following error:
Can't work out which disk we are booting from.
Guessed BIOS device 0xffffffff not found by probes, defaulting to disk0


After some online research I found a lead to fix the problem...well, at least to get your system started again.

Here's what you'll need to get started:
1) The installation CD/DVD that you had just used to install this release
2) A LiveFS CD/DVD. You can get it from the FreeBSD site. I'm a i386 so here's the direct link
ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/7.0/

Now time to get to work:
1) Boot from your installation CD/DVD
2) Select your region which will you take you to the usual sysinstall screen
3) Select the Fixit option to repair an installation
4) Select the CD/DVD option (#2) and it will ask you to insert the LiveFS CD/DVD
5) You should now be on the #fixit: prompt
6) Make a directory where we will mount the old root FS
# mkdir /old
7) I assume you know your drive and where you had installed your FreeBSD partition. If you need a little reminder, you can run the command below to see your drives. I only have one at "ad0"
# dmesg
8) And to verify you can look at /dev
# ls /dev
9) The root partition ends with an 'a'. So let's mount it.
# mount -t ufs /dev/ad0s1a /old
10) We will now replace the faulty /boot/loader (also back it up just in case)
# cd /old/boot
# cp loader loader.bad
# cp loader.old loader
# exit

Now just exit the sysinstall screen, remove the LiveFS CD/DVD and your system should boot up normally.

I found this Wiki to be helpful and it also provides a patch which I haven't tried yet.
http://wiki.freebsd.org/JeremyChadwick/Commonly_reported_issues