Using FreeBSD kernel from bootonly CD for last resort recovery

Posted by: admin  :  Category: FreeBSD

You accidentally deleted your production kernel?
Both your new and backup kernel are trash?

No worries. You could always use a FreeBSD setup or bootonly CD to load a fallback kernel from there.

It’s fairly easy to do so.

Just hit ‘6’ while in the beastie menu to enter the boot loader prompt.
Depending on your platform or installation, a plain “Hit [Enter] to boot immediatly…” prompt might be shown alternatively. Just press any key to enter boot loader prompt at this stage.

On the boot loader prompt, which shows up using the plain words ‘OK’ at the beginning of each line, enter this command:

OK set vfs.root.mountfrom=ufs:/dev/ad0s1a

This will force the kernel from the CD to use the root file system from the given location.
Replace the device name as required to match your system.

Then boot the system into single user mode like this:

OK boot -s

This should boot into your system useing the kernel from the CD-ROM.

If everything went smothely you will end up with a prompt like this:

[output omitted]
Mounting root from ufs:/dev/ad0s1a
Enter full pathname of shellor RETURN for /bin/sh:

Congratulations. You are now ready to go cleaning up your mess 😉

Comments are closed.