#!/bin/busybox sh rescue_shell() { echo "Something went wrong. Dropping you to a shell" busybox --install -s exec /bin/sh } # Mount filesystems mount -t devtmpfs none /dev || rescue_shell mount -t proc none /proc || rescue_shell mount -t sysfs none /sys || rescue_shell echo 0 > /proc/sys/kernel/printk # Unlock luks device cryptsetup -T 5 luksOpen /dev/sdb3 lukssdb3 || rescue_shell # Create LVM nodes /dev/main/root etc lvm vgscan --mknodes || rescue_shell lvm lvchange -a ly main/root || rescue_shell lvm lvchange -a ly main/home || rescue_shell lvm lvchange -a ly main/swap || rescue_shell lvm vgscan --mknodes || rescue_shell # Mount root fs mount -o ro /dev/main/root /mnt/root || rescue_shell # Unmount filesystems unmount /dev # Boot system exec switch_root /mnt/root /sbin/init