Score:0

Boot hangs at GRUB prompt instead of GRUB menu

us flag

I installed Ubuntu 21.10 on a new machine. Then I needed to dual boot Windows 10, so I booted to a live USB and shrunk the Ubuntu partition. Windows installed fine, but apparently squashed GRUB. I was able to recover using boot-repair from the live USB, but it boots to the GRUB prompt, where I have to manually:

set (seems to remember these between boots after I do it once):

prefix=(hd0,gpt2)/boot/grub
root=hd0,gpt2

I have to manually:

grub> linux /boot/vmlinuz-5.13.0-22-generic root=/dev/nvme0n1p2
grub> initrd /boot/initrd.img-5.13.0-22-generic
grub> boot

This successfully boots me into Ubuntu.  Once there, I ran boot-repair again. but when I reboot, I'm back at the GRUB prompt. I'd like a GRUB menu showing Ubuntu, Windows, etc.

Here's boot-repair's report: https://paste.ubuntu.com/p/FRgPjN9BGr/

note: I cobbled the above together from googling. I don't really understand what I'm doing and don't have experience with GRUB or bootloaders.

UPDATES: i tried boot-repair from the live USB again.

-if i use the recommended repair, it seems to do nothing other than generate this report: https://paste.ubuntu.com/p/xVXDqGPykW/ the results are the same as before (fails to boot and winds up at GRUB prompt with "Failed to open \EFI\UBUNTU Failed to load image \EFI\UBUNTU\ start_image() returned Invalid Parameter, falling back to bootloader")

-if i try "advanced" and don't change any options, i get the same as above with this report: https://paste.ubuntu.com/p/hbr7tpRFdZ/

-if i try "advanced" and add "Purge GRUB before reinstalling it," i get a dialog that says "GRUB is still present. Please try again." this is after confirming to remove GRUB after being asked to run: sudo apt-get purge --allow-remove-essential -y grub*-common shim-signed

at that point, i have no choice but to cancel.

-if i try "advanced" and add both GRUB purge and "Purge kernels then reinstall last kernel," it's been stuck for over an hour on "Purge kernels then reinstall last kernel on nvme0n1p2 (pur). This may require several minutes..."

Nmath avatar
ng flag
`boot-repair` must be run from a live session. You can't run it from your installed system. Try again, but from a live session (Try Ubuntu from installation media). FYI, if you ever need to set up dual-boot config in the future, it's better to install Windows first. The Ubuntu installer knows how to install alongside Windows. The Windows installer doesn't care what's there before it and will change the boot priority to itself instead of GRUB. And Windows will not be added to the GRUB options automatically unless Windows is first.
oldfred avatar
cn flag
Ghe grub in the ESP which is only 3 lines is pointing to p3. Your p3 is shown as Microsoft Reserved & has that typical size but also as ext4. It must be unformatted. And the grub in the ESP must then use UUID of p2. You can just manually edit that /EFI/ubuntu/grub.cfg with UUID of p2, see line 226. Or use Boot-Repair's advanced mode to do a total reinstall of grub & kernel which will reset everything to correct defaults. You have to use gparted to change p3 to unformatted separately.
us flag
thanks Nmath and @oldfred - i updated above, still stuck...
oldfred avatar
cn flag
Post new link to summary report after your fixes. You did a full reinstall of grub, not just a grub-update?
us flag
@oldfred - i edited the main question with what i did and the reports -- see after "UPDATES." basically, i checked "grub purge" and "kernel purge" under "advanced," and `boot-repair` has hung. i was thinking of using this method: https://askubuntu.com/questions/1253247/how-to-fix-or-remove-a-broken-kernel-ubuntu-20-04/1253346#1253346 to try to recover now, but i am unsure of how to kill `boot-repair` in a way that it won't leave a mess of `apt` cache locks.
us flag
@oldfred - i had started `boot-repair` in the background and closed its terminal, so i don't know how to figure out what all pid's it started. `ps -e | grep repair` brings up around 6 matches, and none of those have the pid for the `apt-get` process that is currently holding a bunch of cache locks...
oldfred avatar
cn flag
I sometimes open synaptic & then try to update from terminal. I get the cache lock issue. You can only have one update process running at one time. Do you have any other program running besides Boot-Repair?
us flag
@oldfred -- right, no i have nothing else running, i'm sure this is `boot-repair`'s `apt-get` process. i can see in `boot-repair'`s log (`/var/log/boot-repair/...`) that it seems to be `apt-get` which has hung, just after `boot-repair` asked it to `purge linux-image-*`...
oldfred avatar
cn flag
You can manually edit /EFI/uubuntu/grub.cfg which has wrong UUID. See line 297 and actual / UUID on line 272 & 305. Copy correct UUID into the grub file. If mounted from live installer path will include that mount also.
us flag
@oldfred, ok tried that, same results. here's `boot-repair`'s latest: https://paste.ubuntu.com/p/nkWcdPrNXT/
us flag
also asking here: https://ubuntuforums.org/showthread.php?t=2470507&p=14073470#post14073470
oldfred avatar
cn flag
Looks like it should boot. Only issue seems to be the Microsoft reserved is showing as ext4 and should be unformatted.
Score:0
us flag

manually booting into the install, and doing grub-install and update-grub seemed to fix it. i'm not sure why, i feel like i did those a million times with no change. it could be that i did them from the live usb, i can't remember -- but people said it should work from there. i don't get it -- if anyone can figure out what all went wrong, please share!

thanks to @oldfred who kept helping me til it worked :)

https://ubuntuforums.org/showthread.php?t=2470507&page=2&p=14073576#post14073576

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.