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?
-
2You can easily install grub if you have live USB of Ubuntu same version that is installed in your system.. Your boot mode is BIOS or UEFI.. Can you explain how did you delete those to understand.– PRATAPOct 22, 2018 at 13:33
-
My Friend Filled /dev/sda1 with /dev/urandom bytes– Markus HaasOct 22, 2018 at 14:18
-
Do you have live USB? What Version of Ubuntu is it?– PRATAPOct 22, 2018 at 14:20
-
1You must install grub or windows bootloader.. You killed the base.. For windows bootloader you can refer other forums.. Grub can be installed by the above link in comments. You need Ubuntu 18.04 live installer.– PRATAPOct 22, 2018 at 14:25
-
3Possible duplicate of How to create or recover Windows Bootloader after deleting Ubuntu boot drive and How can I repair grub? (How to get Ubuntu back after installing Windows?)– karelNov 26, 2018 at 13:22
1 Answer
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.