You probably know this. But I didn’t, and it took me a lot of swearing and cursing and poking about in murky areas of the Internet and my own file system to discover what was up with it.
Debian has always had a nice system for compiling kernels: from pristine kernel.org source, you can produce a .deb package, which you can install as normal. Easy. And safe, because no third party has had a chance to muck with it: the source you downloaded came straight from Linus himself.
Only this time, booting stalled with the dreaded Kernel Panic: VFS: Unable to mount root fs on unknown-block error. So what did I do wrong?
In the past, anything that was needed for booting the system from scratch was compiled hard into the kernel. But nowadays, everything is in modules. When the bootloader uncompresses the kernel, it also creates an initial ram disk; and the essential modules are then loaded from there.
I had not created the necessary initial ramdisk image. So I did # make-kpkg clean and repeated the process, this time with --initrd in my make-kpkg command, and re-installed the new kernel. Unfortunately, dpkg missed a trick. There was already an entry in /etc/lilo.conf for the new kernel, but the initrd= line was commented out. That was what threw me.
If you are getting “unable to mount root fs” with a new kernel, and noticeably fewer dots appear when booting the “new” kernel than the “old” one, then your problem is almost certainly the initial ram disk image not being loaded.
# cd /usr/srcEnable any new features you want or need.
# tar xjf linux-2.6.24-4.bz2
# ln -s -f linux-2.6.24-4 linux
# cd linux
# zcat /proc/config.gz > .config
# make menuconfig
# make-kpkg --initrd --append-to-version allmine kernel-image(replace “allmine” with whatever you like. Now go and brew up, skin up, take a dump, walk the dog, meditate or whatever you usually do while compiling a kernel.)
# cd ..There should now be a new .deb file with your kernel image!
# dpkg -i linux-image-18.104.22.168ajs1_22.214.171.124allmine-10.00.Custom_amd64.deb
Now make sure there is an initrd=/initrd.img entry in /etc/lilo.conf (and that it is pointing to the correct place: /initrd.img should be a symbolic link to /boot/initrd.img-126.96.36.199allmine) . Important: If you changed this file, you must run /sbin/lilo to rebuild the bootloader.