How to recover from an initramfs shell

From OverthereWiki
Jump to navigationJump to search


An initramfs is used during the boot process on modern Linux distributions to load the necessary kernel modules and initialize software RAID, LVM, or systems necessary to mount the / filesystem.

The initramfs consists of a gzip compressed cpio archive of the files that is loaded off the disk by the boot loader using BIOS routines and extracted into a tmpfs by the kernel. Ideally the scripts in the initramfs will run and mount the root filesystem on /root, then remove the files in the tmpfs freeing the memory for later use by user applications and pivot the /root filesystem to /.

If the initramfs shell prompt appears, the administrator needs mount the root filesystem on /root and exit from the shell, then the initramfs remove the files and pivot the root filesystem from /root to /.


Here are some things to check:

  • Are the expected drives and partitions listed in /dev/?
    • If not, try loading the appropriate kernel modules (if present in initrd)
  • If using a software RAID, are the software RAIDs assembled and listed in /proc/mdstat?
    • If not, use mdadm to assemble the RAID:
      mdadm -A /dev/md0 /dev/sda1 /dev/sdb1
  • If using LVM, are the physical volumes accessible?
    lvm pvs
  • If using LVM, have the logical volumes been registered with device mapper? Check for the logical volumes in /dev/mapper/
    • If not, activate the logical volumes with
      lvm vgchange -a y

Continue Boot Process

  1. Mount the root filesystem under /root:
    mount /path/to/root/dev /root
  2. Exit the initrd shell: