LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-13-2015, 01:30 PM   #1
pusheax
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Rep: Reputation: Disabled
Question Grub2 refuses to load windows bootmgfw.efi


Hi, everyone.

What happened
I tried to resize partitions using Acronis Disk Director 12 and it failed leaving me with unbootable PC. I have dual boot configuration with ArchLinux and Windows 7. I partially restored linux boot and cannot restore windows boot.

1) Why windows boot loader loads from UEFI BIOS and not from grub2?
I have UEFI motherboard Asus M5A97. From UEFI BIOS when I run Windows Boot Manager bootmgfw.efi from flash drive and it shows error:
Code:
Status: 0xc0000225
Info: The boot selection failed because a required device is inaccessible.
I'm guessing it has something to do with bad bcd file. So I'mm looking into it. But the problem is that grub2 cannot even reproduce this error.
When using grub2 in rescue mode I do:
Code:
set root=(hd1,gpt7)
chainloader (hd1,gpt7)/efi/Microsoft/Boot/bootmgfw.efi
And get error: Invalid root device. (hd1,gpt7) is my efi partition where archlinux and windows boot loader efi files reside. I know that file is there. It even shows "cannot find file" when location is wrong. Why it fails? Why it cannot do what UEFI BIOS does easily? I tried every other option for root device to no avail. Somehow I'm missing something crucial about chainloading process.

2)After successful grub-install and efibootmgr motherboard boot option "arch" loads me into black screen with blinking cursor.
Again I can load into grub2(rescue mode) from flash drive in UEFI BIOS shell using the image generated by grub-install but I cannot load into grub2 using newly created boot option. Boot option "arch" just gives me black screen with blinking cursor. Typing does not work, holding shift does not work - so it's not video problem. Why loading grubx64.efi image into UEFI BIOS option under linux can produce this problem?

Config files
System: Linux 4.1.6 x86_64, Asus M5A97, AMD Radeon HD6770

>blkid
Code:
/dev/sdb1: LABEL="store" UUID="3db3187b-8c7a-4bd2-afba-2e66cf60914d" TYPE="ext3" PARTUUID="00040b8f-01"
/dev/sda1: LABEL="M-PM-^WM-PM-0M-QM-^@M-PM-5M-PM-7M-PM-5M-QM-^@M-PM-2M-PM-8M-QM-^@M-PM->M-PM-2M-PM-0M-PM-=M-PM-> M-QM-^AM-PM-8M-QM-^AM-QM-^BM-PM-5M-PM-<M-PM->M-PM-9" UUID="D4A459B5A4599AB6" TYPE="ntfs" PARTLABEL="Microsoft basic data" PARTUUID="8484c5cc-d6fa-41a6-8b7e-e6fb042ee04c"
/dev/sda2: UUID="69560316-8281-4a2a-9e8d-005b4a612c40" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="84579eee-128a-4932-b40c-7d41a8c9586d"
/dev/sda3: LABEL="Arch" UUID="e760e4f1-7805-b384-2327-692c39b1bef2" TYPE="reiserfs" PARTLABEL="Linux filesystem" PARTUUID="8aaab9c1-d279-4d4f-86c0-bc765e7ea522"
/dev/sda4: UUID="D85A9C5F5A9C3C66" TYPE="ntfs" PARTLABEL="Microsoft basic data" PARTUUID="104e9ffd-8860-43c8-9fcd-fbb41e6a6037"
/dev/sda5: LABEL="home" UUID="9c725b82-85f4-1168-1433-14795115a2ad" TYPE="ext3" PARTLABEL="Linux filesystem" PARTUUID="9f24b265-ef65-44a9-ae50-155186597e64"
/dev/sda6: PARTLABEL="Microsoft basic data" PARTUUID="9b90f283-289c-420a-8b73-f891fda75c38"
/dev/sda7: LABEL="EFI-BOOT" UUID="787F-05DD" TYPE="vfat" PARTUUID="c92e4c3a-00d8-41cf-81f4-3d3c5a8e86aa"
/dev/sdc1: SEC_TYPE="msdos" UUID="0EB6-0000" TYPE="vfat" PARTUUID="bd66a70a-01"
grub.cfg
Code:
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt 
insmod reiserfs
set root='hd0,gpt3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  e760e4f1-7805-b384-2327-692c39b1bef2
else
  search --no-floppy --fs-uuid --set=root e760e4f1-7805-b384-2327-692c39b1bef2
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=ru_RU
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e760e4f1-7805-b384-2327-692c39b1bef2' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_gpt 
	insmod reiserfs
	set root='hd0,gpt3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  e760e4f1-7805-b384-2327-692c39b1bef2
	else
	  search --no-floppy --fs-uuid --set=root e760e4f1-7805-b384-2327-692c39b1bef2
	fi
	echo	'Loading Linux linux ...'
	linux	/boot/vmlinuz-linux root=UUID=e760e4f1-7805-b384-2327-692c39b1bef2 rw  text nomodeset
	echo	'Loading initial ramdisk ...'
	initrd	 /boot/initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-e760e4f1-7805-b384-2327-692c39b1bef2' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-e760e4f1-7805-b384-2327-692c39b1bef2' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod reiserfs
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  e760e4f1-7805-b384-2327-692c39b1bef2
		else
		  search --no-floppy --fs-uuid --set=root e760e4f1-7805-b384-2327-692c39b1bef2
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=e760e4f1-7805-b384-2327-692c39b1bef2 rw  text nomodeset
		echo	'Loading initial ramdisk ...'
		initrd	 /boot/initramfs-linux.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-e760e4f1-7805-b384-2327-692c39b1bef2' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_gpt 
		insmod reiserfs
		set root='hd0,gpt3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  e760e4f1-7805-b384-2327-692c39b1bef2
		else
		  search --no-floppy --fs-uuid --set=root e760e4f1-7805-b384-2327-692c39b1bef2
		fi
		echo	'Loading Linux linux ...'
		linux	/boot/vmlinuz-linux root=UUID=e760e4f1-7805-b384-2327-692c39b1bef2 rw  text nomodeset
		echo	'Loading initial ramdisk ...'
		initrd	 /boot/initramfs-linux-fallback.img
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Boot Manager (on /dev/sda7)' --class windows --class os $menuentry_id_option 'osprober-efi-787F-05DD' {
	insmod part_gpt 
	insmod fat
	set root='hd0,gpt7'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt7 --hint-efi=hd0,gpt7 --hint-baremetal=ahci0,gpt7  787F-05DD
	else
	  search --no-floppy --fs-uuid --set=root 787F-05DD
	fi
	chainloader /efi/Microsoft/Boot/bootmgfw.efi
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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.

### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

### BEGIN /etc/grub.d/60_memtest86+ ###
### END /etc/grub.d/60_memtest86+ ###
Output from grub-install --target=x86_64-efi --efi-directory=/boot/efi --recheck --debug /dev/sda
Code:
Installing for x86_64-efi platform.
grub-install: info: cannot open `/boot/grub/device.map': No such file or directory.
grub-install: info: /dev/sda7 is not present.
grub-install: info: Looking for /dev/sda7.
grub-install: info: /dev/sda is a parent of /dev/sda7.
grub-install: info: /dev/sda7 starts from 975708160.
...
grub-install: info: copying `/usr/share/grub/unicode.pf2' -> `/boot/grub/fonts/unicode.pf2'.
grub-install: info: /dev/sda3 is present.
grub-install: info: Looking for /dev/sda3.
grub-install: info: /dev/sda is a parent of /dev/sda3.
grub-install: info: /dev/sda3 starts from 4225095.
grub-install: info: opening the device hostdisk//dev/sda.
grub-install: info: drive = 0.
grub-install: info: the size of hostdisk//dev/sda is 976773168.
grub-install: info: drive = 0.
grub-install: info: the size of hostdisk//dev/sda is 976773168.
grub-install: info: Scanning for DISKFILTER devices on disk hostdisk//dev/sda.
...
grub-install: info: writing 768 bytes of a fixup block starting at 0xc000.
grub-install: info: reading /usr/lib/grub/x86_64-efi/fshelp.mod.
grub-install: info: reading /usr/lib/grub/x86_64-efi/reiserfs.mod.
grub-install: info: reading /usr/lib/grub/x86_64-efi/part_gpt.mod.
grub-install: info: kernel_img=0x295f4d0, kernel_size=0x18600.
grub-install: info: the core size is 0x1d988.
grub-install: info: writing 0x1ec00 bytes.
grub-install: info: copying `/boot/grub/x86_64-efi/core.efi' -> `/boot/efi/EFI/arch/grubx64.efi'.
grub-install: info: Registering with EFI: distributor = `arch', path = `\EFI\arch\grubx64.efi', ESP at hostdisk//dev/sda,gpt7.
grub-install: info: executing efibootmgr --version </dev/null >/dev/null.
grub-install: info: executing modprobe -q efivars.
grub-install: info: executing efibootmgr -b 0002 -B.
BootCurrent: 0005
Timeout: 3 seconds
BootOrder: 0000,0001,0003,0004,0005
Boot0000* CD/DVD Drive
Boot0001* Hard Drive
Boot0003* UEFI: FAT File System
Boot0004* Removable Drive
Boot0005* usb
grub-install: info: executing efibootmgr -c -d /dev/sda -p 7 -w -L arch -l \EFI\arch\grubx64.efi.
BootCurrent: 0005
Timeout: 3 seconds
BootOrder: 0002,0000,0001,0003,0004,0005
Boot0000* CD/DVD Drive
Boot0001* Hard Drive
Boot0003* UEFI: FAT File System
Boot0004* Removable Drive
Boot0005* usb
Boot0002* arch
Installation finished. No error reported.
 
Old 09-14-2015, 08:18 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,762

Rep: Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560
What changes did you make? What partition structure did you have prior to the change? I don't use UEFI but from what I've seen, your blkid output for sda1 isn't right and I've never seen an EFI partition on a logical partition before. Were you previously able to boot from the EFI partition on sda7?
 
Old 09-14-2015, 08:59 AM   #3
pusheax
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
>What changes did you make?
I had all windows partitions on /dev/sda first. Because Windows needs to be first. I don't remember exactly what was where. But I needed to modify my fstab after resizing to correctly mount everything. EFI partition was likely moved on disk, renumbered to sda7. But previously it was also on some logical partition.

>blkid output for sda1 isn't right
What's wrong? UUID? It's windows boot partition.
 
Old 09-14-2015, 09:00 AM   #4
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
You should have included the Windows information in your post on the Arch forums.
https://bbs.archlinux.org/viewtopic.php?pid=1561576

Does this generate a firmware boot entry (called "Test") that boot Windows?
Code:
# efibootmgr -d /dev/sda -p 7 -c -L "Test" -l /efi/Microsoft/Boot/bootmgfw.efi

Last edited by Head_on_a_Stick; 09-14-2015 at 09:01 AM. Reason: typo
 
Old 09-14-2015, 12:25 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,762

Rep: Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560Reputation: 2560
Quote:
What's wrong? UUID? It's windows boot partition.
The LABEL entries for your other partitions are logical. I find it hard to believe you actually created a LABEL for sda1 below:

Quote:
/dev/sda1: LABEL="M-PM-^WM-PM-0M-QM-^@M-PM-5M-PM-7M-PM-5M-QM-^@M-PM-2M-PM-8M-QM-^@M-PM->M-PM-2M-PM-0M-PM-=M-PM-> M-QM-^AM-PM-8M-QM-^AM-QM-^BM-PM-5M-PM-<M-PM->M-PM-9"
I don't use LABEL so I'm not sure what impact that would have. The entry you posted in your initial post trying to boot windows is incorrect since the files are on sda7, the entry should be (hd0,gpt7). That is, if you are booting from the installed Arch. If you are using a Live CD or flash drive, it may see itself as sda and your original should have worked if you had only one hard drive. Grub2 counts drives from zero, partitions from one:

Quote:
set root=(hd1,gpt7)
chainloader (hd1,gpt7)/efi/Microsoft/Boot/bootmgfw.efi
You're using GPT so the sda7 would be irrelevant as I understand it. If you don't resolve this, you might try running the boot repair which you can put on a bootable disk. If you do this, select the option to Create BootInfo Summary to review and/or post here.

https://help.ubuntu.com/community/Boot-Repair

Last edited by yancek; 09-14-2015 at 12:28 PM.
 
Old 09-14-2015, 01:30 PM   #6
pusheax
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Head_on_a_Stick View Post
You should have included the Windows information in your post on the Arch forums.
Sorry, I should have been more clear about my dual boot config.


Code:
# efibootmgr -d /dev/sda -p 7 -c -L "Test" -l /efi/Microsoft/Boot/bootmgfw.efi
This produces the same behavior with black screen and blinking cursor. Now thinking something bad happened to my MB firmware or I need to perform some magical command in uefi shell to restore something.


Quote:
The entry you posted in your initial post trying to boot windows is incorrect since the files are on sda7, the entry should be (hd0,gpt7).
Yes, grub.cfg contains menu entry for windows near the end.

Quote:
I find it hard to believe you actually created a LABEL for sda1 below:
It's probably how blkid deals with russian language.

Quote:
you might try running the boot repair which you can put on a bootable disk.
This looks pretty basic. I might give it a try though.

Grub2 is pretty smart about listing hdds and their file systems. So I can easily understand what fs and what files are on disks.
I will read more about bcfg utillity and try to experiment from UEFI BIOS. Maybe there is a problem when setting efi boot option from linux and not from uefi shell. Will tell you guys how it went.
 
Old 09-27-2015, 04:52 AM   #7
pusheax
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Solved this. The problem was either with partition table on disk sda or with incorrect partition order.
Fixed GPT table and partition order using fdisk and motherboard loads it, grub loads it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Revert grub2-efi to grub2-bios Atmchicago Fedora 1 03-24-2014 01:24 AM
Grub2 refuses to boot Windows 7 pwrightfl Debian 12 02-12-2014 09:21 PM
Grub2 won't load Windows XP dhruvats Ubuntu 13 05-28-2013 11:42 AM
EFI main GPT overwritten everytime (when windows 7 runs) - structure of EFI masuch Linux - Newbie 2 07-20-2012 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration