Unable to reinstall GRUB

Kernels & Hardware, configuring network, installing services

Unable to reinstall GRUB

Postby loosemonkey » 2020-03-16 16:10

Hello,

Unknowingly fxking windows 10 has tampered with my boot/grub configuration in the background during the 'windows update cycle'. Grub is no longer accessible/visible during the normal boot.

efibootmgr -v yields:
Code: Select all
BootOrder: 0009,0007,0008,0006,0000
Boot0000* Windows Boot Manager   HD(2,GPT,1a9f20ea-4510-4366-a7b0-933a939bf949,0xe1800,0x32000)/File(\EFI\debian\grubx64.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.}...I................
Boot0006* Windows Boot Manager   HD(2,GPT,1a9f20ea-4510-4366-a7b0-933a939bf949,0xe1800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
Boot0007* Windows Boot Manager   HD(4,GPT,b9a0ae4c-c341-4024-9481-bf920d130a4c,0x11b800,0x679ef8f)/File(\EFI\Boot\bootx64.efi)
Boot0008* Windows Boot Manager   HD(4,GPT,b9a0ae4c-c341-4024-9481-bf920d130a4c,0x11b800,0x666fb46)/File(\EFI\Boot\bootx64.efi)
Boot0009* UEFI: Sony Storage Media PMAP   PciRoot(0x0)/Pci(0x1d,0x0)/USB(1,0)/USB(1,0)/HD(1,GPT,eb0ef56a-4816-4dd1-9067-dfd783891989,0x800,0x301f)..BO


while following the grub reinstallation process using the commands below gives me an error:
Code: Select all
mount /dev/sda1 /boot/efi
apt-get install --reinstall grub-efi
grub-install /dev/sda

Installing for x86_64-efi platform.
grub-install: error: /boot/efi doesn't look like an EFI partition.


Any advice what to do to be able to procceed or fix the grub installation? Currently relying on an external device 'rEFINd' to boot debian on the system.
Thank you.
loosemonkey
 
Posts: 10
Joined: 2018-09-30 09:24

Re: Unable to reinstall GRUB

Postby Head_on_a_Stick » 2020-03-16 19:16

loosemonkey wrote:efibootmgr -v yields:
Code: Select all
BootOrder: 0009,0007,0008,0006,0000
Boot0000* Windows Boot Manager   HD(2,GPT,1a9f20ea-4510-4366-a7b0-933a939bf949,0xe1800,0x32000)/File(\EFI\debian\grubx64.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.}...I................
Boot0006* Windows Boot Manager   HD(2,GPT,1a9f20ea-4510-4366-a7b0-933a939bf949,0xe1800,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)
Boot0007* Windows Boot Manager   HD(4,GPT,b9a0ae4c-c341-4024-9481-bf920d130a4c,0x11b800,0x679ef8f)/File(\EFI\Boot\bootx64.efi)
Boot0008* Windows Boot Manager   HD(4,GPT,b9a0ae4c-c341-4024-9481-bf920d130a4c,0x11b800,0x666fb46)/File(\EFI\Boot\bootx64.efi)
Boot0009* UEFI: Sony Storage Media PMAP   PciRoot(0x0)/Pci(0x1d,0x0)/USB(1,0)/USB(1,0)/HD(1,GPT,eb0ef56a-4816-4dd1-9067-dfd783891989,0x800,0x301f)..BO

Have you been using bcdedit in Windows to attempt to add Debian to the NVRAM entries?

One of the entries tries to boot grubx64.efi from the second drive, two of the entries reference bootx64.efi on the forth drive (at least I think that's what the output means). Which drive actually contains grubx64.efi & bootx64.efi?

Can we see
Code: Select all
# parted --list

And also indicate which partitions contain which operating systems.

loosemonkey wrote:following the grub reinstallation process

That's too vague, please list the exact commands used. All of them.
User avatar
Head_on_a_Stick
 
Posts: 11992
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Unable to reinstall GRUB

Postby loosemonkey » 2020-03-18 10:39

parted --list:

Image

as far as commands concerned ive followed through this link https://wiki.debian.org/GrubEFIReinstall, using this guide:

Reinstalling grub-efi on your hard drive
Check that the computer booted in computer in EFI mode:

[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
should return "EFI boot on HDD".
After starting a root shell ( if you boot from a live media, you should start a chroot shell instead, as explained in https://help.ubuntu.com/community/Grub2 ... via_ChRoot ) check that your EFI system partition (most probably /dev/sda1) is mounted on /boot/efi. If the /boot/efi directory does not exist, you will need to create it.

mount /dev/sda1 /boot/efi
Reinstall the grub-efi package

apt-get install --reinstall grub-efi
Put the debian bootloader in /boot/efi and create an appropriate entry in the computer NVRAM

which at the above point i would get an error:
Code: Select all
Installing for x86_64-efi platform.
grub-install: error: /boot/efi doesn't look like an EFI partition.


Have you been using bcdedit in Windows to attempt to add Debian to the NVRAM entries?

One of the entries tries to boot grubx64.efi from the second drive, two of the entries reference bootx64.efi on the forth drive (at least I think that's what the output means). Which drive actually contains grubx64.efi & bootx64.efi?



Tried using this command in windows ""bcdedit /set "{bootmgr}" path "/EFI/debian/grubx64.efi" but no changes, booting skips grub and goes into win.

Debian is sitting on partition number 6, swap memory 7, user/home partition is 8.
loosemonkey
 
Posts: 10
Joined: 2018-09-30 09:24

Re: Unable to reinstall GRUB

Postby Head_on_a_Stick » 2020-03-18 19:16


Why are you posting pictures of text rather than the text itself? :?

Anyway, your EFI system partition is on /dev/sda2.

This should create a working NVRAM entry for Debian without you having to mess about with chroots & GRUB:
Code: Select all
# efibootmgr --create --label "Debian" --disk /dev/sda --part 2 --loader /EFI/debian/grubx64.efi

loosemonkey wrote:Tried using this command in windows ""bcdedit /set "{bootmgr}" path "/EFI/debian/grubx64.efi" but no changes, booting skips grub and goes into win.

Hmm, strange, that should work.
User avatar
Head_on_a_Stick
 
Posts: 11992
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to System configuration

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable