You are not logged in.

#1 2020-11-02 12:29:44

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

[SOLVED] Boot to 'grub' shell after modifying UEFI/GPT partition table

Hi. I am working on an Arch system (up to date as to a month ago) that must have been a dual boot Ubuntu/Arch with chainloading when it was first installed. The box boots on UEFI/GPT. I messed up one of the old Ubuntu partitions and now booting lands me at the grub cmd shell prompt. There is plenty of doc and posts to go by, starting with the Arch Wiki on grub, but I'm stuck although I *seem* to have retained some of the grub config files.

I understand from the Arch Wiki that

if the partition layout changes GRUB may fail to boot. When this happens, a command shell may appear.

  What I tried so far:

grub> ls
(hd0) (hd0,gpt11) (hd0,gpt10) (hd0,gpt9) (hd0,gpt8) (hd0,gpt7) (hd0,gpt5) (hd0,gpt1)
grub> ls (hd0,gpt1)/efi
./  ../  ubuntu/  Dell/  boot/  arch/  arch-linux/
grub> ls (hd0,gpt1)/efi/arch
./ ../ fw/ fwupdx64.efi grubx64.efi
grub> ls (hd0,gpt1)/efi/boot
./ ../ bootx64.efi

The above EFI partition corresponds to /boot/efi on /dev/nvme0n1p1 on that box.

grub> ls (hd0,gpt8)/boot
./ ../ efi/ grub/
grub> ls (hd0,gpt8)/boot/grub
./ ../ x86_64-efi/ locale/ themes/ fonts/ grubenv
grub> set prefix=(hd0,gpt8)/boot/grub
grub> insmod linux
grub> set root=(hd0,gpt8)
grub> linux /boot/vmlinuz-linux  root=/dev/nvme0n1p8
error: file '/boot/vmlinuz-linux' not found

So the box' /dev/nvme0n1 setup is:

p1.  /boot/efi
p7.  /home
p11  swap
p5.  /boot
p8.  /
p9.  /var
p10. /data

Am I on even the right track ? Your help will be much appreciated.

Last edited by Cbhihe (2020-11-02 16:42:41)


I like strawberries, therefore I'm not a bot.

Offline

#2 2020-11-02 13:01:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Boot to 'grub' shell after modifying UEFI/GPT partition table

If you indeed have a seperate /boot partition why aren't you looking into p5 ? That's where I'd suspect the kernel images.

Offline

#3 2020-11-02 14:00:43

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

Re: [SOLVED] Boot to 'grub' shell after modifying UEFI/GPT partition table

Yes.

grub> ls (hd0,gpt5)/
lost+found/  intel-ucode.img  vmlinuz-linux  initramfs-linux  initramfs-linux.img  initramfs-linux-fallback.img  grub/   efi/

Tx. When I do:

grub> set root=(hd0,gpt8)
linux (hd0,gpt5)/vmlinuz-linux root=/dev/nvme0n1p8
initrd (hd0,gpt5)/initramfs-linux
boot

... the box boots normally. But then do i need to rebuild the grub config from console ?


I like strawberries, therefore I'm not a bot.

Offline

#4 2020-11-02 14:07:07

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Boot to 'grub' shell after modifying UEFI/GPT partition table

Assuming the GRUB was/is configured from the Ubuntu install I suggest you properly reinstall it from Arch.

https://wiki.archlinux.org/index.php/GR … allation_2
https://wiki.archlinux.org/index.php/GRUB#Configuration

Offline

#5 2020-11-02 15:27:53

Cbhihe
Member
Registered: 2017-04-09
Posts: 219

Re: [SOLVED] Boot to 'grub' shell after modifying UEFI/GPT partition table

Ok. In normal console from the Arch system, I first installed package `efibootmgr` and ran:

> sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
Installing for x86_64-efi platform.
Installation finished. No error reported.
>

... then checked files' timestamps in /boot/grub, which reflects the last install as of a few minutes ago.
However also checking `grub` menu's entries, I see:

> efibootmgr -v
BootCurrent: 0004
Timeout: 0 seconds
BootOrder: 0002,0001,0004

Boot0000  Windows Boot Manager  HD(1,GPT,895c6614-4a7d-40e2-9440-b998381f40d0,0x800,0xfa000)/File(\EFI\Microsoft\Boot\b│
ootmgfw.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.}...1

Boot0001  ubuntu        HD(1,GPT,5e6ed8e6-c6e7-4cee-b5d2-8dbc18c5e720,0x800,0x5f000)/File(\EFI\ubuntu\shimx64.efi)

Boot0002* GRUB  HD(1,GPT,5e6ed8e6-c6e7-4cee-b5d2-8dbc18c5e720,0x800,0x5f000)/File(\EFI\GRUB\grubx64.efi)

Boot0004* UEFI 2.0a, Partition 1        PciRoot(0x0)/Pci(0x1d,0x0)/Pci(0x0,0x0)/NVMe(0x1,00-23-03-56-10-04-92-11)/HD(1,GPT,5e6ed8e6-c6e7-4cee-b5d2-8dbc18c5e720,0x800,0x5f000)/File(\EFI\ubuntu\shimx64.efi) 

So if I want to get rid of entry 0001, respectively for Ubuntu (since there is no actual entry in the GRUB menu for Windows (Boot0000)):

> sudo efibootmgr -bB 0001
> sudo grub-mkconfig -o /boot/grub/grub.cfg

... is how I ended up handling that, so user is only left with both GRUB and the last entry (Arch linux).
Thank you for pointing me in the right direction. ;-)

Last edited by Cbhihe (2020-11-02 16:41:38)


I like strawberries, therefore I'm not a bot.

Offline

Board footer

Powered by FluxBB