Here is my problem in short: after two days of fight, despite seemingly doing everything as recommended in different forums, I cannot remove legacy GRUB2 and force my machine to load EFI GRUB2 (or refind) boot manager.
Now, the long description.
I have an ASUS r556L laptop, in which I had installed linux OpenSuse Leap 42.1 and windows 10. Linux grub2 was installed in legacy mode, as for windows - I am not sure, but my grub2 manager loaded Windows boot manager (i vaguely remember i called the relevant entry “boot windows mbr manager”) and everything was just fine. My family was using windows, while I was working on linux.
Two days ago someone from my family have upgraded Windows 10. After the upgrade, obviously the machine could not load neither linux nor windows.
After two hours of googling I find out what happened, burned my old install iso on dvd and I was able to get back the linux system. Now, grub2 was in legacy mode, and after much brooding I decided that maybe the reason I can’t load Windows is that maybe windows was in EFI mode, and, besides, I should use grub2 in EFI mode on EFI machine, right?
So here is what I did
Boot from DVD
(1) /sys/firmware/efi exists; efibootmgr gives the proper entries, so definetely I have booted in EFI mode
(2) /dev/sda2 is EFI; /dev/sda8 is my linux partition.
(3) I had /dev/sda6 as grub_bios. I have made a backup copy using dd, then I have destroyed the partition and just to be sure, before that i have filled it with zeroes using dd if=/dev/zero of=/dev/sda6 count=XXXX
(4) I have removed /dev/sda2; then I have recreated it again using gdisk, setting is as EFI partition (ef00), and
formatted using mkfs.vfat /dev/sda2
mount /dev/sda8 /mnt
mount /dev/sda2 /mnt/boot/efi
for i in /dev/ /dev/pts /proc /sys; do mount $i /mnt/$i -B; done
modprobe efivars # just to be sure
chroot /mnt
efibootmgr
BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0004,0001,0002,0003
Boot0001* CD/DVD Drive
Boot0002* Hard Drive
Boot0003* Network Card
Boot0004* UEFI: HL-DT-ST DVDRAM GUC0N
grub2-install --target x86_64-efi /dev/sda
Installing for x86_64-efi platform.
Installation finished. No error reported.
grub2-mkconfig -o /boot/grub2/grub.cfg
efibootmgr -b 0002 -B # removing non-uefi hard drive option, just to be sure
efibootmgr -o 0003,0001 # setting opensuse, then efi dvd
Just to be sure, efibootmgr now sees everything just fine: that efi opensuse should be loaded first.
efibootmgr -v
BootCurrent: 0004
Timeout: 1 seconds
BootOrder: 0000,0004,0001,0003
Boot0000* opensuse HD(2,e1800,32000,aab2a73b-d4b9-4dce-bbfd-f00e41d393c9)File(\EFI\opensuse\grubx64.efi)
Boot0001* CD/DVD Drive BIOS(3,0,00)…GO…NO…o.H.L.-.D.T.-.S.T. .D.V.D.R.A.M. .G.U.C.0.N…^?..A…^?..>…Gd-.;.A…MQ…L.W.K.F.5.A.4.2.9.1.0. .6. . . . . . . . …^?..BO
Boot0003* Network Card BIOS(6,0,00)…GO…NO…k.R.e.a.l.t.e.k. .P.X.E. .B.0.2. .D.0.0…^?..rN.D+…,…^?..<…Gd-.;.A…MQ…L.R.e.a.l.t.e.k. .P.X.E. .B.0.2. .D.0.0…^?..BO
Boot0004* UEFI: HL-DT-ST DVDRAM GUC0N ACPI(a0341d0,0)PCI(1f,2)03120a000100ffff0000CD-ROM(1,3b1,229c60)…BO
gdisk -l /dev/sda
GPT fdisk (gdisk) version 0.8.8
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/sda: 1953525168 sectors, 931.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): EB75204E-7462-4BA9-A901-83746823FA22
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 1953525134
Partitions will be aligned on 2048-sector boundaries
Total free space is 234025 sectors (114.3 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 923647 450.0 MiB 2700 Basic data partition
2 923648 1128447 100.0 MiB EF00 EFI System
3 1128448 1161215 16.0 MiB 0C01 Microsoft reserved part
4 1161216 1542056771 734.8 GiB 0700 Basic data partition
5 1542057984 1543921663 910.0 MiB 2700
7 1543942144 1547943935 1.9 GiB 0700 primary
8 1548152832 1953523711 193.3 GiB 0700 primary
According to everything I have read this should be enough and everything should work.
REBOOT
(1) What appears is just “GRUB” and nothing else (computer hangs; no grub prompt or anything)
(2) Before I have removed /dev/sda6, it seems it had been loading legacy grub instead of efi (because after choosing
menu entries it was complaining about initrdefi and linuxefi commands)
(3) In BIOS, in boot section only non-EFI options appeared + EFI DVD
(4) after rebooting into rescue mode using EFI DVD, efibootmgr does not see opensuse (which I have set previously). Everything looks as before I had done.
Now, in BIOS I have no “enable EFI” option. I have option “Launch CSM”, which I have enabled; without this option NOTHING could be booted, with this option EFI DVD is booted just fine (it looks like in this image I have googled:
https://www.google.pl/search?q=asus+r556l+bios+options&client=firefox-b-ab&dcr=0&source=lnms&tbm=isch&sa=X&ved=0ahUKEwj0-4b-wp_XAhWMHxoKHWa_Do4Q_AUICygC&biw=1366&bih=613#imgrc=m4OVpmargw_qgM:)
In BIOS, the same options as before are available for boot: non-EFI DVD and HDD, and EFI DVD.
I tried downloading refind and using both automatic and manual installation, and the result was all the same (i.e. seems like legacy GRUB boot manager is still chosen, presenting me with “GRUB” and then hangs).
I don’t want to remove all the partitions and reinstall everything. This is basically out of option. I can fall back to legacy grub, which would mean I would have access to linux, but no access to windoze.
here is output of parted -l:
Model: ATA ST1000LM024 HN-M (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: pmbr_boot
Number Start End Size File system Name Flags
1 1049kB 473MB 472MB ntfs Basic data partition hidden, diag
2 473MB 578MB 105MB fat16 EFI System boot
3 578MB 595MB 16.8MB Microsoft reserved partition msftres
4 595MB 790GB 789GB ntfs Basic data partition
5 790GB 790GB 954MB ntfs hidden, diag
7 790GB 793GB 2049MB linux-swap(v1) primary
8 793GB 1000GB 208GB xfs primary