How to chroot from live session to #! on disk
Assumption: #! is installed on /dev/sda1 but is not accessible via grub
Goal: reinstall grub in mbr of /dev/sda:
Here goes:
boot from livecd or usb
in terminal window:
sudo su
TARGET=/media/sda1
mkdir -p $TARGET
mount /dev/sda1 $TARGET
mount --bind /dev $TARGET/dev
mount --bind /dev/pts $TARGET/dev/pts
mount --bind /proc $TARGET/proc
mount --bind /sys $TARGET/sys
cp /etc/resolv.conf $TARGET/etc/
chroot $TARGET /bin/bash
This places you in a root terminal on the #! system
Do whatever you want to do there, e.g. re-install grub
grub-install /dev/sda
update-grub
To exit from chroot:
control-D
This brings you back to where you were in the live session and you can unmount
umount -l $TARGET/dev/pts
umount -l $TARGET/dev
umount -l $TARGET/proc
umount -l $TARGET/sys
Thats it...
Reboot into the #! system on disk.