Grub-2 Repair Post Install

Hello reader,

If you aren’t a Linux user this won’t make much sense to you, but feel free to read along anyway. In most cases when we install 2 or more operating systems and Linux is one of them we opt to install Linux second. This is because it writes the menu at the beginning from which we select the operating system to use.

Grand Unified Boot Loader (Grub for short)

However there are times when we may need to repair the grub, such as following a reinstallation of Windows in a dual boot configuration.

There are several methods of doing this and I’ll list them from simplest to most involved:

  1. Booting into the live installation media of your Linux distribution and running a boot repir program.

Obviously booting in to a Ubuntu or Mint distro typically doesn’t give much room to write programs, however it does allow us with sufficient privileges to correct the bootloader.

sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update sudo apt-get install -y boot-repair && boot-repair

After entering your administrative password you’ll be prompted to select from options which include:

Use Recommended Repair

And after that you should find your bootloader in perfect working order. However for non Ubuntu/Mint users there are 2 more methods which need mentioning.

These were all collected from Linux forums i.e. Ubuntu forums etc and should work great. (Fair credit to the users who posted these!)

  1. Boot from the live CD.
  2. Determine the partition number of your main partition. GParted can help you here. I’m going to assume in this answer that it’s /dev/sda2, but make sure you use the correct partition number for your system!
  3. Mount your partition:
    sudo mount /dev/sda2 /mnt  # make sure that sda2 is correct!
    
  4. Bind mount some other necessary stuff:
    for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
    
  5. chroot into your Ubuntu install:
    sudo chroot /mnt
    
  6. At this point, you’re in your install, not the live CD, and running as root. Update grub:
    update-grub
    

    If you get errors, go to step 7. (Otherwise, it is optional.)

  7. Depending on your situation, you might have to reinstall grub:
    grub-install /dev/sda
    update-grub # I'm not sure if this is necessary, but it doesn't hurt.
    
  8. If everything worked without errors, then you’re all set:
    exit
    sudo reboot
    
  9. At this point, you should be able to boot normally.

If you cannot boot normally, and didn’t do step 7 because there were no error messages, try again with step 7.

  • Sometimes giving GRUB2 the correct configuration for your partitions is not enough, and you must actually install it (or reinstall it) to the Master Boot Record, which step 7 does. Experience helping users in chat has shown that step 7 is sometimes necessary even when no error messages are shown.

This final method involves more

https://wiki.ubuntu.com/Grub2#Recover

First of all, you must start your system from a live cd. Then

METHOD 3 – CHROOT

This method of installation uses the chroot command to gain access to the broken system’s files. Once the chroot command is issued, the LiveCD treats the broken system’s / as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.

1) Boot to the LiveCD Desktop (Ubuntu 9.10 or later). Please note that the Live CD must be the same as the system you are fixing – either 32-bit or 64-bit (if not then the chroot will fail).

2) Open a terminal (Applications > Accessories > Terminal).

3) Determine your normal system partition – (the switch is a lowercase “L”)

sudo fdisk -l

If you aren’t sure, run

df -Th

Look for the correct disk size and ext3 or ext4 format.

4) Mount your normal system partition:

Substitute the correct partition: sda1, sdb5, etc.

sudo mount /dev/sdXX /mnt

Example: sudo mount /dev/sda1 /mnt

5) Only if you have a separate boot partition: sdYY is the /boot partition designation (for example sdb3)

sudo mount /dev/sdYY /mnt/boot

6) Mount the critical virtual filesystems:

sudo mount --bind /dev  /mnt/dev
sudo mount --bind /dev/pts  /mnt/dev/pts
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys  /mnt/sys

7) Chroot into your normal system device:

sudo chroot /mnt

8) If there is no /boot/grub/grub.cfg or it’s not correct, create one using

update-grub

9) Reinstall GRUB 2:

Substitute the correct device – sda, sdb, etc. Do not specify a partition number.

grub-install /dev/sdX

10) Verify the install (use the correct device, for example sda. Do not specify a partition):

sudo grub-install --recheck /dev/sdX

11) Exit chroot: CTRL-D on keyboard

12) Unmount virtual filesystems:

sudo umount /mnt/dev/pts
sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys

13) If you mounted a separate /boot partition:

sudo umount /mnt/boot

14) Unmount the LiveCD’s /usr directory:

sudo umount /mnt/usr

15) Unmount last device:

sudo umount /mnt

16) Reboot.

sudo reboot

#Special thanks to the users who posted these I just wanted
to make them easier to find for my readers!

Spread the love

1,250 thoughts on “Grub-2 Repair Post Install”

  1. Hello there I am so happy I found your website, I really found you by accident, while I was browsing on Google for something else, Anyways I am here now and would just like to say kudos for a incredible post and a all round enjoyable blog (I also love the theme/design), I don’t have time to read through it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read much more, Please do keep up the superb job.

  2. Hi! I know this is somewhat off-topic however I needed to ask. Does running a well-established blog such as yours require a massive amount work? I am brand new to operating a blog however I do write in my journal on a daily basis. I’d like to start a blog so I will be able to share my experience and feelings online. Please let me know if you have any recommendations or tips for brand new aspiring blog owners. Thankyou!

  3. Do you have a spam issue on this site; I also am a blogger, and I was curious about your situation; we have developed some nice practices and we are looking to exchange methods with other folks, please shoot me an email if interested.

  4. This design is incredible! You definitely know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  5. Please let me know if you’re looking for a article writer for your site. You have some really good articles and I feel I would be a good asset. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Many thanks!

  6. Greetings! I’ve been following your site for a long time now and finally got the courage to go ahead and give you a shout out from Humble Tx! Just wanted to mention keep up the fantastic job!

  7. Hi this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

  8. Hello! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one? Thanks a lot!

  9. Hello.This article was really motivating, particularly because I was browsing for thoughts on this matter last week.

  10. Hey there! Quick question that’s totally off topic. Do you know how to make your site mobile friendly? My web site looks weird when browsing from my iphone4. I’m trying to find a template or plugin that might be able to fix this issue. If you have any recommendations, please share. With thanks!

  11. Howdy! This post couldn’t be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this post to him. Fairly certain he will have a good read. Thanks for sharing!

  12. Howdy! Someone in my Facebook group shared this site with us so I came to check it out. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers! Fantastic blog and amazing design and style.

  13. With havin so much written content do you ever run into any issues of plagorism or copyright violation? My website has a lot of exclusive content I’ve either created myself or outsourced but it appears a lot of it is popping it up all over the internet without my permission. Do you know any ways to help reduce content from being stolen? I’d really appreciate it.

  14. My developer is trying to convince me to move to .net from PHP. I have always disliked the idea because of the costs. But he’s tryiong none the less. I’ve been using WordPress on numerous websites for about a year and am nervous about switching to another platform. I have heard good things about blogengine.net. Is there a way I can import all my wordpress content into it? Any kind of help would be greatly appreciated!

  15. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why waste your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

  16. Hey there! I’ve been following your website for a long time now and finally got the courage to go ahead and give you a shout out from Porter Tx! Just wanted to mention keep up the great job!

  17. With havin so much content do you ever run into any problems of plagorism or copyright violation? My website has a lot of exclusive content I’ve either written myself or outsourced but it seems a lot of it is popping it up all over the internet without my authorization. Do you know any methods to help protect against content from being stolen? I’d definitely appreciate it.

  18. Whats up are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and create my own. Do you require any coding expertise to make your own blog? Any help would be greatly appreciated!

  19. Hi there! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one? Thanks a lot!

  20. I really like what you guys are up too. This type of clever work and coverage! Keep up the superb works guys I’ve included you guys to my own blogroll.

  21. I know this if off topic but I’m looking into starting my own weblog and was curious what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very internet savvy so I’m not 100% certain. Any recommendations or advice would be greatly appreciated. Thanks

  22. Good day! I could have sworn I’ve been to this site before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be bookmarking and checking back frequently!

  23. I’m not sure why but this web site is loading very slow for me. Is anyone else having this problem or is it a issue on my end? I’ll check back later and see if the problem still exists.

  24. Sweet blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Cheers

  25. Howdy I am so thrilled I found your site, I really found you by error, while I was browsing on Aol for something else, Anyhow I am here now and would just like to say many thanks for a fantastic post and a all round interesting blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have book-marked it and also added your RSS feeds, so when I have time I will be back to read more, Please do keep up the excellent job.

  26. Admiring the hard work you put into your website and in depth information you present. It’s good to come across a blog every once in a while that isn’t the same old rehashed material. Excellent read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  27. First off I want to say wonderful blog! I had a quick question which I’d like to ask if you do not mind. I was curious to find out how you center yourself and clear your thoughts prior to writing. I have had a hard time clearing my thoughts in getting my ideas out there. I truly do take pleasure in writing but it just seems like the first 10 to 15 minutes are usually wasted just trying to figure out how to begin. Any suggestions or hints? Thank you!

  28. I’m really enjoying the design and layout of your website. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a developer to create your theme? Fantastic work!

  29. Howdy this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!

  30. Howdy! Do you use Twitter? I’d like to follow you if that would be okay. I’m absolutely enjoying your blog and look forward to new posts.

  31. Hey! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

  32. I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to construct my own blog and would like to know where u got this from. thank you

  33. I’m not that much of a online reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your site to come back later. All the best

  34. Hey there! This is my first comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading through your posts. Can you suggest any other blogs/websites/forums that deal with the same subjects? Thanks for your time!

  35. This design is spectacular! You most certainly know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  36. Hello would you mind letting me know which webhost you’re using? I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot faster then most. Can you recommend a good internet hosting provider at a reasonable price? Thank you, I appreciate it!

  37. Hey there! Would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would really appreciate your content. Please let me know. Thank you

  38. Hello, i read your blog occasionally and i own a similar one and i was just curious if you get a lot of spam feedback? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me mad so any assistance is very much appreciated.

  39. Some truly fantastic info , Gladiola I discovered this. “We go where our vision is.” by Joseph Murphy.

    http://sk.uribombu.info

  40. I’m not sure why but this website is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I’ll check back later and see if the problem still exists.

  41. Wow that was strange. I just wrote an very long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say superb blog!

  42. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back in the future. Cheers

  43. Hi! I know this is somewhat off topic but I was wondering if you knew where I could locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!

  44. Hey there! I know this is kinda off topic but I was wondering which blog platform are you using for this website? I’m getting sick and tired of WordPress because I’ve had problems with hackers and I’m looking at alternatives for another platform. I would be fantastic if you could point me in the direction of a good platform.

  45. Incredible! This blog looks just like my old one! It’s on a totally different subject but it has pretty much the same layout and design. Outstanding choice of colors!

  46. Wow! This blog looks just like my old one! It’s on a entirely different subject but it has pretty much the same page layout and design. Wonderful choice of colors!

  47. Thanks for one’s marvelous posting! I actually enjoyed reading it, you’re a great author.I will be sure to bookmark your blog and definitely will come back someday. I want to encourage you to definitely continue your great writing, have a nice afternoon!

Leave a Reply

Your email address will not be published. Required fields are marked *