1

I accidentally deleted all bootloaders (Windows Boot Manager and Grub). If I start my laptop it doesn't found any bootloaders. How can I reinstall at least Windows 10 boot manager and/or GRUB afterwards?

9

1 Answer 1

1

Repair restore and reinstall grub 2 with a Ubuntu installation USB or DVD disk.

Boot from Ubuntu installation DVD or USB drive and choose 'Try Ubuntu without installing'. Find the partitions of your Ubuntu Installation. If you are not sure which one, launch GParted (included in the Ubuntu installation DVD or USB) or. Open a terminal (Ctrl+Alt+T) and use the following command:

sudo fdisk -l

and find out the partitions.

sudo mount /dev/sdXX /mnt

XX being the partition where Ubuntu is installed.

for example: sudo mount /dev/sda1 /mnt.

If there is a separate boot partition.

sudo mount /dev/sdXY /mnt

XY being the boot partition

for efi boot.

sudo mount /dev/sdXZ /mnt/boot/efi

XZ being the efi partition.

Now bind the directories that grub needs access to to detect other operating systems, like so.

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

Now we go to that using chroot.

sudo chroot /mnt

Now install, check, and update grub.

echo "nameserver 8.8.8.8" >/etc/resolv.conf
apt install grub-pc grub-common

This time you only need to add the drive letter (usually a) to replace X, for example: for Legacy/BIOS boot:

grub-install --force /dev/sdX

for efi boot:

sudo grub-install --boot-directory=/mnt/boot /dev/sdX 

then

update-grub

Now grub is back, all that is left is to exit the chrooted system and unmount everything.

exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt

Shut down and turn your computer back on, and you will be met with the default Grub2 screen.

for more see this link.

Windows is likely to be found by grub if not see here or here

In such a case you may have to repeat the whole process of Repair restore and reinstall grub 2 with a ubuntu live cd.

Not the answer you're looking for? Browse other questions tagged .