Reinstall grub2 from LiveCD

cra1g321
  13 years ago
  49

These instructions are based on the instructions from the ubuntu help website - https://help.ubuntu.com/community/Grub2#Reinstalling from LiveCD
Il try and make them easier to understand as when i first saw them it looked a bit complicated. Please dont look at this post thinking its gonna take forever it wont. Just take your time and follow them correctly.

1. Ok 1st thing you want to do is boot into your LiveCD of Mint. (best to use the same version as the one you are running on your computer)Once everything is loaded and your at the mint desktop. Open the Mint Menu and type "Gparted" into the filter text box.When it loads you should see all the partitons that are on the hard drive. Linux Mint partitions will probaly be EXT4 and the windows partitions will probaly be NTFS.

2. Look at the list of partitons and see what one is the Linux Mint partiton.You can tell this by looking at the Mount Points of the partitons. You should see one with a "/" under Mount Point and its File system will likely be EXT4. When you have located this partition look to the left and see what it is called. For example mine is called dev/sda6 (yours may be something different like dev/sda1 etc)Now that you know what partition is the Linux Mint partition, just leave gparted open so you can look back at it again incase you forget. Now open up a Terminal by clicking the Mint menu then clicking "Terminal" under System.
Now we need to mount the Linux Mint partition so that we are able to use it (access it) . To do this copy and paste this code into the terminal sudo mount /dev/sdXY /mnt
You will need to change the XY part of the code to match the name of your Linux Mint partition. For example my mint partition is dev/sda6 so i would change the code to - sudo mount /dev/sda6 /mnt

Now that you edited the line of code to match your mint partiton, go ahead and press Enter on your keyboard then type in your password if your asked for it then press Enter again.(When your entering in your password you will not see any characters, letters numbers etc). It may look as if nothing has happened, but your Linux Mint partition will now be mounted. The terminal will display nothing after the $ sign like it did when you 1st open it.

3. Now we need to tell the computer to reinstall grub2 to the Linux Mint partition we just mounted. To do this copy and paste this line of code into the terminal sudo grub-install --root-directory=/mnt/ /dev/sdX
Again you will need to change this line of code to match your Linux Mint partition. Change the "X" at the end to match your mint partiton. My partition is dev/sda6 so i will change the the line of code to - sudo grub-install --root-directory=/mnt/ /dev/sda
It is IMPORTANT that you do not enter any number just the letters of the partitions.
When you have edited the line of code press Enter on your keyboard. You should then see a message saying Grub installer finished or something like that. Now close the terminal and gparted and reboot your pc/laptop without the livecd in the disc drive. To restart click the mint menu then click "Quit" then "Reboot".

*Note after you reboot you should see the grub2 menu you had before you installed/repaired windows. You may need to refresh (update) this menu so that it detects the new windows partition.
This can easily be done by logging into your Linux Mint, opening a Terminal then copying and pasting sudo update-grub then press Enter then enter your password then hit Enter again. You will then see it detecting all the bootable partitons on the Hard drive. When you it displays 'Done', reboot again and you should be able to boot into windows again.

I know this isn't the best tutorial for reinstalling grub but i hope it helps someone.

Comments
persistantsinger 6 years ago

Not the best tutorial! Rubbish! I stumbled across this information after 4 hours of frustration. What can I say? It Works!

Thank you cra1g321


LinuxDude101 7 years ago

ONCE UPON A TIME—

If you receive "failed to get canonical path of /cow" error(s). These are required steps. Almost exactly per above tutorial. Note: Information below might not apply exactly to a dual boot system involving Windows OS.

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

Enter command: sudo -i (gives 'su' privilege).
Enter command: fdisk -l (lower case "L"), lists all hard drive(s) sdXY partitions. Should show on the list an asterisk (*) showing which sdXY is Boot partition(s).

Enter command: mount /dev/sdXY /mnt (replace XY with appropriate letter and number)
***Important*** Next command what's missing in the above 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, copies grub2 to MBR; master boot record, 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 finished or completed.)

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

Done! Reboot and remove CD.

—THE END


AndersBrontosaurus 8 years ago

Doesn't work for me. I get an errormessage. It tries to install some i386. I'm on amd64. Debian Betsy, lmde 2.
If anyone has a suggestion I'll be happy. ☺
Hopefully boot-repair can sort me out otherwise.


MagicMint 8 years ago

To put things into the right order, both options --boot-directory and --root-directory accomplish the same, although only the former is mentioned by the man page of grub-install v2.02 ;-)


kubulai 8 years ago

That fdisk -l is fdisk dash lower case L (elle)

Also, the link I provided has a screen cut of me doing it in terminal.


kubulai 8 years ago

I took this an ran with it today on MINT 17. Made a couple changes because I am a grouchy old guy and I'm irascible and lazy. Documented it here http://jdnash.com/2015/10/grub-re-install-after-windows/

shell to root su -
fdisk -l
note the linux partition, eg /dev/sda4
then do as you said above
mount /dev/sda4 /mnt
grub-install --root-directory=/mnt/ /dev/sda

Worked as you said. No problems. October 2015


MagicMint 8 years ago

grub-install has no “--root-directory” option anymore, so this will no more work either!


black_rambo 9 years ago

Thank you kind sir


sdibaja 9 years ago

another method that works 99% of the time:

1. insert live dvd or usb
2. boot from that disk
3. once in live environment, open a terminal and enter:
Code:

sudo grub-install /dev/sda
sudo update-grub

4. reboot as normal (remove live dvd/usb)
you will now see boot screen with available OS!


Cypress 9 years ago

Excellent.
thanks.


jannas007 9 years ago

Worked 100% for me after upgrading ( fresh install ) from Mint 15 to 17 - thanks!!!


HerrDierk 9 years ago

Great tutorial. No need to panic because this solved it al. I had "failed to get canonical path of /cow" error , but everything seems to work. Thanks !


oledawg 10 years ago

Thanks for your efforts to help those of us who desperately need assistance.
I must regretfully say I have found that many of the tutorials here, while always helpful to those of us who know little to nothing of these matters, that sooner or later, with each new distro version, they become worth less and less, until they are finally out of date.

Unfortunately, while I learned a lot from your tutorial, it didn't help me solve my particular problem.
I needed a tutorial for Mint 15 or later, and upon re-reading, I noticed this tutorial was written three years ago.

There have been major changes to Mint in the interim, and in my case they have impacted my problem greatly due to the incorporation of kernel encryption.

Don't think I am complaining though, encryption is one of the main reasons I chose to use this outstanding distro, another reason being the tremendous assistance afforded to others, like me, who are beginners with Linux.

For instance, with Mint 15 and 16, Gparted and GRUB2 no longer are installed by default when one chooses to encrypt their root directory, though they may still be installed if one decides to use them.

But now there is a definite need for an updated tutorial for maintaining the encrypted boot partition.
Unfortunately I am definitely not qualified to undertake that task.

I am fortunate to have made a separate backup of my system disk, using a Windoze utility no less, because otherwise I would have to start from scratch.
My backup will but me back a little over a month, but at least I will save the major effort I have put into VirtualBox that would have otherwise been lost.

Again, thank you and if I may be so bold to ask, could you spare a little more of your time and effort for an updated version?
Sorry, but I just had to give it a try.


jahid_0903014 10 years ago

nice tutorial


milan0markovic 10 years ago

@janochek  i got the same error but the grub was updated anyway.


janochek 10 years ago

Nice tutorial, simple and well explained, you don't need a PHD to understand this unlike most tutorials on the web.
I think this will help a lot of people, unfortunately not me, I got an error "grub-probe: error: failed to get canonical path of /cow.".
I will have to look further and hope to find a well explained solution for my problem. I bought a new HP pavilion with preinstalled Windows 8, have no problems to boot and work from the live DVD of MINT 15, had no problems installing MINT, but it won't boot, only windows.


cra1g321 10 years ago

Apologies for not helping out with the comments/replies.

I wrote this 2 years ago, back when LM was my main OS.


nathav63 10 years ago

Crankshaft, he means to use the menu in the lower left corner, and search for Gparted. I think that Gparted may have been included with previous distributions of mint (don't quote me), but now you would have to open Software Manager and install it. You can also find the same info in a program called Disks, which does come pre-installed with Mint 15.


user213 11 years ago

I have look ALL over the place for how to do this, almost gave up until I found this! Thank you very much!


miraceti 11 years ago

Excellent tutorial, you just saved my data after my heat sink got lose and the crash damaged grub!

Thank you :D


harry655 11 years ago

very good


yoyology 11 years ago

Excellent tutorial. Got me through when the Install Linux Mint application failed to produce a bootable machine.


WebAvenger 11 years ago

I get this error:

mint@mint ~/Desktop $ sudo grub-install --root-directory=/mnt/ /dev/mapper/isw_eaajiabbia_M17X_RAID0p5
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
/usr/sbin/grub-setup: warn: Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea..
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: will not proceed with blocklists.


Thinker 11 years ago

Simple and Best Explaination.


abdoo47 12 years ago

Very useful , thank you.


sayan_acharjee 12 years ago

@pintyoo33, Try CHROOT method from the link below:
https://help.ubuntu.com/community/Grub2#Reinstalling GRUB 2


pintyoo33 12 years ago

Hi guys! The tutorial is clear, and usefull! Need to thank, but I got some mistake. I followed your steppes, but I got an error message.
mint@mint ~ $ sudo mount /dev/sda2 /mnt
mint@mint ~ $ sudo grub-install --root-directory=/mnt/ /dev/sda
grub-probe: error: cannot find a device for /boot (is /dev mounted?).
/usr/sbin/grub-setup: warn: Sector 32 is already in use by FlexNet; avoiding it. This software may cause boot or other problems in future. Please ask its authors not to store data in the boot track.
Installation finished. No error reported.

Can sbd help me to solve this problem? :|


caribriz 12 years ago

Thanks for this great tutorial. Easy to follow steps in newbie language. Made a daunting task easy for a first-timer.


antioch 12 years ago

This saved me from submitting a problem and waiting for a solution.

This repair tutorial is just what I needed, exactly when I needed it.

Thank you.


tomapio 12 years ago

Thank you!.


sdim 12 years ago

Very useful.


cra1g321 12 years ago

Glad to hear it helped you, groucho1989


groucho1989 12 years ago

Worked first time to recover grub menu lost after installing PCLinux OS as a 2nd OS to Mint11. Thank you.


cra1g321 12 years ago

Im no linux expert, so im not completely sure what the error means. The grub-probe is the tool im assuming used for detecting what OS exist on the computer. The error is 'Cannot find a device for /boot' which i think means that it can't find a partition that is used for /boot, but i think dont think this makes any difference because ubuntu/linux mint and most distros dont actually create a /boot partition during installation, only one i know which does off the top of my head is Arch Linux.
So i dont think its error to be worrying about, its more just a notification rather than a error IMO.


cordoba57 12 years ago

I will add my "thank you" for this tutorial.

However, I too received the error message:

/usr/sbin/grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Install successful. No errors were reported

What's the source of the error, and is it safe to ignore? My system booted fine.

k


cra1g321 12 years ago

Glad it helped you Rikstation :)


Rikstation 12 years ago

Very well written for newbies, The main things i was looking for were easy to find when scanning the page as they were in bold.
Promoted, Many thanks


noztox 12 years ago

@sayan_acharjee +1 ;)


Alexio 13 years ago

A really easy to use Live CD that fixes the GNU GRUB in seconds is Rescatux:
1. Download the ISO, burn it onto a CD or create a bootable USB stick.
2. Boot the Live CD/USB and a nice wizard named Rescapp will guide you through your rescue tasks: just choose "Restore GRUB / Fix Linux Boot" to restore the GRUB.
3. Run "update-grub", then restart your computer.

Currently Rescatux only restores GRUB to the MBR, but more features should be available in the next versions.


sayan_acharjee 13 years ago

This did not work in my case, the grub-install command gave this error:
grub-probe: error: cannot find a device for /boot (is /dev mounted?).

Then I tried Method 3 of the tutorial below by using CHROOT, then only it worked.
https://help.ubuntu.com/community/Grub2#Reinstalling GRUB 2


MestreLion 13 years ago

Very nice tutorial! I already knew all the info in here, but man, it took a looong time to figure out... my life would be MUCH easier if I met this tutorial before. "sudo grub-install --root-directory=/mount/LABEL /dev/sdX" is really a life-saver command.

A few comments, hints and questions:
- Maybe for begginers step #1 and #2 would be easier if replaced by something like:

"Open Nautilus (Menu -> Computer), find your Linux/Mint partition (something like "xx GB Filesystem on xxx GB Hard Drive") and double-click it. That will mount it. Now mouseover the recently mounted partition and write down the mount point (something like /media/XXXX)"

That avoids using several programs (including the newbie-dangerous gParted), and its 100% GUI. It only needs Nautilus


- Why do i always get a mysterious error when i use install-grub from a LiveCD? The output is something like this:

$ sudo grub-install --root-directory=/mount/LINUX /dev/sda
/usr/sbin/grub-probe: error: cannot find a device for /boot (is /dev mounted?).
Install successful. No errors were reported

It does work, and my grub is restored, as if actually no errors had happen. So i usually just ignore that message... but always wondered what does that mean. It only happen when using a LiveCD. Using Mint 10 here (both Live and in LINUX partition. Any clue?


cra1g321 13 years ago

OMG i saved someones life ;)

Glad to hear it helped you.


romanybob 13 years ago

Perfect, saved my life ;)


cra1g321 13 years ago

Plz vote if everything works fine for you ;)


sayan_acharjee 13 years ago

Hi,
I am going to try this and will let you know the result here, but its look quite useful. :D


hasuin 13 years ago

Very useful. Thank you!


JustJames 13 years ago

I like the tutorial, but it might also help to have an addendum for those poor souls like myself that made their lives more complicated by putting linux on an entirely different hdd.


cra1g321 13 years ago

Plz leave a reply if you voted, so i can say thanks :)


cra1g321 13 years ago

really surprised no one has made a tutorial on how to do this. This week I will be condensing this tutorial and my other tutorial (removing windows 7 from dual boot) so that they are clearer to read and understand.