#!/bin/sh # # mount device # DEVPATH="$(rootdev -s | awk '{ print substr($0, 0, length-1) }')7" mkdir -p /tmp/a umount /tmp/a >/dev/null 2>&1 mount "${DEVPATH}" /tmp/a mount -o bind /proc /tmp/a/proc mount -o bind /dev /tmp/a/dev mount -o bind /dev/pts /tmp/a/dev/pts mount -o bind /sys /tmp/a/sys mount -o bind /run /tmp/a/run ## then chroot --groups=0 /tmp/a /bin/bash