Why do I get a ``panic: can't mount root'' error when rebooting the system after installation?

This error comes from confusion between the boot block's and the kernel's understanding of the disk devices. The error usually manifests on two-disk IDE systems, with the hard disks arranged as the master or single device on separate IDE controllers, with FreeBSD installed on the secondary IDE controller. The boot blocks think the system is installed on wd1 (the second BIOS disk) while the kernel assigns the first disk on the secondary controller device wd2. After the device probing, the kernel tries to mount what the boot blocks think is the boot disk, wd1, while it is really wd2, and fails.

To fix the problem, do one of the following:

  1. For FreeBSD 3.3 and later, reboot the system and hit Enter at the Booting kernel in 10 seconds; hit [Enter] to interrupt prompt. This will drop you into the boot loader.

    Then type set root_disk_unit="disk_number" . disk_number will be 0 if FreeBSD is installed on the master drive on the first IDE controller, 1 if it is installed on the slave on the first IDE controller, 2 if it is installed on the master of the second IDE controller, and 3 if it is installed on the slave of the second IDE controller.

    Then type boot, and your system should boot correctly.

    To make this change permanent (ie so you do not have to do this every time you reboot or turn on your FreeBSD machine), put the line root_disk_unit="disk_number" in /boot/loader.conf.local .

  2. If using FreeBSD 3.2 or earlier, at the Boot: prompt, enter 1:wd(2,a)kernel and press Enter. If the system starts, then run the command echo "1:wd(2,a)kernel" > /boot.config to make it the default boot string.

  3. Move the FreeBSD disk onto the primary IDE controller, so the hard disks are consecutive.

  4. Rebuild your kernel, modify the wd configuration lines to read:

        controller      wdc0    at isa? port "IO_WD1" bio irq 14 vector wdintr
        disk            wd0     at wdc0 drive 0
        # disk            wd1     at wdc0 drive 1 # comment out this line
        
        controller      wdc1    at isa? port "IO_WD2" bio irq 15 vector wdintr
        disk            wd1     at wdc1 drive 0 # change from wd2 to wd1
        disk            wd2     at wdc1 drive 1 # change from wd3 to wd2
    

    Install the new kernel. If you moved your disks and wish to restore the previous configuration, replace the disks in the desired configuration and reboot. Your system should boot successfully.



UNIXguide.net
Suggest a Site