System failed to boot with messages:
- "Failed to run raid array"
cache_checkis missing/not found
uname -a output:
Linux hostname 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u1 (2017-06-18) x86_64 GNU/Linux
Some kernel modules and binary files were missing in the boot image. They are related to lvmcache if there are LVs backed by dm-cache.
Add required modules dm-cache, dm-raid and raid1, as well as binary files
cache_check in the package thin-provisioning-tools.
- Install the
thin-provisioning-toolspackage:
apt-get install thin-provisioning-tools - Create a script in
/etc/initramfs-tools/hooks/:
and make it executable:#!/bin/sh PREREQ="lvm2" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions copy_exec /usr/sbin/cache_check copy_exec /usr/sbin/cache_repair manual_add_modules raid1 manual_add_modules dm_raid manual_add_modules dm_cache manual_add_modules dm_cache_smqchmod u+x lvm_additionThe script does two things:- Copy
cache_checkandcache_repairand their dynamically linked library into the initramfs. - Add
raid1,dm_raid,dm_cache_smqinto the initramfs.
Note that they are independent to each other.
- Copy
- Run
update-initramfs -uso the required modules and binary files are included in the initramfs.
In case I break the system again, use the Debian Live CD to boot into a working system.
- Use
ip addrandip routeto connect to the Internet. - Mount the original file system,
proc,sysfsanddev, and thenchrootto it.
Some environment variables are likely to be missing. I didn't re-create them and the procedure worked.ROOTFS=/mnt/rootfs make $ROOTFS mount -t ext4 SystemVG/SystemLV $ROOTFS mount -t proc proc $ROOTFS/proc mount -t sysfs sys $ROOTFS/sysfs mount -o bind /dev/ $ROOTFS/dev chroot $ROOTFS - Update the APT repository and install neccessary packages:
apt-get update && apt-get install thin-provisioning-tools lvm2 - Since the script
/etc/initramfs-tools/hooks/lvm_additionexisted so simply runupdate-initramfs
- The program
update-grubwhich update the GRUB bootloader in the/bootpartition may issueError: invalid segments. The error was issued by invokinggrub-probebut the error could not break the system and the booting. So simply ignore it.
- lvmcache
- "Failed to run raid array"