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

697 thoughts on “Grub-2 Repair Post Install”

  1. My partner and I stumbled over here coming from a different web page and thought I may as well check things out. I like what I see so now i’m following you. Look forward to checking out your web page repeatedly.

  2. Howdy I am so delighted I found your website, I really found you by error, while I was researching on Askjeeve 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 look over 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 excellent job.

  3. Hello are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you need any html coding expertise to make your own blog? Any help would be greatly appreciated!

  4. I am really enjoying the theme/design of your web site. Do you ever run into any browser compatibility issues? A few of my blog visitors have complained about my site not operating correctly in Explorer but looks great in Chrome. Do you have any tips to help fix this issue?

  5. Heya are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you need any coding knowledge to make your own blog? Any help would be greatly appreciated!

  6. Outstanding post however , I was wondering if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit further. Appreciate it!

  7. Admiring the commitment you put into your blog and in depth information you offer. It’s awesome to come across a blog every once in a while that isn’t the same outdated rehashed information. Excellent read! I’ve saved your site and I’m including your RSS feeds to my Google account.

  8. Howdy! Someone in my Myspace group shared this website with us so I came to check it out. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Wonderful blog and wonderful design and style.

  9. I don’t know whether it’s just me or if perhaps everyone else encountering problems with your website. It appears as if some of the text on your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This could be a issue with my browser because I’ve had this happen previously. Kudos

  10. Heya this is kinda 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 knowledge so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

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

  12. Do you have a spam issue on this blog; I also am a blogger, and I was wondering your situation; many of us have developed some nice methods and we are looking to swap methods with other folks, be sure to shoot me an e-mail if interested.

  13. Hello! I realize this is kind of off-topic but I had to ask. Does managing a well-established website like yours require a lot of work? I am completely new to operating a blog but I do write in my diary every day. I’d like to start a blog so I can easily share my personal experience and thoughts online. Please let me know if you have any ideas or tips for brand new aspiring bloggers. Appreciate it!

  14. I’m really loving the theme/design of your site. Do you ever run into any internet browser compatibility issues? A number of my blog readers have complained about my website not working correctly in Explorer but looks great in Opera. Do you have any solutions to help fix this issue?

  15. Hi! Someone in my Myspace group shared this website with us so I came to give it a look. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Great blog and excellent design.

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

  17. Hey there! I realize this is sort of off-topic but I had to ask. Does operating a well-established blog such as yours require a lot of work? I’m completely new to operating a blog but I do write in my diary everyday. I’d like to start a blog so I will be able to share my own experience and views online. Please let me know if you have any recommendations or tips for new aspiring blog owners. Appreciate it!

  18. Does your site have a contact page? I’m having a tough time locating it but, I’d like to shoot you an e-mail. I’ve got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it expand over time.

  19. I am curious to find out what blog system you have been using? I’m having some minor security problems with my latest blog and I would like to find something more secure. Do you have any suggestions?

  20. Wonderful website you have here but I was curious about if you knew of any user discussion forums that cover the same topics talked about in this article? I’d really love to be a part of online community where I can get comments from other experienced individuals that share the same interest. If you have any suggestions, please let me know. Cheers!

  21. Everyone loves what you guys tend to be up too. This sort of clever work and reporting! Keep up the great works guys I’ve added you guys to my blogroll.

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

  23. Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s challenging to get that “perfect balance” between superb usability and visual appearance. I must say you’ve done a fantastic job with this. Additionally, the blog loads extremely fast for me on Internet explorer. Superb Blog!

  24. Neat blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog shine. Please let me know where you got your design. Thanks a lot

  25. Hmm it looks like your blog ate my first comment (it was extremely long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I too am an aspiring blog blogger but I’m still new to the whole thing. Do you have any points for beginner blog writers? I’d really appreciate it.

  26. Hello there! I could have sworn I’ve been to this site before but after checking through some of the post I realized it’s new to me. Anyways, I’m definitely glad I found it and I’ll be book-marking and checking back often!

  27. Admiring the hard work you put into your site and detailed information you provide. It’s nice to come across a blog every once in a while that isn’t the same outdated rehashed information. Excellent read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  28. Hi there! I’m at work browsing your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the great work!

  29. Hey! Would you mind if I share your blog with my zynga group? There’s a lot of people that I think would really enjoy your content. Please let me know. Many thanks

  30. I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to create my own blog and would like to find out where u got this from. appreciate it

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

  32. Hi I am so happy I found your webpage, I really found you by accident, while I was looking on Askjeeve for something else, Regardless I am here now and would just like to say kudos for a tremendous post and a all round entertaining blog (I also love the theme/design), I don’t have time to look over it all at the moment but I have saved it and also included your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the great work.

  33. Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s hard to get that “perfect balance” between superb usability and appearance. I must say you have done a fantastic job with this. In addition, the blog loads very fast for me on Opera. Exceptional Blog!

  34. Wonderful blog! I found it while searching on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it

  35. Hi there! Do you use Twitter? I’d like to follow you if that would be okay. I’m undoubtedly enjoying your blog and look forward to new posts.

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

  37. Thanks for the marvelous posting! I certainly enjoyed reading it, you can be a great author.I will be sure to bookmark your blog and will often come back in the foreseeable future. I want to encourage you to definitely continue your great writing, have a nice day!

  38. It’s a shame you don’t have a donate button! I’d without a doubt donate to this fantastic blog! I guess for now i’ll settle for bookmarking and adding your RSS feed to my Google account. I look forward to fresh updates and will talk about this blog with my Facebook group. Talk soon!

  39. Sweet blog! I found it while browsing 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

  40. I do not know if it’s just me or if everyone else encountering problems with your website. It appears as if some of the text on your posts are running off the screen. Can somebody else please provide feedback and let me know if this is happening to them as well? This could be a problem with my web browser because I’ve had this happen previously. Appreciate it

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

  42. Appreciating the time and effort you put into your site and detailed information you offer. It’s good to come across a blog every once in a while that isn’t the same old rehashed material. Great read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.

  43. Have you ever considered creating an ebook or guest authoring on other blogs? I have a blog centered on the same information you discuss and would really like to have you share some stories/information. I know my visitors would value your work. If you’re even remotely interested, feel free to send me an email.

  44. I don’t know if it’s just me or if perhaps everyone else experiencing issues with your website. It looks like some of the written text on your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This may be a problem with my web browser because I’ve had this happen previously. Cheers

  45. Oh my goodness! an incredible article dude. Thanks However I am experiencing challenge with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting identical rss downside? Anybody who knows kindly respond. Thnkx

    http://www.target.com/s/portable+blu+ray+player

Leave a Reply

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