Recovery bootloader for a dual boot system of Windows 7 and Arch Linux

Posted by:

After rendering one of my old laptops into OS-less state by restoring the Arch Linux OS from another System without exclude the boot, following is what I did to recover the dual-boot system. I have to fix the MBR and Boot for windows first and then reinstall the grub boot loader with linux live CD.

Fix Windows 7 MBR and Boot

Adapted from here.

  1. Boot from the Windows 7 installation DVD. Note: The DVD with the same windows OS is needed. At the “Press any key to boot from CD or DVD…”, press any key to boot from the DVD Select a language Select a keyboard layout Click Next Select the operating system and click Next. The “Use recovery tools that can help fix problems starting Windows” must be checked when you select the operating system. At the System Recovery Options screen, click on Command Prompt


  2. Command Prompt successfully loads, type this command:

  3. Press Enter Type the next command:

  4. Press Enter Type the next command:

  5. Press Enter Remove the installation DVD from the disk tray and restart your computer

Reinstall grub with Arch Linux Live Disc

Decrypt the root partition with LUKS Link

Find and mount the boot partition. Note: it is a fat partition before, linux; NOT the MBR sda1.

Arch and Grub Installation after chroot in.

  1. chroot into the arch installation (from live CD).

  2. Install the bootloader – grub.

    Install the packages grub and efibootmgr. GRUB is the bootloader, efibootmgr creates bootable .efi stub entries used by the GRUB installation script.

Generate the main configuration file

  1. Make sure all partitions are mounted, i.e. / /boot /boot/efi

  2. Intial Ramdisk Environment

    Add the encrypt hook to mkinitcpio.conf: link here

  3. retrieve the UUID, it is the crypto_LUK one.

  4. update /etc/default/grub

  5. install os-prober, only detect the correct Windows boot after boot into Linux, not from chroot with live CD.
  6. configure grub

    The following steps install the GRUB UEFI application to $esp/EFI/grub, install its modules to /boot/grub/x86_64-efi, and place the bootable grubx64.efi stub in $esp/EFI/grub.

    First, tell GRUB to use UEFI, set the boot directory and set the bootloader ID. Mount the ESP partition to e.g. /boot or /boot/efi and in the following change $esp to that mount point (usually /boot):

    The –bootloader-id is what appears in the boot options to identify the GRUB EFI boot option; make sure this is something you will recognize later. The install will create a directory of the same name under $esp/EFI/ where the EFI binary bootloader will be placed.

    Now, let’s add Windows to the GRUB menu. Edit /boot/efi/EFI/grub/grub.cfg and add the following menuentry after the Arch Linux menuentries [Note: grub boot loader does not locate Windows OS, but this is necessary for grub to load Arch Linux in my case. After I boot into arch linux, I ran sudo os-prober and update grub config.] See here for details.

    and update the string with following output:

    $latex hints_string with the output of $ grub-probe target=fs_uuid /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi $latex fs_uuid with the output of $ grub-probe target=hints_string /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

  7. Unmount and Reboot

  8. Reboot into Arch Linux

    Done! Hopefully you can choose between Windows and Arch Linux at the start. If not, just go back in with live CD and tweak more.


Add a Comment