Grub Boot Loader Repair

Looking for some help with restoring the boot grub loader on Ubuntu 21.04. Last night I started the laptop and was greeted with a minimal bash-like error. I was able to find a way to repair/restore back to desktop but I no longer have the boot manager. Which is important because I use the win1o drive for work.

I have seen a few examples on how to restore the boot loader online but figured since we are all here it may be beneficial to get it out in the open as it will probably happen to others.


Hey @Brian!
Are you logged into your Linux system at the moment?

Yes I am currently logged in

To repair the boot loader, you’ll need to reinstall and reconfigure Grub. It’s an automated process, so I trust this will help resolve it.

First, can you post here the results of (terminal command)?


So that I get the picture where the Grub should be reinstalled.

loop0 7:0 0 4K 1 loop /snap/bare/5
loop1 7:1 0 99.3M 1 loop /snap/core/11743
loop2 7:2 0 55.4M 1 loop /snap/core18/2128
loop3 7:3 0 61.8M 1 loop /snap/core20/1169
loop4 7:4 0 156M 1 loop /snap/keepassxc/1522
loop5 7:5 0 61.8M 1 loop /snap/core20/1081
loop6 7:6 0 164.8M 1 loop /snap/gnome-3-28-1804/161
loop7 7:7 0 5.5M 1 loop /snap/notepad-plus-plus/310
loop8 7:8 0 51M 1 loop /snap/snap-store/542
loop9 7:9 0 219M 1 loop /snap/gnome-3-34-1804/66
loop10 7:10 0 65.1M 1 loop /snap/gtk-common-themes/1515
loop11 7:11 0 32.3M 1 loop /snap/snapd/13170
loop12 7:12 0 346.9M 1 loop /snap/wine-platform-runtime/249
loop13 7:13 0 346.9M 1 loop /snap/wine-platform-runtime/250
loop14 7:14 0 65.2M 1 loop /snap/gtk-common-themes/1519
loop15 7:15 0 55.4M 1 loop /snap/core18/2074
loop16 7:16 0 322.8M 1 loop /snap/wine-platform-6-stable/8
loop17 7:17 0 5.7M 1 loop /snap/notepad-plus-plus/307
loop18 7:18 0 99.4M 1 loop /snap/core/11798
loop19 7:19 0 51M 1 loop /snap/snap-store/547
loop20 7:20 0 295.7M 1 loop /snap/vlc/2344
loop21 7:21 0 724K 1 loop /snap/ufw/501
loop22 7:22 0 32.4M 1 loop /snap/snapd/13270
loop23 7:23 0 219M 1 loop /snap/gnome-3-34-1804/72
loop24 7:24 0 308.3M 1 loop /snap/telegram-desktop/3239
sda 8:0 0 223.6G 0 disk
├─sda1 8:1 0 512M 0 part
├─sda2 8:2 0 513M 0 part /boot/efi
├─sda3 8:3 0 1K 0 part
└─sda5 8:5 0 222.6G 0 part /run/timeshift/backup
sdb 8:16 0 119.2G 0 disk
├─sdb1 8:17 0 899M 0 part
├─sdb2 8:18 0 99M 0 part
└─sdb3 8:19 0 118.3G 0 part
sr0 11:0 1 1024M 0 rom

Thank you!
Go on ahead and type in the following, just to verify that the app that recognizes additional operating systems is present:

sudo apt install os-prober

If it’s installed, then great! If not, the above will install it. Then type:

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

Please let me know if you had any errors.

It looks like it went though fine. Here are the results

brian@brian-G750JM:~$ sudo apt install os-prober
[sudo] password for brian:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
os-prober is already the newest version (1.77ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
brian@brian-G750JM:~$ sudo grub-install /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.
brian@brian-G750JM:~$ sudo update-grub
Sourcing file /etc/default/grub' Sourcing file /etc/default/grub.d/init-select.cfg’
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.11.0-37-generic
Found initrd image: /boot/initrd.img-5.11.0-37-generic
Found linux image: /boot/vmlinuz-5.11.0-34-generic
Found initrd image: /boot/initrd.img-5.11.0-34-generic
Found Windows Boot Manager on /dev/sdb2@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings

Awesome! Then you should be fine booting back into Windows and Linux. :slight_smile:

That’s fantastic. I was looking at stuff that was saying I would need to boot from an iso/usb with ubuntu and all kinds of other stuff. I am very happy I asked. Thank you for sharing your wisdom. I’ll be saving this :rofl:

1 Like

My pleasure, as always, Brian!
You were fortunate to have been inside Linux. If you were stuck on Windows, it would have been a bit more complex of a process. :wink:

1 Like

Just to recap we were telling linux where to install the grub boot loader for the drive that had the OS on it correct?

Yes. It re-installed Grub on the primary drive, which it defined as SDA. If - for some reason - your boot drive is SDB, you can redirect your BIOS to boot from the other drive. You haven’t lost your access as this boot loader can be installed everywhere.

OK got it. Thank you again!

1 Like

It’s my pleasure, Brian! I also got your message on the help desk and sent you some directions. :slight_smile:

Some instructions and Links for Repairing Grub from the Grub Prompt

There are some situations where you might find yourself booting to the Grub2 prompt. “Don’t Panic”! :slight_smile:

This happened to me recently as I was trying to use the default usb-iso-boot-image installer (and I didn’t turn off power to my internal SSD - like [vasileios] recomended - doah!) And the default boot location for grub to locate the boot configuration got messed up.

I did some research and found the following technique to be helpful:

Situation where this became necessary:
Installing Linux to an external Harddrive (like an SSD) using the installer from the live usb

  1. it destoys the grub partition on the boot partition by accident and you have to manually find the /boot/grub directory and run command to boot manually.
  2. You have to boot manually using grub commands then
    1. update grub
    2. reinstall gub on the boot partion /dev/sda (or what ever disk your boot is on)

Helpful Websites for

grub2 - GRUB starts in command line after reboot - Unix & Linux Stack Exchange

  1. find the grub directory on the boot drive (likely hd0) use ls to find the grub.cfg in the grub directory
grub>ls -al
grub> ls
(hd0) (hd0,2) (hd0,1)
grub>ls (hd0,1)/boot/grub
  1. type some grub commands to get things oriented so that it can find the boot drive
grub>set prefix=(hd0,1)/boot/grub
grub>set root=(hd0,1)
grub>insmod linux
grub>insmod normal
# this line will continue with the boot and should get your
# system back up and running so you can repair the grub install
# to the correct boot location

This should boot the system. Then once the system is back up

  1. update grub
# Make sure grub is up to date
sudo update-grub
  1. reinstall grub on the boot drive:
# NOTE: /dev/sda is just an example you have to find your own boot drive on your system.
grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

Very Helpful: How to Rescue a Non-booting GRUB 2 on Linux -

1 Like