FreeBSD’s loader fails with wrong harddisk geometry in BIOS

Posted by: admin  :  Category: FreeBSD

I’s been a while since I last saw issues with FreeBSD’s loader(8).

The error I came along today read like this:

can't load kernel

The most obvious reasons would be that either the kernel is missing or it’s filename was specified incorrectly.
I thought to verify this by issueing ‘ls’ in the first place, only to notice that it would show nothing.
Wait! This is supposed to show the root directory contents, isn’t it?

Maybe loader didn’t catch up with tje devices? Let’s look at them:

disk devices:
    disk0: BIOS drive C:
         disk0s1: FFS bad disklabel

Well, this is not supposed to happen at all.

Obviously loader can see the device but is unhappy with the disklabel.

Given the fact that the disklabel is not corrupt, which can easily be verified if the system is booted by using a recovery disk or a FreeBSD bootonly CD, then there must be some other reason for this.

So I checked the disk in question for it’s logical configuration, which was manually established by means of fdisk and disklabel.
This and also the filesystem were intact and did not reveal any errors.
To make sure I even checked the primary boot blocks and re-installed them using the ‘boot0cfg -o packet ad0’ command to ensure use of LBA addressing.

Since it would still not boot from the device I checked with my BIOS where I noticed that it reported the disk’s translation mode as being “automatic”.

I suspect “automatic” in this consensus likely meant ‘CHS’ and not ‘LBA’, this is why loader(8) failed on the disk.

After changing BIOS disk translation mode to ‘LBA’ it finally worked out.

2 Responses to “FreeBSD’s loader fails with wrong harddisk geometry in BIOS”

  1. Dave Says:

    Thanks for the tip. I was getting the same “can’t load kernal” & “bad disklabel” messages on the device and I changed the bios access mode from “auto” to “lba” and the freenas booted perfectly. Thanks again, you saved me countless hours of frustration.

  2. Frederic Says:

    Thanks for the tip as well. I too was getting “can’t load kernel” on my primary ide harddrive. Boot from cd worked fine. This being the only page on the web mentioning freenas and the above error message, I thought I’d add a comment. Going into the Bios, going to the settings for the primary drive, there should be an access mode setting that has a bunch of options but usually defaults to auto. Having never played with this setting before I was surprised this was neccessary since LBA seems to be expected for modern drives, but whatever the cause switching to LBA fixed the problem.