Need to repair GRUB

Hello,

I wanted to “repair” my GRUB installation.
The problem I had was that I could only start openSUSE Tumbleweed when I did not press any button on my keyboard (CORSAIR K55).
When using the keyboard (for example Up/Down button) it freezes.

I found something that might help to add to the GRUB parameters.
But I think I broke it.

When I start now I get the message

error: …/…/grub-core/net/net.c:1474:disk ‘hd0,msdos1’ not found

Now I try to reinstall GRUB by starting the computer with a live linux system (using my Pop_OS USB-Stick).

I tried to enter these commands:
http://logan.tw/posts/2015/05/17/grub-install-and-btrfs-root-file-system/

These are the devices from my computer

pop-os@pop-os:~$ sudo fdisk -l
Disk /dev/loop0: 2.47 GiB, 2647793664 bytes, 5171472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Sabrent                                 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0fe638de

Device         Boot     Start        End   Sectors   Size Id Type
/dev/nvme0n1p1 *         2048  991822511 991820464 472.9G 83 Linux
/dev/nvme0n1p2      991822512 1000211118   8388607     4G 82 Linux swap / Solaris


Disk /dev/sda: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WDS200T2B0A 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04e73335

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sda1  *          2048     104447     102400   50M  7 HPFS/NTFS/exFAT
/dev/sda2           104448 3905949044 3905844597  1.8T  7 HPFS/NTFS/exFAT
/dev/sda3       3905949696 3907024895    1075200  525M 27 Hidden NTFS WinRE


Disk /dev/sdb: 7.52 GiB, 8069873664 bytes, 15761472 sectors
Disk model: DISK            
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x40252db8

Device     Boot   Start      End Sectors  Size Id Type
/dev/sdb1  *          0  5907839 5907840  2.8G  0 Empty
/dev/sdb2           484     8675    8192    4M ef EFI (FAT-12/16/32)
/dev/sdb3       5910528 15761471 9850944  4.7G 83 Linux

I start with this command:

pop-os@pop-os:~$ sudo mount -t btrfs -o subvol=@ /dev/nvme0n1p1 /mnt/

But the next one doesn’t work

pop-os@pop-os:~$ sudo mount --bind /dev /mnt/dev
mount: /mnt/dev: mount point does not exist.

These are the directories from my Tumbleweed installation

pop-os@pop-os:/mnt$ ls
boot  etc  home  opt  root  srv  usr  var

Do I need to create these folders?
Do you have any tip how I can mount Tumbleweed and update/repair GRUB?
Thank you very much!

It looks as if you are only mounting a subvolume and not the full root filesystem.

I suggest:

mount /dev/nvme0n1p1 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
mount -a  ## this should mount anything else needed, including the subvols
  ### now use commands to install grub (maybe grub2-install).

I hope that helps.

Thank you…
After using your commands everything worked until this command from the linked website.

grub-install --recheck /dev/nvme0n1p1

The solution was working

grub2-install --recheck /dev/nvme0n1p1

The next command also did not worked

update-grub

This command was working

pop-os:/ # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-6.2.1-1-default
Found initrd image: /boot/initrd-6.2.1-1-default
Found linux image: /boot/vmlinuz-6.2.0-1-default
Found initrd image: /boot/initrd-6.2.0-1-default
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
8631.112800 | DM multipath kernel driver not loaded
WARNING: failed to init udev for external device info, using none.
grub2-probe: error: cannot find a GRUB drive for /dev/sdb1. Check your device.map.
Found Windows 10 on /dev/sda1
Found Windows 10 on /dev/sda2
done

Now I will restart.
Hope it works now :slightly_smiling_face:

Unfortunately i got the same error message :neutral_face:
Maybe updating GRUB doesn’t worked (how I did it).

Some distros use “grub-install” while some use “grub2-install”.

Some distros use “update-grub” while others use “update-bootloader”.

For openSUSE, best to run “update-bootloader” while you are still in that chroot environment.

Ok. I will try that.
Thank you :slight_smile:

Unfortunately i get the same error message again.
“update-bootloader” was running (without any feedback).
Maybe there are grub-files updated that are not used after rebooting…

It’s a bit hard to diagnose without more information.

What kind of information would help?
I’m currently running Pop_OS Live. I maybe can check how the GRUB configuration is now set on my Tumbleweed system.

I also searched with the keyword “disk ‘hd0,msdos1’ not found” and found some links…

I will try to post everything that might help (me).

Maybe it will be easier for me to backup the home folder and make a new installation?

1 Like

Is this UEFI booting or BIOS booting?

Can you post the output from:
fdisk -l

1 Like

The output of fdisk -l is in my first post.
As far as i asume the BIOS is booting.
The boot mode is set to “Legaacy+UEFI” and the first option is “Hard Disk:Sabrent”

May it help when i unplug my separate SSD with the Windows installation?

I missed that, partly because of the way that you quoted your commands. I’ve taken the liberty to edit your opening post to change that formatting and make it easier to distinguish the computer output.

Does Windows use UEFI booting or does it use BIOS booting (traditional MBR booting)? Oh, it is probably traditional BIOS booting, because there isn’t an EFI partition on that disk. But there is an EFI partition on “/dev/sdb”, which is perhaps what you are using to boot “pop-os”.

I do see a possible problem. For reinstalling grub, you used:

grub2-install --recheck /dev/nvme0n1p1

That installs grub in the first partition. But that will only work if you already have generic boot code in the MBR of that disk. You could try instead, using:

grub2-install --recheck /dev/nvme0n1

You would need to first repeat the various mount steps that I gave in my first reply.

1 Like

Another alternative would be to install generic boot code in the MBR.

mount /dev/nvme0n1p1 /mnt
cd /mnt/usr/share/syslinux
ls -l mbr.bin

The file should exist, and be 440 bytes long. That’s generic boot code for the MBR.

You can install that with:

cat mbr.bin > /dev/nvme0n1

Hi nrickert,
the file exist and has exactly 440 bytes.

When I run the command

sudo cat mbr.bin > /dev/nvme0n1

I got as response

bash: /dev/nvme0n1: Permission denied

Do I need to use before?

chroot /mnt

:confused:

I think that’s a limitation of how you are using “sudo”.

When you use:

it runs that “cat” command as root, but the output redirection (due to “>”) is still done as an ordinary user. But it is that redirection that needs to be done as root.

Try, instead:

sudo dd if=mbr.bin of=/dev/nvme0n1 bs=440 count=1

That assume that you have already changed (with “cd”) to the directory with “mbr.bin”. You do not need to “chroot”, as long as your pop-os system has the “dd” command.

I tried both last methods and always got the same error message while booting.
I will copy my home directory to a USB stick and install the operating system new…
@nrickert Thank you very much trying to help me. I wish you a nice Thursday and weekend!
Greeting from Germany/Munich