Bug 17296

Summary: drakboot crashed (grub2-install: error: cannot find EFI directory)
Product: Mageia Reporter: Vincent Coen <vbcoen>
Component: RPM PackagesAssignee: Thierry Vignaud <thierry.vignaud>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: thierry.vignaud, zen25000
Version: 5Keywords: NEEDINFO
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakxtools-16.104-1.mga5 CVE:
Status comment:
Attachments: rar archive file containing requested and others noted in error msg.
requested files previously in rar form given as .tar.gz

Description Vincent Coen 2015-12-05 18:47:31 CET
The "drakboot" program crashed. Drakbug-16.104 caught it.

With a SSD set up with Windows 7 then Mageia v5 along with a WD Red 3TB dasd used for notmal booting with a /home partition tried to install bootload within the Windows EFI partition which is already present

 Contents of partition sda1 on SSD (250Gb Crucial MX200)

---------
[vince@Applewood ~]$ df
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G  611M  7.2G   8% /dev/shm
tmpfs           7.8G  1.2M  7.8G   1% /run
/dev/sdb7        20G   14G  5.5G  71% /
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
tmpfs           7.8G  8.0K  7.8G   1% /tmp
/dev/sdb11      992G  697G  245G  74% /home
tmpfs           1.6G     0  1.6G   0% /run/user/1000
tmpfs           1.6G   12K  1.6G   1% /run/user/500
tmpfs           1.6G     0  1.6G   0% /run/user/503
/dev/sda1        96M   18M   79M  19% /mnt/EFI
[vince@Applewood ~]$ ll /mnt/EFI/
EFI/  Temp/ 
[vince@Applewood ~]$ ll /mnt/EFI/
total 2
drwxr-xr-x 5 root root 1024 Nov 29 17:14 EFI/
drwxr-xr-x 2 root root 1024 Nov 27 20:32 Temp/
[vince@Applewood ~]$ ll /mnt/EFI/Temp/
bcdinfo.txt      disklayout.txt   SrtTrail.txt     
bootfailure.txt  SrtTrail.log     
[vince@Applewood ~]$ ll /mnt/EFI/Temp/
total 17
-rwxr-xr-x 1 root root  198 Nov 27 20:32 bcdinfo.txt*
-rwxr-xr-x 1 root root    4 Nov 27 20:32 bootfailure.txt*
-rwxr-xr-x 1 root root 4483 Nov 27 20:32 disklayout.txt*
-rwxr-xr-x 1 root root 7020 Nov 27 20:32 SrtTrail.log*
-rwxr-xr-x 1 root root 2424 Nov 27 20:32 SrtTrail.txt*
[vince@Applewood ~]$ ll /mnt/EFI/
EFI/  Temp/ 
[vince@Applewood ~]$ ll /mnt/EFI/EFI/
total 3
drwxr-xr-x 2 root root 1024 Nov 18 18:40 Boot/
drwxr-xr-x 2 root root 1024 Nov 29 17:14 mageia/
drwxr-xr-x 3 root root 1024 Nov 18 18:28 Microsoft/
---------

This partition was NOT mounted the 1st attempt at this but was on this one with the same results.



grub2-install failed: Installing for x86_64-efi platform.
grub2-install: error: cannot find EFI directory.
	...propagated at /usr/lib/libDrakX/any.pm line 268.
	...propagated at /usr/libexec/drakboot line 64.
Perl's trace:
drakbug::bug_handler() called from /usr/libexec/drakboot:64

Theme name: oxygen-gtk
Kernel version = 4.1.13-server-2.mga5
Distribution=Mageia release 5 (Official) for x86_64
CPU=AMD FX(tm)-8350 Eight-Core Processor
Comment 1 Barry Jackson 2015-12-05 22:29:01 CET
Please attach the file:
/root/drakx/report.bug.xz

CC: (none) => zen25000

Comment 2 Vincent Coen 2015-12-06 14:23:10 CET
(In reply to Barry Jackson from comment #1)
> Please attach the file:
> /root/drakx/report.bug.xz

Adding plus one's reported in error msg (grub2 not grub!)
Comment 3 Vincent Coen 2015-12-06 14:24:56 CET
Created attachment 7265 [details]
rar archive file containing requested and others noted in error msg.

Contains all and more - hope they help.
Comment 4 Barry Jackson 2015-12-06 16:26:36 CET
Adding tv to cc

@Vincent - please don't use rar!

what is the full output of:
su
gdisk /dev/sda
i  (enter)
1  (number 1) (enter)

CC: (none) => thierry.vignaud

Comment 5 Vincent Coen 2015-12-06 17:44:30 CET
Do you need me to resend archive in say zip ?

Answer to your query for SSD (sda):

-------------------
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): i
Partition number (1-4): 1
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: CF61C8D4-3E60-46CE-BE20-6FD086CDA037
First sector: 2048 (at 1024.0 KiB)
Last sector: 206847 (at 101.0 MiB)
Partition size: 204800 sectors (100.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'EFI system partition'
------------------

and for the WD 3TB Red which has the same issue now:

----------
 gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): i
Partition number (1-12): 1
Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System)
Partition unique GUID: 62BF933B-D07F-435A-AC47-EF21D0F4FB82
First sector: 2048 (at 1024.0 KiB)
Last sector: 206847 (at 101.0 MiB)                                              
Partition size: 204800 sectors (100.0 MiB)                                      
Attribute flags: 0000000000000000
Partition name: 'EFI system partition'

Command (? for help): q

----------
Comment 6 Vincent Coen 2015-12-06 17:56:08 CET
Created attachment 7267 [details]
requested files previously in rar form given as .tar.gz
Samuel Verschelde 2015-12-07 12:31:08 CET

Assignee: bugsquad => thierry.vignaud

Thierry Vignaud 2015-12-08 10:50:56 CET

Summary: drakboot crashed => drakboot crashed (grub2-install: error: cannot find EFI directory)

Comment 7 Marja Van Waes 2016-06-26 20:10:19 CEST
*** Bug 18680 has been marked as a duplicate of this bug. ***
Comment 8 Thierry Vignaud 2016-06-26 21:31:08 CEST
grub2-install worked nicely during installer, where grub2-efi was selected b/c you were running under UEFI.

What's the result of 'rpm -qa grub2*' ?
Did you reinstall grub2 manually?
If yes, you should have installed grub2-efi instead.
Did you switch to legacy PC-BIOS in firmware?

Keywords: (none) => NEEDINFO

Comment 9 Thierry Vignaud 2016-06-26 21:42:43 CEST
Though the issue is likely b/c you removed the /boot/EFI mountpoint.
You have thus broken grub2.
Mageia works on UEFI systems by mounting the EFI system partition (aka ESP, see https://en.wikipedia.org/wiki/EFI_system_partition) on /boot/EFI.
Both our tools & grub2 expect to found the ESP there.
It was properly setup by installer as shown by your install logs.
However your df logs show that you removed it and mounted it under /tmp/EFI
Comment 10 Vincent Coen 2016-06-26 23:25:11 CEST
result of rpm check:

rpm -qa grub2*
grub2-efi-2.02-0.git9752.18.4.mga5
grub2-mageia-theme-2.02-0.git9752.18.4.mga5

grub2-efi is installed, it was NOT manually installed.

Both sda and sdb are GPT drives

System was booted via sda grub2 boot loader and sdb installed copy of Mageia v5 was selected for loading

Attempting to install boot system on sdb that origally have one but not sure what.

sda and sdb contains  Win 7 using the sdn1, 2 & 3.

the /boot/EFI partition is NOT mounted by me as I do not (normally need it)

However there is one configured in /etc/fstab but rem'd out :

---
 cat /etc/fstab
# Entry for /dev/sda7 :
UUID=99189941-9cb2-4cbc-9617-018156e0eb97 / ext4 relatime,acl 1 1
# Entry for /dev/sda1 :
#UID=3C34-370C /boot/EFI vfat umask=000,iocharset=utf8 0 0
# Entry for /dev/sdb11 :
UUID=9e93fdc9-e908-4a81-b7f3-768d77b4cc35 /home ext4 defaults 1 2
# Entry for /dev/sdd1 :
UUID=3bf8232a-6d9c-4b33-bc94-9997b790d026 /home/vince/Music2 ext4 relatime,acl 1 2
# Entry for /dev/sdj1 :
UUID=08CD4AAB1366B9F4 /mnt/backup-disk ntfs-3g defaults,nofail,umask=000 0 0
none /proc proc defaults 0 0
# Entry for /dev/sda6 :
UUID=e8b2cf87-5d67-44aa-8a36-877f1b3a2992 swap swap defaults 0 0
---

Are you saying I have to have it mounted for the re/install of boot load system via grub2 ?
Comment 11 Thierry Vignaud 2016-06-27 09:38:19 CEST
Yes grub2-efi won't work without it.
Actually no UEFI tool will work without it (efivar, efibootmgr, ...)

Status: NEW => RESOLVED
Resolution: (none) => INVALID

Comment 12 Vincent Coen 2016-06-27 14:25:03 CEST
I have mounted /boot/EFI for sda (gpt) by uncommenting the entry in fstab

1 have created a new mountpoint at /boot/EFI2  for sdb and via the GUI disk tool set a mountpoint for sdb as /boot/EFI2 and mounted it therefore updating fstab.

I have now run grub2 to sdb successfully.

Thank you for your help BUT please can you update the system in some way to advise user to mount these EFI partitions when running boot loader if it cannot find it (or better still find a copy and do so for the specified drive if exists, as I had not seen any reference to this being required.


Leave this report as resolved but to remain on file for other to see if searched for.  At least it acts as some documentation on the issue :)


Vincent
Comment 13 Thierry Vignaud 2016-06-27 15:37:24 CEST
This is done automatically when the installer runs on a UEFI system.
It automatically mount the ESP under /boot/EFI (and creates it if the system is blank).
Comment 14 Vincent Coen 2016-06-27 15:55:20 CEST
Now I am really puzzled as clearly this did not occur - mounting I mean as when I did pre mount them it worked although somewhat slowly 60+ seconds.

Saying this the entry in fstab WAS comnented out !
Comment 15 Thierry Vignaud 2016-06-27 16:50:54 CEST
This did occurs.
The installer logs you attached include a copy of /etc/fstab just prior to reboot to the newly installed system and it does contain:

# Entry for /dev/sda1 :
UUID=3C34-370C /boot/EFI vfat umask=0,iocharset=utf8 0 0

And if it wasn't, the installer wouldn't have been able to set up grub2...

You must have commented out because you though it wasn't needed.