Recovering When Something Goes Wrong


Compiler errors are not uncommon. If you're running the same source tree that you've had since you installed the system, an error in the compile process (where the compiler fails to complete, usually citing *** Error code 1) is probably the result of some unstable kernel option or device that you've enabled. See whether you can determine which one it is by checking the last few lines of the compiler outputthe text immediately preceding *** Error code 1 indicates errors that terminate the compilation process. Each compiler command line is echoed to the screen, so you should be able to see what component it was trying to compile when the error occurred. If it's not obvious, you can find some guidance by visiting the FreeBSD website (http://www.freebsd.org) and searching the mailing list archives for some of the unique words in whatever compiler errors were generated.

If you've updated your sources since installing your system, it's quite likely (especially if you're tracking -CURRENT or -STABLE) that the code is in an unstable state, and whatever errors you've encountered will probably be corrected within a few days (you'll learn more about updating sources in Chapter 19, "Keeping Up to Date with FreeBSD"). You should be subscribed to the freebsd-current or freebsd-stable mailing lists if you're such a cutting-edge FreeBSD user, and you can get help there (see the FreeBSD website for details on subscribing).

However, there is always the chance your kernel will build cleanly, install cleanly, reboot cleanly, and then explode without warning when it tries to boot. It might fail to mount its filesystems, it might freeze up with a kernel trap error, or it might fail in a way you can't even imagine happening until you see it. If this happens, don't panicthere's an easy way to get out of this predicament.

Reboot the machine and press the appropriate F-key to get to the loader menu. Choose option 6 (Escape to Loader Prompt), and then enter boot /boot/kernel.old (or boot /kernel.old, prior to FreeBSD 5.0) at the prompt, and your previous working kernel will be used.

Keep in mind that if you next try to rebuild the kernel and install it, /boot/kernel.old will get overwritten by the previous kernel you built that was broken. To avoid this, copy kernel.old to some filename that won't get overwritten by any automated process (for instance, /boot/kernel.frank). You can use this kernel to boot from the loader prompt the next time if it happens again.

Another possible problem is that your system boots properly and completely comes up, but system utilities such as ps, top, and w no longer work (they'll report segmentation fault errors or memory size mismatches). If this happens, it's most likely because you're building your kernel from a newer source tree than your system is built from, and the libkvm library has become outdated by your newer kernel.

To get around this, you can rebuild your libkvm library, but that solution is for experts only. If you're brave, you can do this by going to the location of the libkvm code within /usr/src and attempting to make and install it by hand. (You learn about that process in Chapter 19.) A better solution, though, is to always build your kernel from the same sources that your full system is built from, and only build a kernel on updated sources if you're doing a complete make world, as described in the next chapter.




FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net