Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.

Translations of this page?:

ADMIN Restore GRUB2

How to chroot from live session to #! on disk

Assumption 1: #! is installed on /dev/sda1 but is not accessible via grub
Assumption 2: /dev/sda1 is the root partition, and you do not have a separate boot partition
Goal: reinstall grub in mbr of /dev/sda:

Instructions

Boot from livecd or usb, then in the terminal window enter:

TARGET=/media/sda1
sudo mkdir -p $TARGET
sudo mount /dev/sda1 $TARGET
sudo mount --bind /dev     $TARGET/dev
sudo mount --bind /dev/pts $TARGET/dev/pts
sudo mount --bind /proc    $TARGET/proc
sudo mount --bind /sys     $TARGET/sys
sudo 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:

press control-D or enter exit

This brings you back to where you were in the live session and you can unmount

sudo umount -l $TARGET/dev/pts
sudo umount -l $TARGET/dev
sudo umount -l $TARGET/proc
sudo umount -l $TARGET/sys

Thats it…

Reboot into the #! system on disk.

Reference

 
howto/restore_grub2_with_chroot.txt · Last modified: 2012/06/15 14:42 by pidsley
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported

Powered by DokuWiki. Hosted by Linode.
Copyright © 2010 CrunchBang Linux.
Proudly powered by Debian GNU/Linux.
Debian is a registered trademark of Software in the Public Interest, Inc.