7 Some pitfalls

Contents of this section

7.1 make clean

If your new kernel does really weird things (it's happened to me), chances are you forgot to make clean. Symptoms can be anything from your kernel outright crashing, to strange I/O problems, to crummy performance. Make sure you do a make dep, too.

7.2 Huge or slow kernels

If your kernel is sucking up a lot of memory, or is getting really big, or really takes forever to compile even when you've got your new 486DX6/440 working on it, you've probably got lots of unneeded stuff (device drivers, filesystems, etc) configured. If you don't use it, don't configure it, because it does take up memory. If you've got less than 16 megs, make sure that you say yes to ``limit memory to low 16MB;'' it makes a lot of difference (especially on a 4MB system). The most obvious symptom of bloat is extreme swapping in and out of memory to disk. If your disk is making a lot of noise, look over your kernel configuration.

You can find out how much memory the kernel is using by taking the total amount of memory in your machine and subtracting it from the amount of ``total mem'' in /proc/meminfo or the output of the command ``free.'' You can also find out by doing a ``dmesg'' (or by looking at the kernel log file, wherever it is on your system). There will be a line that looks like this:

Memory: 15124k/16384k available (552k kernel code, 384k reserved, 324k data)

My 386 (which has slightly less junk configured) says this:

Memory: 7000k/8192k available (496k kernel code, 384k reserved, 312k data)

7.3 Kernel doesn't compile

If it doesn't compile, then a patch has probably failed, or you got corrupted sources from somewhere. Your version of gcc also might not be correct, or could be messed up. Make sure that the symlinks which Linus describes in the README are right. In general, if a kernel doesn't compile, something is seriously wrong.

7.4 New version of the kernel doesn't seem to boot

LILO either wasn't run, or isn't configured correctly. One thing that ``got'' me once was a problem in the config file. I had ``boot = /dev/hda1'' instead of ``boot = /dev/hda'' (This can be really annoying at first, but once you've got a working config file, you shouldn't need to change it.).

7.5 You forgot to run LILO, or system doesn't boot at all

Ooops! The best thing you can do here is to boot off of a floppy disk and prepare another bootable floppy (like ``make zdisk'' would do). You need to know where your root (/) partition is and what type it is (second extended, minix, etc). In the example below, you also need to know what partition your /usr/src/linux source tree is on, its type, and where it is normally mounted.

In the example, the / is /dev/hda1, and the partition which holds /usr/src/linux is /dev/hda3, normally mounted at /usr. They are both second extended filesystems. The working kernel image in /usr/src/linux is called zImage.

The idea is that if there was a working kernel image in /usr/src/linux called zImage, it is possible to use that for the new floppy. Another alternative, which may or may not work better (it depends on the particular method in which you messed up your system) is discussed after the example.

First, boot from a boot/root disk or rescue disk, and then mount the partition that there was a working kernel image on:

mkdir /mnt
mount -t ext2 /dev/hda3 /mnt

If mkdir tells you that the directory already exists, just ignore it. Now, cd to the place where the working kernel image was (Note: /mnt + /usr/src/linux - /usr = /mnt/src/linux). Put a formatted disk in drive a: (make sure it's not your boot or root disk!), dump the image to the disk, and configure for your root partition:

cd /mnt/src/linux
dd if=zImage of=/dev/fd0
rdev /dev/fd0 /dev/hda1

cd to / and unmount the normal /usr partition:

cd /
umount /mnt

You should now be able to reboot your system as normal from this floppy. Don't forget to run lilo (or whatever it was that you did wrong) after the reboot!

As mentioned above, there is another very common alternative. If you happened to have a working kernel image in / (/vmlinuz for example), you can use that as well. Supposing all of the above conditions, and that my kernel image is /vmlinuz, just make these alterations to the example above: change /dev/hda3 to /dev/hda1 (the / partition), /mnt/src/linux to /mnt, and if=zImage to if=vmlinuz. The little note explaining how to derive /mnt/src/linux may be ignored.

7.6 It says ``warning: bdflush not running''

This can be a pretty severe problem. Starting with a kernel release after 1.0 (I can't remember which, exactly, but it was around 20 Apr 1994), a program called ``update'' which periodically flushes out the filesystem buffers was upgraded/replaced. Get the sources to ``bdflush'' (you should find it where you got your kernel), and compile it (You will probably want to run under the old kernel while compiling and installing). It will install itself as ``update'' and you should be fine with the new kernel after that.

7.7 It says weird things about obsolete routing requests

Get new versions of the route program and/or recompile the old stuff. /usr/include/linux/route.h (which is actually a file in /usr/src/linux) has changed.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter