How to Get Ubuntu Back after installing Windows ?

Whatever you say against Ubuntu, you can’t just make it less popular. It is the most popular Linux distribution. Many companies rely on this distribution. I personally use it on my laptop and in my servers. Normally people use windows, and when it comes to Linux it becomes a whole other matter. If someone use Ubuntu but later he wanted to install install latest windows or old alongside Ubuntu, he may face problem as loosing Ubuntu. That is what i am gong to explain “Ubuntu Recover Procedure”.

How_to_Get_Ubuntu_Back_after_installing_Windows

Ubuntu use “Grub” as boot manager(loader) but windows has different. A boot loader is a computer program that loads an operating system or some other system software for the computer after completion of the power-on self-tests; it is the loader for the operating system itself, which has its own loader for loading ordinary user programs and libraries. When Windows is installed it can’t recognize other Boot Loaders entries. That is why it generates a fresh menu where only Windows stays though Ubuntu is still there if that drive is not destroyed or formatted.

Recently one of my friend asked me how can he get back Ubuntu, that is why i wanted to keep a good reference on this for me and you too. 🙂

You will need a Ubuntu Bootable Pendrive. Boot from that. Determine the partition number of your Ubuntu main partition. GParted can help you here. I’m going to assume in this answer that it’s /dev/sda3, but make sure you use the correct partition number for your system!

Mount your partition:

sudo mount /dev/sda3 /mnt

Bind mount some other necessary stuff:

for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done

chroot into your Ubuntu install:

sudo chroot /mnt

At this point, you’re in your install, not the live pendrive, and running as root. Update grub:

update-grub

Depending on your situation, you have to re-install grub. Normally grub is installed in /dev/sda and that is the good way.

grub-install /dev/sda

Update grub:

update-grub

If everything worked without errors, then you’re all set:

exit
sudo reboot

At this point, you should be able to boot normally with your Ubuntu and also Windows with it by choosing from boot menu. Hope it works. You can ask me about things you face. Thanks for reading.