Restore Windows bootloader
I installed Ubuntu on my laptop and something happened and my Windows 7 bootloader is missing. I can boot only Ubuntu. So, I tried to do something like suggested here How to restore Windows 7 loader or here, but when I see system recovery option there is no Windows 7 option.
Add Windows to GRUB boot menu
- Add Windows 10 to GRUB OS list
Boot Windows from grub rescue prompt
- Boot Windows from grub rescue command prompt
Repair Windows MBR
This tutorial shows how to repair your Windows bootloader (MBR) from Ubuntu dual boot or Ubuntu live DVD/USB. This can be useful if you don't have a Windows DVD on hand.
Boot into your Ubuntu operating system. When you're in Ubuntu, open the terminal and follow the below steps.
-
Run this command to check your disk:
sudo fdisk -l
The output tells you the disk information:
Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk identifier: 0x016c8108 Device Boot Start End Blocks Id System /dev/sda1 * 63 39054014 19526976 7 HPFS/NTFS/exFAT
-
Now run these commands to install syslinux, which is a suite of lightweight IBM PC MBR bootloaders for starting up computers with the Linux kernel.
sudo apt update sudo apt install syslinux
-
Once installed, you can fix your Windows bootloader by running the below command in the terminal:
sudo dd if=/usr/lib/syslinux/mbr/mbr.bin of=/dev/sda
Rescatux
Rescatux is a free bootable live CD/USB that can repair GRUB and the Windows bootloader. Rescatux has a graphical interface with a menu of operating system rescue tasks. If your hard disk has the MBR partitioning format, you can select the Restore Windows MBR (BETA) option to repair the Windows bootloader. If your computer has UEFI firmware, you can select among the UEFI boot options.
Boot options:
- (>=0.41 beta 1) Update UEFI order
- (>=0.41 beta 1) Create a new UEFI Boot entry
- (>=0.41 beta 1) UEFI Partition Status
- (>=0.41 beta 1) Fake Microsoft Windows UEFI
- (>=0.41 beta 1) Hide Microsoft Windows UEFI
- (>=0.41 beta 1) Reinstall Microsoft Windows EFI
- (>=0.41 beta 1) Check UEFI Boot
GRUB options:
- (>=0.40 beta 11) Easy GNU/Linux Boot Fix
- Restore GRUB and GRUB2
- (>=0.31 beta 4) Update any GRUB2 menu
- Update Debian/Ubuntu GRUB menus
Windows options:
- Restore Windows MBR (BETA)
- Clear Windows passwords
- (>=0.31 beta 4) Promote a Windows user to Administrator role
- (>=0.41 beta 1) Reinstall Microsoft Windows EFI
- (>=0.31 beta 4) Unlock Windows user
Password options:
- Change GNU/Linux Password
- Regenerate sudoers file
- Clear Windows passwords
Expert tools:
- Boot-Repair
- GParted
- OS-Uninstaller
- Clean-Ubiquity
- PhotoRec
- TestDisk
Rescapp is a nice wizard that will guide you through your rescue tasks.
How to make a Rescatux live USB from Ubuntu
Insert a USB flash drive and check if the boot flag has been enabled on the flash drive using the GParted application. Unmount the USB flash drive. Open GParted and select the USB flash drive from the menu list of drives. From the GParted menu select: Partition -> Manage Flags -> check boot.
It is very important to verify that the device that you are installing the Rescatux live USB to is indeed your flash drive, so that you don't overwrite any of your system or personal files which may make your operating system unbootable. In Ubuntu you can find the device name of the flash drive using the Disks application.
-
Unmount the USB partition device. Let's say the USB partition device is
/dev/sdc1
sudo umount /dev/sdc1 # replace sdc1 with the partition name of your USB drive
Change directories using
cd
to the path of the directory where the Rescatux iso file that you downloaded is located.-
Write the Rescatux iso file to the USB flash drive. In the following command replace
rescatux_0.xxxx.iso
with the name of the Rescatux iso file you downloaded.sudo dd if=rescatux_0.xxxx.iso of=/dev/sdc sudo sync
I have also been able to make a Rescatux live USB using the built-in Startup Disk Creator app.
Can you still log into Ubuntu? If you can, open a terminal and type:
sudo update-grub
It will hopefully detect the Windows 7 installation and add its option to the grub boot menu.
You can use this utility to boot to your windows. SuperGrub2 lets you boot to any present OS regardless of MBR or Boot menu.
You can also use Rescatux from the same people to reinstall your windows boot loader.