Build vanilla linux kernel on CentOS 5

Building a Linux kernel itself is not complicated. In normal case, we just download the latest Linux kernel from, extract the tarball, cd to the kernel source tree, then run a series of command:

tar -xjf linux-
cd linux-
make mrproper
make menuconfig
make -j2 > /dev/null
sudo make modules_install
sudo make install

In order for the newly built kernel to be able to boot successfully, we need to configure it with required driver modules, this includes, but not limited to, filesystem drivers, block device drivers, network device drivers, …etc.

However, when it comes to CentOS/RHEL 5, our normal kernel building procedure may not be able to produce a bootable kernel. We may get this error message followed by the famous kernel panic when we are using LVM on the root filesystem.

Scanning and configuring dmraid supported devices
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  No volume groups found
Activating logical volumes
  Volume group "VolGroup00" not found
Trying to resume from /dev/VolGroup00/LogVol01
Unable to access resume device (/dev/VolGroup00/LogVol01)
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'

The initrd generated by CentOS makes use of some old sysfs features, and the newly built kernel may have that feature disabled. we can reconfigure the kernel to enable it:

General setup->
 [*] enable deprecated sysfs features to support old userspace tools
  │ │    [*]   enabled deprecated sysfs features by default     

Or , manually edit the .config file, add these lines:


then run

make oldconfig

Make and install the kernel again, it should boot successfully.

This entry was posted in System Administration and tagged , , , . Bookmark the permalink.

Leave a Reply