Repair Grub2-Efi Boot Entry in Rescue Console form DVD

Hi Folks,

after Bios-Update my Bootentry for OpenSuSE was gone.
Its a Dual-Boot-System with OpenSuSE 12.3 x86_64 und Windows 7 X64 Prof.
I use a Raid1, LVM for Root, Home Swap Partitions (Raid1: /dev/sdc und /dev/sdd → vg00).
I use seperate Partitions for /boot and /boot/efi (my /dev/sdg#).

Here is my solution to recover it:

Output of (Overview of my Disk and Partition-Layout):

bash:~ # parted -l


odel: ATA SAMSUNG HD400LJ (scsi)
Disk /dev/sda: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  32.2GB  32.2GB  ntfs         Basic data partition
 2      32.2GB  140GB   107GB   ntfs         Basic data partition
 3      140GB   247GB   107GB   ntfs         Basic data partition
 4      247GB   400GB   153GB   ntfs         Basic data partition


Model: ATA SAMSUNG HD400LJ (scsi)
Disk /dev/sdb: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  32.2GB  32.2GB  ntfs         Basic data partition
 2      32.2GB  140GB   107GB   ntfs         Basic data partition
 3      140GB   247GB   107GB   ntfs         Basic data partition
 4      247GB   400GB   153GB   ntfs         Basic data partition


Model: ATA SAMSUNG HD400LJ (scsi)
Disk /dev/sdc: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt_sync_mbr

Number  Start   End    Size    File system  Name                  Flags
 1      1049kB  672MB  671MB   ntfs         primary
 3      672MB   108GB  107GB   ntfs         Basic data partition
 4      108GB   323GB  215GB   ntfs         Basic data partition
 2      323GB   400GB  77.2GB               primary               lvm


Model: ATA SAMSUNG HD400LJ (scsi)
Disk /dev/sdd: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt_sync_mbr

Number  Start   End    Size    File system  Name                  Flags
 1      1049kB  672MB  671MB   ntfs         primary
 3      672MB   108GB  107GB   ntfs         Basic data partition
 4      108GB   323GB  215GB   ntfs         Basic data partition
 2      323GB   400GB  77.2GB               primary               lvm

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg00-Swap: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system     Flags
 1      0.00B  8590MB  8590MB  linux-swap(v1)


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg00-Home: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  10.7GB  10.7GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg00-OpenSuse122Root: 27.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  27.5GB  27.5GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg00-Fedora17Root: 26.8GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  26.8GB  26.8GB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbajd-part2: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  107GB  107GB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbajd-part3: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  107GB  107GB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbajd-part4: 153GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  153GB  153GB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbajd-part1: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  32.2GB  32.2GB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbbea-part4: 215GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  215GB  215GB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbbea-part1: 671MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  671MB  671MB  ntfs


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbbea-part3: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0.00B  107GB  107GB  ntfs


Error: /dev/mapper/pdc_bdchigbbea-part2: unrecognised disk label          
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/pdc_bdchigbbea-part2: 77.2GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown

Model: Linux device-mapper (mirror) (dm)
Disk /dev/mapper/pdc_bdchigbajd: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt_sync_mbr

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  32.2GB  32.2GB  ntfs         Basic data partition
 2      32.2GB  140GB   107GB   ntfs         Basic data partition
 3      140GB   247GB   107GB   ntfs         Basic data partition
 4      247GB   400GB   153GB   ntfs         Basic data partition


Error: The backup GPT table is corrupt, but the primary appears OK, so that will
be used.
OK/Cancel? Ok                                                             
Model: Linux device-mapper (mirror) (dm)
Disk /dev/mapper/pdc_bdchigbbea: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End    Size    File system  Name                  Flags
 1      1049kB  672MB  671MB   ntfs         primary
 3      672MB   108GB  107GB   ntfs         Basic data partition
 4      108GB   323GB  215GB   ntfs         Basic data partition
 2      323GB   400GB  77.2GB               primary               lvm


Model: ATA OCZ-VERTEX3 (scsi)
Disk /dev/sdg: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  269MB   268MB   fat16        EFI System Partition          boot
 2      269MB   404MB   134MB                Microsoft reserved partition  msftres
 3      404MB   43.4GB  42.9GB  ntfs         Basic data partition
 4      43.4GB  43.9GB  537MB   ext4
 5      43.9GB  44.4GB  543MB   ext4         primary

Boot into Rescue Console of OpenSuSE DVD and login is root (requieres no password)

  1. LVM
    1.1 figure out your VolumeGroupName
    lvs

  LV              VG   Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  Fedora17Root    vg00 -wi-ao--- 25.00g                                           
  Home            vg00 -wi-ao--- 10.00g                                           
  OpenSuse122Root vg00 -wi-ao--- 25.60g                                           
  Swap            vg00 -wi-ao---  8.00g 

1.2 activate your VolumeGroup

lvchange -a y vg00

  1. Directory-Structure

2.1 Create your new Root-Directory

mkdir /mounts/root
mount /dev/disk/by-label/OpenSuse122Root # Put your Root-Directory (instead OpenSuse122Root) here, it is easier if you labeled your Partitions, maybe you colud use /dev/mapper/… <TAB>)

2.2 Mount Boot und Efi directory

mount /dev/sdg4 /mounts/boot
mount /dev/sdg1 /mountboot/efi

2.3 mount dev to your new Root-Directory

mount --bind /dev /mounts/root/dev

2.4 Activate your Root-Directory

chroot /mounts/root

2.5 Activate Proc and Sys

mount proc
mount sys

  1. Rewrite Efi-Settings

grub2-efi-install /boot/grub2/grub.efi

Efi-Boot-Manager Settings should be displayed!!!

  1. Exit al consols

exit
exit

  1. Reboot into your Efi-Boot-Manger

Yes, that works. I did something similar when I ran into that problem.

If the opensuse directory and files in the EFI partition are still there, then it turns out that you can recreate the NVRAM entry with “efibootmgr” (run from the resue boot):

Use something like:


# efibootmgr -c -d /dev/sdg -p 1 -L opensuse-secure -l '\EFI\opensuse\shim.efi'

That would be for secure-boot. If there’s no “shim.efi”, you would instead use “grubx64.efi”.