Grub2 reinstallation from rescue system

I reinstalled grub2 from Yast on a non-UEFI system. I disabled EFI in Yast, but unfortunately the system did not come back. I now try to follow the steps from
https://www.suse.com/support/kb/doc/?id=000019909
Unfortunately, the procedure does not work. The system has a separate boot partition. If I mount the boot partition into the chroot tree at /mnt/root/boot and then chroot to /mnt/root, I get an error message from grub2-probe: “cannot find a device for / (is /dev/mounted)”. BTW the root partition is encrypted with LUKS and I do a cryptsetup/mount before the chroot.

Thank you in advance. Any help appreciated.

Try:

First mount your root partition (includes use of cryptsetup) at “/mnt”

Then:

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --rbind /sys /mnt/sys
chroot /mnt
mount -a ### mount everything else needed
shim-install
exit ### exit from  chroot
reboot

This is for a UEFI install. For non-uefi grub install, you have to use “grub2-install “location” where “location” is the device on which to install grub – typically the MBR (”/dev/sda" or similar) or the device for “/boot”.

Note the use of “–rbind” for “/sys”. That’s needed for EFI access. And you have to use EFI booting for the rescue system for this to work.

Your mistake seems to be that you missed those “–bind” and “–rbind” mounts. And if you are using “btrfs” for the root file system, then you need that “mount -a” to mount the “btrfs” subvolumes.

2 Likes

Thank you very much. I could now execute the shim-install. I get two identical warnings:
“WARNING: faild to init udev for external device info. using none.”
and an error message:
Could not prepare Boot variable: No space left on device.

The /boot partition is 500Mb with 70Mb used. I also have a /boot/efi partition of 500Mb (vfat) with 5 Mb used.

The laptop is from the pre-UEFI era (AMD E-350), and I booted the Tumbleweed NetInstaller (using the rescue option) from Ventoy. Ventoy does support UEFI, but my guess is, it is a non-EFI boot (is it possible to find out?).

I have also tried the grub2-install with both /dev/sda and /dev/sda2 (/boot partition) both giving me the same error message.

The “No space left on device” is likely referring to the virtual device used to map NVRAM. Your older computer probably has a smaller NVRAM than newer systems.

If EFI is not supported, you should get a different message. What’s the output from:

efibootmgr -v

https://paste.opensuse.org/pastes/29d8ec9531f7

Your system does have some sort of EFI support, but perhaps that’s an older implementation.

Here are some things you could try. First do all of the step I gave in comment #1 above, up to and including the “mount -a”. And then follow that with either:

update-bootloader --reinit

or with:

shim-install --removable

The first of those suggested commands should just reinstall booting as originally configured. The second suggestion sets up UEFI booting, but without using NVRAM. It should correspond to boot entry B00t001F on your provided output.

1 Like

I had to mount the /boot and /boot/efi partitions first and then execute a
mount --rbind /boot /mnt/boot
After that, I could execute both commands. Alas to no effect. When I re-installed grub from yast, I disabled efi and asked to install in the MBR. I was wondering whether I have to undo those changes first, before a reinstall can be successful. When looking through the grub2.cfg, unfortuantely, I could identify settings indicating this configuration.

BTW, thank you for your patience so far.

Another thing I noticed. The laptop directly tries to boot from the network. This suggests that the legacy MBR is not bootable. Otherwise the HD is using a GPT partition table.

Well, I used fdisk to enable the legacy boot flag for the boot partition. This seemed to be set already, but after flipping twice and rebooting, the system boots again. I lost graphical boot, but I can live with that.

Thanks for the help.

I admit to being out of suggestions at this point.

The install media that you are using for the rescue system should also have an option “Boot Linux System”. Have you tried that?

You got it backwards. You cannot “disable efi” from YaST. Your bootloader must match whatever your firmware supports. If your firmware does not boot in legacy BIOS mode, no amount of fiddling in YaST is going to change it.

1 Like

Thanks everybody, my problem is solved. Probably the suggestions of @nrickert repaired the bootloader, but the bootable flag of the partition somehow got wiped which was the final problem to be overcome.

@arvidjaar: I do lack full understanding of the EFI boot process, thanks for the explanation. In Yast, though, it is possible to force an incompatible choice for the installation which caused my problems in the first place.

Users lacking full understanding are warned: The boot loader GRUB 2 | Reference | openSUSE Leap 15.5