Lost grub after update 4/23

After a zypper up this am, I lost grub. Saw dracut message that zypper didn’t have enough space to delete grub files after update. Upon reboot, no grub, goes only to windows. Hence, I am now on windows.

I have only 100mb EFI boot partition. Inherited from long ago. Ran live gparted that showed 37mb used of the 100mb so there is space.

Question 1. How can I recover grub EFI boot partition w/o corrupting windows? Perhaps, I can reinstall grub. I need detailed instructions.

Question 2. The EFI boot partition is surrounded by small windows partitions. One side is 450 mb windows recovery partition that has 306mb used of the 450mb. On other side is small 16mb windows micro reserve partition. I will try to find if the windows recovery part can be downsized w/o corrupting windows from window blogs. fI someone knows about this let me know.

My plan would be to get grub running to get into linux. Then try to resize windows recovery partition to 250mb. Any advice would be appreciated?

COMPUTER: windows10, opensuse 15.2, dual boot. no secure boot enabled in bios, windows, or opensuse.

thanks, tom kosvic

It is difficult to know what happened.

The 100M EFI partition is probably enough. The problem, though, is that you need to get into your system to fix it.

If you still have the install media, boot that to the rescue system and login there as root. Get the output from:

fdisk -l

and post that here. If possible, identify which partitions are which.

Output of fdisk -l

From leap15.2 dvd rescue mode:
fdisk -l (had to hand copy on paper and retype so couldn’t paste into code block)

"partition 1-4 all say in red, Does not start on partition boundary. This is not new.
disk /dev/loop0: 32mib
disk /dev/loop1: 14.4 mib
disk /dev/loop2: 59.4 mib
disk /dev/loop3: 46.1 mib
disk /dev/loop4: 4.1 mib
disk /dev/loop5: 82 mib

disk /dev/sdc: 596 gib
disk /dev.sdb: 2.7 tib

/dev/sdb1 1.8 tib /linux
/dev/sdb2 976 gib hpres/ntfs/exfat"

I recognize none of these /dev/loop partition sizes. Something really screwed up. I have one large hd (3 tb) that has linux and windows and two external drives for backup. Fdisk only found 1 though.
Live dvd Gparted still shows disk partitions as before. /root 100gig, /home about 2 terra and swap and efi boot 100mib. Windows about 980 gb

I can’t print gparted partition diagram. Perhaps I could photo it and put it up from windows. Let me know if needed.

Need instructions to proceed.

thanks, tom kosvic

The “/dev/loop” file systems are all internal to the linux rescue media that you used. So you can ignore those.

Here’s what I suggest:

Try again with that rescue disk.

This time, mount the EFI partition at “/mnt”. I can’t give the full details because you didn’t show the partitions. But it will probably be something like:

mount /dev/sdaX /mnt

And then you can use:

cd /mnt
fdisk -l > fdisk.out

That way, the output will be in a file where you can access it from Windows. You might need to use the Windows disk management tools to make that partition accessible, so that you can find the file.

While looking for that file, the EFI partition may have a subdirectory “EFI” and another “EFI\opensuse”. If you find that, a listing of that directory would also be helpful.

I will work on your requests. I am not sure how to get windows to read linux file so might take some time. I know linux reads windows nfts files.

Inlive dvd gparted, efi boot (sda6) partition (100 mb) has boot flag checked.

Root partition sda11 has legacy boot checked. Not boot

Will get fdisk -l output onto forum.

tom kosvic

Windows can read linux text files. But you might get a staircase effect, as in:

this is line 1
                   this is line 2
                                     this is line 3

Inlive dvd gparted, efi boot (sda6) partition (100 mb) has boot flag checked.

Root partition sda11 has legacy boot checked. Not boot

That’s helpful.

Windows can’t read linux ext4 file system for the text files. It’s not the text files that only differ between windows and linux by the end of line characters, it is the file system.

I’ve created the requested fdisk files and directory text files that are on linux partition but I cant get a windows app that will read them so that I can post them to forum.

Still working on it

I am spending too much time getting fdisk and directory text files off of ext4 file system. Windows apps for doing this are terrible.

I am planning to simply reinstall grub using instructions in:

How to reinstall the GRUB boot loaderThis uses command:

grub-install --root-directory=/mnt /dev/sda

Does anyone see this as a problem??

thanks, tom kosvic

That’s why I suggested putting them on the EFI partition, which is a file system that Windows can read.

I think that’s for original legacy grub, not for grub2.

With grub2, we need to first find whether you are using UEFI booting or legacy MBR booting. How to reinstall grub affects that.

Did some looking around re: EFI boot.

  1. Bios says I am doing EFI boot as I have always thought. Secureboot is disabled in bios, yast, and windows

  2. From rescue disk, efibootmgr -v, gave a list of boot options and did not error out.

  3. Live gparted disk shows flags for:

        EFI boot partition (100mb) - both boot (not legacy boot) and esp are checked.  I don't know what ESP is.
        root partition (100gb)  - only legacy boot is checked

I think I need to reinstall grub2 using:

[CODE[b]grub2-install --root-directory=/mnt /dev/sda]

Anyone see any problems with this????

thanks, tom kosvic

Additional thought,

Should I modify flag on root directory from “legacy boot” to “boot” to eliminate any possible calls to grub as opposed to grub2?

I think I should.


tom kosvic

When I run:

grub2-install --help

I do not see any mention of “–root-directory”. So I’m not sure if that is a valid option.

What I usually recommend is:

Mount your root directory at “/mnt”
And then:

mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt
mount -a  ## to mount everything else
grub2-install --target=x86_64-efi

In live gparted, should I modify the existing flag on root partition from “legacy boot” to “boot” to eliminate any possible calls to grub as opposed to grub2? This is done through gparted live disk.

thanks, tom kosvic

No. That’s not what the “legacy_boot” flag is for. There’s no need to change it.

You might need to unset the “pmbr_boot” flag if that is set. Some BIOS are fussy about that.

One more, hopefully last, question. From your command list above, should I cd to /mnt after mounting root partition to /mnt. Then run all the mount --bind commands and remainder including grub2-install from inside mnt. Or should I stay in root directory and run the commands from root?

thanks for any insights.

tom kosvic

The “chroot /mnt” already does that, and makes it so that the root file system now appears to be at “/”.

worked like a champ. Linux is back. I hate windows.

Now, how can I find out what happened to cause this so to keep it from reoccurring?

Also, should I do zypper up updates? That is what caused it.

If it happens again though, I do have instructions that should fix it.

thanks much. tom kosvic

I’m glad things are working again.

I do not know what happened.

Can you post the output from:

grep SECURE /etc/sysconfig/bootloader

There was an update to “grub2” and to “shim” recently (perhaps 3 days ago). I have not yet installed that on my main desktop, but I have installed it on a couple of other systems where it went fine. But there are bug reports that the new “shim” does not work with some BIOS. It’s possible that you ran into this problem.

The way that you reinstalled grub2 does not use “shim”, but it is likely that it did use “shim” at the time it broke. The output that I requested will tell me whether you were using “shim”.

And I guess that I should now try updating “shim” on my main desktop to see if it breaks.

Looked at update history file in yast software management. Last update on 4/23 showed that 3 grub2 files successfully installed (they are checked as installed) plus about 20 others. I think my manual installof grub2 from rescue does not show up there.

Still does not tell me what happened to lose grub or whether to continue with zypper up.

zypper has 50+ updates and a systemd file that needs a reboot awaiting. I did not do it yet pending any advice.

tom kosvic