Skip to content

Chicken Egg Problem in Linux and Initrd

Category
Linux
What is Checken/Egg Problem.

Chicken/Egg problem occurred in booting process of Linux. A Linux kernel required modules to mount root partition which typically uses ext3 file system, LVM, RAID, etc. All the Linux modules resides in /var/lib/($uname -r) directory but Linux kernel could not access them without mounting it. So the problem was that how Linux kernel access modules required to mount root partition.

How Linux Kernel Get it Solve

The grub boot loader and Linux kernel works together to get solve this problem using Initial Ram Disk ( initrd ), which is part of GRUB specification for a Linux kernel.

An Initial RAM Disk ( initrd ) is specific to particular hardware and software platform. Its created at system install time and include modules which needs to mount file-system.

Recreate initrd file

Some times we required to recreate initrd file. mkinitrd creates an initial ram disk image used by the kernel for preloading the block device modules (such as IDE, SCSI or RAID) which are needed to access the root filesystem.

# mkinitrd -f /boot/initrd-$(uname -r).img $(uname -r)
  • First argument is location of initrd image.
  • Second argument tells the directory name in /var/lib/ which contains modules.

Its also possible to force to add particular module in initrd image file using –with keyword.

#  mkinitrd --with=scsi_mod -f /boot/initrd-$(uname -r).img $(uname -r)

This article is based on RHEL/CentOS 5 Systems. RHEL/CentOS 6 system modules directory is different than 5.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top