uefi boot not working

i’ve got a dell inspiron 14r that came with windows 8.1 installed. i managed to shrink the windows partition and get opensuse 13.1 installed and booting… until it stopped. the /EFI/opensuse directory in the efi partition, /dev/sda1, appears to be corrupted. attempting to list it gives me a screen full of garbage.

i tried running grub2-mkconfig -o /boot/grub2/grub.cfg and grub2-install /dev/sda, but no joy. all i can boot is windows. the distribution media no longer have an option to boot an installed system.

here’s the layout of my disk. partitions 7,8 and 9 are swap. / and home.

#         Start          End    Size  Type            Name
 1         2048      1026047    500M  EFI System      EFI system partition
 2      1026048      1107967     40M  unknown         Basic data partition
 3      1107968      1370111    128M  Microsoft reser Microsoft reserved partition
 4      1370112      2373631    490M  Windows recover Basic data partition
 5      2373632    976539647  464.5G  Microsoft basic Basic data partition
 6   1936867328   1953523119      8G  Windows recover Microsoft recovery partition
 7    976539648    980752383      2G  Microsoft basic primary
 8    980752384   1022697471     20G  Microsoft basic primary
 9   1022697472   1936867327  435.9G  Microsoft basic primary

It is not completely clear what you did.

Boot from the install media, into rescue mode. That should give you a command line.

At the login prompt, enter: root

That should log you in as root.


# mount /dev/sda1 /mnt

If that gives an error message, then make a note of the message and post it in this thread. In that case, try again with:


# mount -o ro /dev/sda1 /mnt

If you get it mounted, one way or the the other, then try:


# ls /mnt/EFI/opensuse

and post the output here. You can write it down for later posting if you want. The output should be only a few files (maybe 5 files).

You should then be able to use:


# shutdown -r now

to reboot to Windows.

thanks for the response.

i am able to boot the install media. i am able to mount the efi partition. when i attempt to list the contents of /EFI/opensuse i get screens full of garbage characters.

ls /mnt/EFI/opensuse | less

indicates that there are 2158 lines of garbage. here are the first 23 of them…

 <.><.>
<.>
<.>
<.>
<.:
<.:
<.:
<.:
<.:
<.:
<.:
<.:
<.:
<.:
<.:
<.
=
=.>
=^D>^D:.<
>
>
>



furthermore, the opensuse directory looks to be ungodly large.

linux:/home/linux # ls -l /mnt/EFItotal 80
drwxr-xr-x  2 root users  4096 Jan 21 09:41 Boot
drwxr-xr-x  3 root users  4096 Jan 21 09:41 Microsoft
drwxr-xr-x 88 root users 73728 May  3 13:56 opensuse
linux:/home/linux # 

Okay.

If it mounted without error, then the file system should not be too corrupt.

Maybe check:


# ls /mnt/EFI/Boot
# ls /mnt/EFI/Microsoft
# ls /mnt/EFI/Microsoft/Boot

And what’s the output from


# efibootmgr -v

If you are hand-copying, then I don’t care much about hexadecimal strings that might be there, so you can shorten those.

It’s bedtime here now, so it will be a few hours before I can respond again. You may need to reinstall grub2-efi, and you may need to do an “rm -rf” on that opensuse directory to clean up the mess. I’d like to see that additional output first.

at you service.

 linux:/home/linux # ls /mnt/EFI/Boot
bootx64.efi
linux:/home/linux # ls /mnt/EFI/Microsoft/
Boot
linux:/home/linux # ls /mnt/EFI/Microsoft/Boot/
BCD           BOOTSTAT.DAT  en-US  hu-HU        nb-NO      ro-RO       tr-TR
BCD.LOG       boot.stl      es-ES  it-IT        nl-NL      ru-RU       uk-UA
BCD.LOG1      cs-CZ         et-EE  ja-JP        pl-PL      sk-SK       zh-CN
BCD.LOG2      da-DK         fi-FI  ko-KR        pt-BR      sl-SI       zh-HK
bg-BG         de-DE         Fonts  lt-LT        pt-PT      sr-Latn-CS  zh-TW
bootmgfw.efi  el-GR         fr-FR  lv-LV        qps-ploc   sr-Latn-RS
bootmgr.efi   en-GB         hr-HR  memtest.efi  Resources  sv-SE
linux:/home/linux # 

and

 linux:/home/linux # efibootmgr -vBootCurrent: 0006
Timeout: 0 seconds
BootOrder: 0001,0000,0004,0005,0006
Boot0000* opensuse    HD(1,800,fa000,a62c2d34-7c51-4954-ae16-cd79a1c6931c)File(\EFI\opensuse\grubx64.efi)
Boot0001* Windows Boot Manager    HD(1,800,fa000,a62c2d34-7c51-4954-ae16-cd79a1c6931c)File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0004* UEFI: IP4 Realtek PCIe FE Family Controller    ACPI(a0341d0,0)PCI(1c,3)PCI(0,0)MAC(e0db55c16981,0)IPv4(0.0.0.0:0<->0.0.0.0:0,0, 0..BO
Boot0005* UEFI: IP6 Realtek PCIe FE Family Controller    ACPI(a0341d0,0)PCI(1c,3)PCI(0,0)MAC(e0db55c16981,0)030d3c000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000..BO
Boot0006* UEFI: PLDS DVD+/-RW DU-8A5LH    ACPI(a0341d0,0)PCI(1f,2)03120a000100ffff0000CD-ROM(1,3fd,4afae)..BO
linux:/home/linux # 

weird. it appears that one of my recent attempts to fix things has changed my boot order.

sweet dreams.

That mostly looks good.

So whatever damage there is to your EFI partition ("/dev/sda1"), it does not appear to have caused any problems for booting Windows.

So we need to reinstall the boot setup for opensuse. But, since there’s a mess in the “/EFI/opensuse” partition, we need to fix that. I’m a bit worried about using “rm -rf” to delete it all, in case there are some cross-linked files. So, we need to start by making sure of the integrity of the EFI partition.

There are two possible ways of doing that.

  1. Boot to linux (rescue mode of install media); do not mount the partition. Instead, run
# fsck -t vfat /dev/sda1
  1. Do a CHKDSK in Windows.

I think I would prefer to do the second of those, if possible. I have never tried what I will suggest. If it doesn’t work, we can fall back to the linux way.

In Windows 8.1, go to the disk manager. As I recall, right click at the bottom left corner and select “Computer Management”, then select Disk manager (or whatever they call it).

That should show your partitions. Then select (click) the EFI partition (should be the first), and see if you can assign it a drive letter. Let’s say that you assign it drive X:

If you can do that then, in an administrator command prompt, you should be able to do


CHKDSK X: /F

If that works, you can then go back to Disk Manager, and unassign that drive letter.

Once we are sure that the file system is clean, we can reinstall booting. I’ll go through the steps of that, when I hear the results of the CHKDSK.

If Windows refuse to assign a drive letter to the EFI partition, then the alternative is to do it the linux way.

I would probably do:


# fsck -n -t vfat /dev/sda1

That should just report errors and not fix them. Then, repeat without the “-n” if you want to actually fix them (not needed if there are no errors). You might be prompted for many answers. You could use “-y” in place of “-n” to automatically agree to all prompts. But I always hesitate to do that. If there are thousands of errors, it might be the best way. I’m hoping that it turns out that there are no errors or very few errors to fix.

okay, here’s how windows sees the efi partition. ran a couple of directory listings to make sure i was looking at the right disk, then ran CHDK without the /F flag.

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>dir x:\
 Volume in drive X is ESP
 Volume Serial Number is AAAC-AD15

 Directory of x:\

11/13/2013  06:59 PM    <DIR>          en-us
03/31/2014  08:18 PM    <DIR>          EFI
               0 File(s)              0 bytes
               2 Dir(s)     485,900,288 bytes free

C:\WINDOWS\system32>dir x:\EFI
 Volume in drive X is ESP
 Volume Serial Number is AAAC-AD15

 Directory of x:\EFI

01/21/2014  09:41 AM    <DIR>          .
01/21/2014  09:41 AM    <DIR>          ..
01/21/2014  09:41 AM    <DIR>          Microsoft
01/21/2014  09:41 AM    <DIR>          Boot
05/03/2014  01:56 PM    <DIR>          opensuse
               0 File(s)              0 bytes
               5 Dir(s)     485,900,288 bytes free

C:\WINDOWS\system32>dir x:\EFI\Microsoft
 Volume in drive X is ESP
 Volume Serial Number is AAAC-AD15

 Directory of x:\EFI\Microsoft

01/21/2014  09:41 AM    <DIR>          .
01/21/2014  09:41 AM    <DIR>          ..
01/21/2014  09:41 AM    <DIR>          Boot
               0 File(s)              0 bytes
               3 Dir(s)     485,900,288 bytes free

C:\WINDOWS\system32>dir x:\EFI\Microsoft\Boot
 Volume in drive X is ESP
 Volume Serial Number is AAAC-AD15

 Directory of x:\EFI\Microsoft\Boot

01/21/2014  09:41 AM    <DIR>          .
01/21/2014  09:41 AM    <DIR>          ..
01/21/2014  09:41 AM    <DIR>          bg-BG
01/21/2014  09:41 AM    <DIR>          cs-CZ
01/21/2014  09:41 AM    <DIR>          da-DK
01/21/2014  09:41 AM    <DIR>          de-DE
01/21/2014  09:41 AM    <DIR>          el-GR
01/21/2014  09:41 AM    <DIR>          en-GB
01/21/2014  09:41 AM    <DIR>          en-US
01/21/2014  09:41 AM    <DIR>          es-ES
01/21/2014  09:41 AM    <DIR>          et-EE
01/21/2014  09:41 AM    <DIR>          fi-FI
01/21/2014  09:41 AM    <DIR>          fr-FR
01/21/2014  09:41 AM    <DIR>          hr-HR
01/21/2014  09:41 AM    <DIR>          hu-HU
01/21/2014  09:41 AM    <DIR>          it-IT
01/21/2014  09:41 AM    <DIR>          ja-JP
01/21/2014  09:41 AM    <DIR>          ko-KR
01/21/2014  09:41 AM    <DIR>          lt-LT
01/21/2014  09:41 AM    <DIR>          lv-LV
01/21/2014  09:41 AM    <DIR>          nb-NO
01/21/2014  09:41 AM    <DIR>          nl-NL
01/21/2014  09:41 AM    <DIR>          pl-PL
01/21/2014  09:41 AM    <DIR>          pt-BR
01/21/2014  09:41 AM    <DIR>          pt-PT
01/21/2014  09:41 AM    <DIR>          qps-ploc
01/21/2014  09:41 AM    <DIR>          ro-RO
01/21/2014  09:41 AM    <DIR>          ru-RU
01/21/2014  09:41 AM    <DIR>          sk-SK
01/21/2014  09:41 AM    <DIR>          sl-SI
01/21/2014  09:41 AM    <DIR>          sr-Latn-CS
01/21/2014  09:41 AM    <DIR>          sr-Latn-RS
01/21/2014  09:41 AM    <DIR>          sv-SE
01/21/2014  09:41 AM    <DIR>          tr-TR
01/21/2014  09:41 AM    <DIR>          uk-UA
01/21/2014  09:41 AM    <DIR>          zh-CN
01/21/2014  09:41 AM    <DIR>          zh-HK
01/21/2014  09:41 AM    <DIR>          zh-TW
01/21/2014  09:41 AM    <DIR>          Fonts
01/21/2014  09:41 AM    <DIR>          Resources
05/25/2014  09:28 AM            40,960 BCD
06/18/2013  07:49 AM             4,247 boot.stl
02/22/2014  08:44 AM         1,616,728 bootmgfw.efi
02/22/2014  08:44 AM         1,613,656 bootmgr.efi
02/22/2014  08:44 AM         1,500,504 memtest.efi
               5 File(s)      4,776,095 bytes
              40 Dir(s)     485,900,288 bytes free

C:\WINDOWS\system32>dir x:\EFI\opensuse
 Volume in drive X is ESP
 Volume Serial Number is AAAC-AD15

 Directory of x:\EFI\opensuse

01/20/1982  12:33 AM        70,583,362 >♦4♦
The parameter is incorrect.
☻?ÿ          70,779,954 F♦8♦D♦@♦.8♦
02/01/1982  12:33 AM        71,173,170
01/24/1982  12:33 AM        70,255,677
01/20/1982  12:34 AM        71,041,056 >♦.
02/02/1982  12:33 AM         5,570,592 0♦
01/28/1982  12:34 AM        70,385,696 c
01/30/1982  12:34 AM         2,098,224 i
               8 File(s)    431,887,731 bytes
               0 Dir(s)     485,900,288 bytes free

C:\WINDOWS\system32>CHKDSK X:
The type of the file system is FAT32.
The volume is in use by another process. Chkdsk
might report errors when no corruption is present.
Volume ESP created 1/21/2014 9:31 AM
Volume Serial Number is AAAC-AD15
Windows is verifying files and folders...
Windows found errors on the disk, but will not fix them
because disk checking was run without the /F (fix) parameter.
Unrecoverable error in folder \EFI\opensuse.
Convert folder to file (Y/N)? n
File and folder verification is complete.
Convert lost chains to files (Y/N)? n
7323648 bytes of free disk space would be added.

Windows has checked the file system and found problems.
Run CHKDSK with the /F (fix) option to correct these.

  520,093,696 bytes total disk space.
      126,976 bytes in 6 hidden files.
      180,224 bytes in 44 folders.
   26,558,464 bytes in 122 files.
  485,900,288 bytes available on disk.

        4,096 bytes in each allocation unit.
      126,976 total allocation units on disk.
      118,628 allocation units available on disk.

C:\WINDOWS\system32>

so CHDK has offered to convert the corrupted directory into a regular file, and collect a bunch of unlinked blocks, (presumably the pieces of the lost files from opensuse), into files.

should i then delete the newly created files, boot my recovery disk and go through the whole mount my suse file system, chroot, and grub2-install rigamarole?

thanks, once again.

Yes, that’s what I would do.

I’m still wondering how that happened.

as am i. hadn’t touched any of the system stuff. certainly not that partition. didn’t even know it was there.

anyway, here goes.

Could have been an electrical hiccup (such as a brown-out flash or a lightning spike in the area) while writing to the disk.

oops. there went nothing.

tried.

mount /dev/sda8 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
grub2-install /dev/sda1

didn’t get a new /EFI/opensuse directory.

I’m pretty sure that’s wrong. I hope it did not mess up the EFI partition again.

Personally, I would have use Yast (curses version, from the command line), and gone to the bootloader section to install grub2-efi.

In any case, here’s the output that I get from “grub2-install --help”


# grub2-install --help
Usage: grub2-install [OPTION] [INSTALL_DEVICE]
Install GRUB on your drive.

  -h, --help              print this message and exit
  --modules=MODULES       pre-load specified modules MODULES
  --install-modules=MODULES
                          install only MODULES and their dependencies
                          [default=all]
  --themes=THEMES         install THEMES [default=starfield]
  --fonts=FONTS           install FONTS [default=unicode]
  --locales=LOCALES       install only LOCALES [default=all]
  --compress=no,xz,gz,lzo]
                          compress GRUB files [optional]
  -d, --directory=DIR     use images and modules under DIR
                          [default=/usr/lib/grub2/<platform>]
  --grub-mkimage=FILE     use FILE as grub-mkimage
  -v, --version           print the version information and exit
  --boot-directory=DIR    install GRUB images under the directory DIR/grub2
                          instead of the /boot/grub2 directory
  --target=TARGET         install GRUB for TARGET platform
                          [default=current]
  --grub-setup=FILE       use FILE as grub-setup
  --grub-mkrelpath=FILE   use FILE as grub-mkrelpath
  --grub-probe=FILE       use FILE as grub-probe
  --allow-floppy          make the drive also bootable as floppy (default
                          for fdX devices). May break on some BIOSes.
  --recheck               delete device map if it already exists
  --force                 install even if problems are detected
  --force-file-id         use identifier file even if UUID is available
  --disk-module=MODULE    disk module to use (biosdisk or native). This
                          option is only available on BIOS target.
  --no-nvram              don't update the `boot-device' NVRAM
                          variable. This option is only available on
                          IEEE1275 targets.
  --removable             the installation device is removable. This option
                          is only available on EFI.
  --bootloader-id=ID      the ID of bootloader. This option is only
                          available on EFI.
  --efi-directory=DIR     use DIR as the EFI System Partition root.

INSTALL_DEVICE must be system device filename.

grub2-install copies GRUB images into /boot/grub2.  On some platforms, it
may also install GRUB into the boot sector.


Report bugs to &lt;bug-grub@gnu.org&gt;.

My file “/etc/default/grub” contains the line:


GRUB_USE_LINUXEFI=true

I’m not sure of how to use grub2-install directly for EFI. Most of the online documentation is for non-EFI systems.