14

I messed up my new laptop while trying to set up a dual-boot with Ubuntu and Windows 8.I did a whole bunch of stuff trying to get it to work and now when I try to boot I get stuck in GRUB's recovery mode with no errors.

My question is: Can I boot from Ubuntu on a USB drive to erase both Windows 8 and Ubuntu to just install Ubuntu? Will this get ride of the GRUB rescue mode problem.

0

4 Answers 4

37

Don't bother to run Ubuntu live CD. It's not difficult to repair GRUB from the rescue mode.

  1. Command: ls

    It will list all your drives and partitions, like:

    (hd0) (hd0,msdos2) (hd0,msdos1)
    
  2. If you don't know your Ubuntu boot partition, check them one by one:

    ls (hd0,msdos2)/
    ls (hd0,msdos1)/
    

    When you hit the right one, you'll get a line mentioning lost+found, more importantly boot, and so on.

  3. Assuming (hd0,msdos2) is the right partition:

    set prefix=(hd0,msdos2)/boot/grub
    set root=(hd0,msdos2)
    insmod normal
    normal
    
  4. Now you'll be able to boot into Ubuntu. Once you do, execute the following commands:

    sudo update-grub
    sudo grub-install /dev/sda
    
5
  • Sometimes the LiveCD is required - when grub is broken, for example when you hit "symbol 'grub_file_filters' not found" like in askubuntu.com/questions/1183951/…
    – qneill
    May 14, 2020 at 18:06
  • This method works perfectly for my case (arising after I deleted one nfts partition on my ubuntu-windows dual-boot system).
    – Youjun Hu
    Feb 5, 2021 at 11:22
  • 3
    After running this command insmod normal I get: symbol `grub_calloc` not found.
    – foba
    May 9, 2021 at 20:03
  • If you had a /boot partition, you'll need to set the prefix to the /grub directory on that partition rather than a /boot/grub anywhere. Also, if you don't know where and what grub was installed before, an alternative to the grub-install step is to check what package you have installed (do dpkg -l | grep grub and look for the ii one of grub-pc, grub-efi or whatever else other flavour your platform) and just reinstall that package e.g. sudo apt install --reinstall grub-pc
    – rakslice
    May 10, 2021 at 0:08
  • @Pavel Shouldn't set prefix=(hd0,2)/boot/grub be set prefix=(hd0,msdos2)/boot/grub (and also corresponding set=root cnd) instead?
    – Timofey
    Jan 8, 2022 at 22:42
1

This is already answered here: How to reinstall Grub after burg and tons of other places on this forum.

You are able to boot the Ubuntu installer and erase all of your paritions, but you are also able to save you installs of Ubuntu and Windows but reinstalling GRUB. Once the Ubuntu installer boots, open a command line by pressing Ctlr+Alt+T then type sudo grub-install /dev/sda

1

Insert your Ubuntu CD, reboot your computer and set it to boot from CD in the BIOS and boot into a live session. You can also use a LiveUSB if you have created one in the past. Install and run

Boot-Repair

Click "Recommended Repair". Now reboot your system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. You will be able to choose between Ubuntu and Windows.

How to install Boot-Repair

sudo apt-get install boot-repair

OR

sudo grub-install

(grub install too)

0

in rescue mode you need to:

  1. boot your pc from a ubuntu cd

  2. type in a terminal:

    grub-install /dev/sda
    update-grub
    

Not the answer you're looking for? Browse other questions tagged or ask your own question.