How to Reinstall grub2 Using Mint LiveCD!

LinuxDude101
  7 years ago
  3

This tutorial should work whether or not you have already tried another and received a "failed to get canonical path of /cow" error. These are required steps almost exactly per this tutorial 'Reinstall grub2 from LiveCD' https://community.linuxmint.com/tutorial/view/245

Note: Information below might not apply exactly to a dual boot Windows OS. Seems Windows maybe finicky where grub2 is placed on either mbr sdX, or sdXY??

Follow SECTION ONE if you want or need to use a LiveCD, i.e.: when installing grub2 to an old unsupported Linux Mint version where source.list no longer accesses any updates or if an internet connection is unavailble, and also if you don't have a rescue USB flash drive and an internet connection.

If you have a supported Linux Mint version, internet connection and can boot from a rescue USB flash drive (thumb drive) with any Linux version then you don't need a LiveCD in this case skip to SECTION TWO.


~~~~~~~~~~~~
SECTION ONE
~~~~~~~~~~~~


Load pertinent Mint LiveCD. Use either, Gparted to locate disto partitions, e.g; sdXY (sda1, sda2, etc., sdb1, sdb2, etc.). Or, launch a text command terminal application window.

Enter command: sudo -i (gives 'su' privileges)
Enter command: fdisk -l (lower case "L"), lists all hard drives' sdXY partitions. An asterisk (*) on the list shows which sdXY is Boot partition. Or use Gparted.

Enter command: mount /dev/sdXY /mnt (replace XY with appropriate letter and number)
***Next command is missing from the above aforementioned tutorial***
Enter command: for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done

Enter command: grub-install /dev/sdX (replace X with appropriate letter, it copies grub2 to master boot record (MBR); unless you want or need it on sdXY, use appropriate letter and number). Or, Enter command: grub-install --root-directory=/mnt/ /dev/sdX(Y) (Either way should work, probably will still give ".../cow" error, but hopefully also says; operation has completed.)

Enter command: chroot /mnt (chroot /mnt: change root; moves user from host OS to mounted guest OS root directory)
Enter command: update-grub

Done! Reboot and remove CD. laugh


~~~~~~~~~~~~
SECTION TWO
~~~~~~~~~~~~


Boot up thumb drive OS.

Use either, Gparted to locate disto partitions, e.g.; sdXY (sda1, sda2, etc., sdb1, sdb2, etc.). Or, launch a text command terminal application window.

Enter command: sudo su
Enter command: fdisk -l (lower case "L"), lists all hard drives' sdXY partitions. An asterisk (*) on the list shows which sdXY is Boot partition. Or use Gparted.

Enter command: mount /dev/sdXY /mnt (replace XY with appropriate letter and number)
Enter command: for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
Enter command: cp /mnt/etc/hosts /mnt/etc/hosts.old (these next three are copy commands)
Enter command: cp /etc/hosts /mnt/etc/hosts
Enter command: cp /etc/resolv.conf /mnt/etc/resolv.conf
Enter command: chroot /mnt
Enter command: apt-get purge grub-pc grub-common
You could get an error here as these might not seem to be installed if so just keep answering questions; remove all grub say: yes (use arrow keys to navigate, and enter-key activates selection).

Enter command: apt-get install grub-pc grub-common
Here you will be asked where grub goes, choose the mbr sda or sdb depending on how the first command (or Gparted) shows the hard drive. Use the space key to tick the mbr only (unless you want or need it on sda1, sdb1).

Enter command: update-grub

CTRL-D on keyboard exits chroot, CTRL-D again, exits terminal.

Done! Shutdown, remove thumb drive, and reboot. cool

~~~~~~~~~~~~~~~~~~~~~~
NOTE: Often after restoring from a Linux backup using REDO Backup & Recovery CD, it has been necessary to reinstall grub2. For a tutorial on REDO, bug, and workaround see tutorial:

REDO Backup & Recovery
https://community.linuxmint.com/tutorial/view/2305

~~~~~~~~~~~~~~~~~~~~~~

Comments
vahid-mint 8 years ago

nice one!


jetmint 8 years ago

Thank you! Pictures please :-)


Hammer459 8 years ago

As @lib2know is always praising the useless, I am surprised that he praises this as this is good information. I stand by my suggestion to add a little more explanation for the less tech savvy users.
Unfortunately I am prohibited by my employment contract to publish tutorials and other teaching material.


lib2know 8 years ago

Very good and useful. I wondered more than once if this is possible.
Don't mind the wisenheimer, or just count his tutorials.


Hammer459 8 years ago

This is good information.
You may want to add a little more explanation what the steps are for as this is pretty technical and some more info may give comfy feeling to less experienced.