Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
### 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.
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?
>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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.