Tuesday, July 7, 2015

Repairing GRUB UEFI Dual Boot Debian 7.1 x64 and Windows 8 x64

Accidentally I failed to install AMD Catalyst 13.6 beta on my Debian 7.1 x64, and I lost my GNOME. For short, I can't recover my GNOME and I reinstall my Debian 7.1 without EFI mood  (my mistake). The Installer can not detect EFI and the only option to install bootstrap loader is MBR.
I can not start both my Debian and Windows. From Bios, I start boot via EFI DVD to start Debian CD Installer. I choose Advanced Option to fix bootstrap location from MBR to EFI Partition (System Reserved), and follow these step:

  1. Update your Debian and run
    # apt-get install grub-efi-amd64
    This command will remove grub package, and choose yes
  2. Configure your GRUB using this command
    # modprobe dm-mod
    # grub-install
  3. Apply your new grub into EFI Partition
    # update-grub
  4. This procedure only fix boot into Debian. To create boot option to load Windows 8 boot manager you need UUID for EFI partition by running
    # blkid
    write down UUID for EFI Partition (it may be label as "System Reserved") with size about 100M-130M.
    for my case UUID is 4842-E4F1
  5. edit file /etc/grub.d/40_custom and at the end of file add
         menuentry "Microsoft Windows 8" {
           insmod part_gpt
           insmod fat
           insmod search_fs_uuid
           insmod chain
           search --fs-uuid --no-floppy --set=root 4842-E4F1
           chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
         }
    the file becomes like this:
         #!/bin/sh
         exec tail -n +3 $0
         # This file provides an easy way to add custom menu entries.  Simply type the
         # menu entries you want to add after this comment.  Be careful not to change
         # the 'exec tail' line above.
         menuentry "Microsoft Windows 8" {
           insmod part_gpt
           insmod fat
           insmod search_fs_uuid
           insmod chain
           search --fs-uuid --no-floppy --set=root 4842-E4F1
           chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
         }
  6. reinstall and reconfigure your grub by issuing :
    # grub-install
    # update-grub
Done, now I have GRUB to my Debian and option to load Windows 8 Boot Manager

No comments:

Post a Comment