2250 shaares
7 private links
7 private links
1 result
tagged
chroot
chroot made easy in 2 commands
Assuming the normal system partition(s) are on a software RAID (otherwise skip this step): make sure the mdadm tools are installed in the Live CD environment (e.g. by executing sudo apt-get install mdadm). Then assemble the arrays:
sudo mdadm --assemble --scan
If using LVM:
sudo sh -ec "apt-get install lvm2; vgchange -ay"
If using bcache:
sudo sh -ec "apt-get install software-properties-common; add-apt-repository ppa:g2p/storage; apt-get update; apt-get install bcache-tools"
Determine your normal system partition. The following commands may be helpful. The fdisk switch is a lowercase "L".
sudo fdisk -l
sudo blkid
df -Th
Mount your normal system partition. X is the drive letter. Y is the partition number:
Substitute the correct partition: sda1, sdb5, etc.
sudo mount /dev/sdXY /mnt
Example 1: sudo mount /dev/sda1 /mnt
Example 2: sudo mount /dev/md1 /mnt
Only if you have a separate boot partition (where sdXY is the /boot partition designation):
sudo mount /dev/sdXY /mnt/boot
Example 1: sudo mount /dev/sdb6 /mnt/boot
Example 2: sudo mount /dev/md0 /mnt/boot
Only if (some) of the system partitions are on a software RAID (otherwise skip this step): make sure the output of mdadm --examine --scan agrees with the array definitions in /etc/mdadm/mdadm.conf.
Mount the critical virtual filesystems. Run the following as a single command:
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt/$i; done
Chroot into your normal system device:
sudo chroot /mnt
Reinstall GRUB 2 (substitute the correct device with sda, sdb, etc. Do not specify a partition number):
grub-install /dev/sdX
If the system partitions are on a software RAID install GRUB 2 on all disks in the RAID. Example (software RAID using /dev/sda and /dev/sdb):
grub-install /dev/sda
grub-install /dev/sdb
Recreate the GRUB 2 menu file (grub.cfg)
update-grub
Exit chroot: CTRL-D on keyboard
Reboot.