Score:0

repair both Ubuntu and grub in dual boot system

mg flag

I use a PC with SSD (240GB) and 2 HDDs (2TB and 500GB). I have Ubuntu 22.04.1 and Win10 installed in the SSD, and use the HDD for data.

Recently, after one of the usual Ubuntu updates, Ubuntu stopped working: on start-up, after the grub menu, it remained stuck in the loading screen with the logo, and the spinning icon. It did not continue to the user/password screen.

I created a Ubuntu liveUSB, and chose to replace the current installation of 22.04.1 I had, replacing it with 22.04.1. Installation went ok, until a final pop-up indicated "a grub error" (sorry I cannot be more specific). However, the installation's final message was that installatation had been successful.

After this, on start-up, grub no longer loads, and the PC would enter grub rescue.

I then used the liveUSB session to run boot-repair. Before running the recommended repair, I ran an analysis, the report is: https://paste.ubuntu.com/p/kt7xKPF8DQ/ After running the recommended repair, the report is: https://paste.ubuntu.com/p/y2XQN2hhMJ/

I had ran boot-repair previously for other issues some years ago, and it worked fine. However, this time, running boot-repair did not seem to solve anything, and the PC still loads directly into grub rescue.

Quite out of my depth, I found in several pages which indicated a similar solution for grub rescue, and have followed the instructions. When typing "ls", the only unit which has a known filesystem, is (hd1,msdos6), which has an ext2 filesystem. Since normal.mod file was not in the usual place, I had to look for it. I have found the "normal.mod" file in (hd1,msdos6)/boot/grub/x86_64-efi/

But when I run the sequence:

set root=(hd1,msdos6)

insmod (hd1,msdos6)/boot/grub/x86_64-efi/normal.mod

The usual solution setting a prefix and then "insmod normal" does not find "normal.mod" file, so I use this instruction instead) After the "insmod (hd1,... [etc]", I receive the following error, and I am stuck now:

error: invalid arch-dependent ELF magic.

Gparted screenshots:

SSD, OSs and programs in the SDD. Win10 installed in largest partition, Ubuntu in 40MB partition

HDD1, this is where data is stored

HDD2, this hard drive is not really used for anything

I would like to recover both operating systems, and also make sure the data in HDD1 is not altered. Would really appreciate any help.

David avatar
cn flag
You can start by trying this command in a terminal sudo update-grub
oldfred avatar
cn flag
It looks like you have 4 different grub installs. three in MBR and one in ESP - efi system partition. But drives are all old MBR, not gpt. Windows only installs in BIOS boot mode to MBR. Ubuntu can install in BIOS or UEFI to MBR, but UEFI really should use gpt partitioning. Since conversion from MBR to gpt erases drive, you probably should stay with old BIOS/MBR, but plan future conversion to UEFI/gpt. So which boot loader is correct one? Have you tried all of them? Or choose one & run Boot-Repair to fix that one in BIOS mode since Windows BIOS boot.
Íñigo avatar
mg flag
@David In order to run sudo update-grub, I followed what is indicated here: <https://askubuntu.com/questions/145241/how-do-i-run-update-grub-from-a-livecd>, but after following the various alternatives, ended up with the "ELF magic" error.
I sit in a Tesla and translated this thread with Ai:

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.