Ubuntu Live CD or a USB drive comes in handy at times when something goes wrong. You can do things like recovering data, check for hard disk errors, or even restore the Grub bootloader.
It’s easier to mess up the Grub when you have changed the configuration of your computer. For instance, Grub can become inaccessible after you installed Windows in a dual boot configuration with a Linux distro because Windows Boot Manager takes over the bootloader and it doesn’t recognize Linux. If you have an Ubuntu Live CD or USB drive lying around, you can use it to reset bootloader so that Grub can retake the boot screen.
If you haven’t created an Ubuntu Live USB drive yet, check out our guide “Creating Ubuntu Live USB drive” and come back and follow the steps:
Resetting Grub Bootloader using a Ubuntu Live USB drive
This is a command-line way of restoring the grub. If “Terminal” is not your cup of tea, I suggest you check the graphical user interface way by using Grub Repair.
Step 1. Insert your Ubuntu Live USB or CD, then power on your machine.
Step 2. From the Install window, choose the “Try Ubuntu” option to open an Ubuntu live session.
Step 3. Open a new terminal window from the left panel or simply you can use the next shortcut from your keyboard CTRL+ALT+T.
Step 4. First, we need to know which partition is Ubuntu installed. You can know where Ubuntu is installed by using the “fdisk” or the “blkid” command.
Using the “fdisk” command:
After executing the previous command, you will get an output like the below screenshot. As you can see Ubuntu is installed on the “/dev/sda1” partition.
Also, you can check where Ubuntu is installed using the “blkid”. The “blkid” command can provide you with more information about the partitions especially if they are labeled.
After executing the previous command, it will list all partitions. Just search for the partition with type “ext4”. As you can see in our case Ubuntu is installed on the “/dev/sda1” partition.
Step 5. Next, we need to mount the partition where Ubuntu is installed to the “/mnt” mount point.
sudo mount /dev/sda1 /mnt
As shown in the above screenshot the “/dev/sda1” is mounted successfully.
Step 6. Now we will use the “grub-install” command to restore all the missing files into the grub folder.
sudo grub-install --boot-directory=/mnt/boot /dev/sda
Finally, you can now reboot your Ubuntu and the Grub boot menu should now appear.
Congratulations you have just restored the Ubuntu Grub boot menu.
I have installed Peach OSI: The Patriot on a 64 GB USB 3.0 pendrive and have customized many things according to my choices and also have many data on it. I used EaseUS Partition tool in Windows 7 and cloned full pendrive with .ext4 partition onto a microSD card, but it failed to boot. I tried Boot-Repair tool with net connection, then also booting was not successful. I tried to run Live CD of Peach OSI and tried to install grub from command line, but it showed some error like failed to get canonical path of ‘/cow’ I am really surprised to know there is only either Boot Repair or command line option to repair a non-booting Linux OS!!!
Hey, did you find any solution yet? I have the same problem :(
Use –force in end
Thanks. Stuck with Ubuntu 20.04 dual. Plain and simple…
Wow…. Thank you so much…. I’ve been stuck on this for days… You guys are the best
But I hope it’s a permanent solution???
Yes it is, unless you want to install Windows again. In which case you would have to repeat all this
Thanksssssssssssssssssssssssss!!!!!!!!!!!! I was really not expecting to find a solution.
Back again in Ubuntu and Windows!
Spilt water on my laptop leading to a invalid partition and boot error but this seems to have worked thanks.
What are my options since this didn’t work for me? Thanks!
thankyou very much mate
Thank you very very much!!! i am really thankful