How to restore the normal GRUB Menu and to restore the correct GRUB version

Wait. I have an idea.
Pleas wait for 15 minutes while I rethink if the idea is feasible/possible.

sda2 OS was always in uefi.

But few weeks ago there was Windows XP installed on another disk sdb.
In this time the whole sdb disk was under MBR and to login to Windows I was forced to switch in my EFI/Bios from “AHCI mode” to “Legacy Bios mode”. But after removing Windows XP I converted the whole sdb disk from MBR to GPT with UEFI and computer runs now in “AHCI mode” only.

I was thinking of

efibootmgr -c -d /dev/sda -p 1 -L “manjaro” -l “\EFI\boot\bootx64.efi”

since
sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi
was successful. But “No BootOrder is set”, But we can try.

Tell us, and it is important. Can you boot windows now? How?

[edit] another question.

Does that mean you can reboot to sda2 Manjaro OS even without any efibootmgr entry?

Note - 3 things here in this post.
o try efibootmgr -c -d to bootx64.efi
o can you boot windows?
o can you reboot to manjaro sda2? wihout doing anything?

The same error:

efibootmgr -c -d /dev/sda -p 1 -L “manjaro” -l “\EFI\boot\bootx64.efi”
Could not prepare Boot variable: No such file or directory

I do not have Windows now.
When I had it (few weeks ago)

  • to boot Windows XP I had to switch in my EFI/Bios from “AHCI mode” to “Legacy Bios mode” ;
  • to boot Manjaro I had to switch in my EFI/Bios from “Legacy Bios mode” to “AHCI mode”.

Yes. It seems so.

This is weird!

And windows - please reconfirm situation now,
Can you still boot windows in bios-legacy now? (or anyhow?)

[EDIT] - one more question, at manjaro (sda2) terminal
what’s output of

test -d /sys/firmware/efi && echo UEFI || echo BIOS

As I do not have Windows installed now, I can not say anything about booting it.


 test -d /sys/firmware/efi && echo UEFI || echo BIOS
UEFI

Ok, clear (from you). But my guess is that your uefi firmware either hides the uefi bootentries and is actually not booting ‘manjaro’ entry but the boot.efi (which we copied from core.efi).

Now since you can boot manjaro in your preferred OS (sda2), let’s leave it for now, but by all means if you have more info for us, we’ll be happy to hear it.

There is one thing though I’d like you to check out.
Go to F2 (bios-setup) when you restart your computer and (usually) under “Boot” section, see if there is any boot entries there. They may be listed (normally, but not yours I think) like ‘manjaro’, ‘windows boot’, ‘ubuntu’ etc. They may also list like disk device, like ‘Seagate-xxx’, ‘Kingston-xxx’ and so on. If it list device, it boots manjaro because we set bootx64.efi to manjaro earlier.

Take your time on this.
And please put a @gohlip and @AgentS (I bet he will also want to know) so we won’t miss your message.

Cheers, take care, (for now).

1 Like

What if ? (just copy this text, not just transcribe)

efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l "\EFI\boot\bootx64.efi"

and what if you tried the “Windows” version?

Edit: I think I found something
Try this

efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l /EFI/boot/bootx64.efi
1 Like

I am always coping texts. So:

efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l "\EFI\boot\bootx64.efi"
Could not prepare Boot variable: No such file or directory

efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l /EFI/boot/bootx64.efi Could not prepare Boot variable: No such file or directory

Windows version (translated into English)

sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi
cp: you can not create a regular file '/boot/efi/EFI/Microsoft/Boot/bootmgfw.efi': There is no such file or directory

But, as @gohlip wrote, uefi firmware hides the uefi bootentries (but remembers, as shown below), so let’s leave it for now :slight_smile:

One more question to @gohlip, if you agree with @AgentS that as a directory /boot/efi/ on sda5 is empty, it means that GRUB from sda5 is already removed?

Let me explain a bit, at least AFAIK.

  • Grub install means a loader (file) is “pinned” in a proper place for the system, so BIOS/UEFI give control to it.
    • In MBR/Legacy BIOS systems, this is at the MBR, a special place at the start of disk. That’s why on Legacy BIOS systems we “Install Grub” at the Drive (i.e. grub-install /dev/sda
    • In UEFI/GPT systems it is a VFAT partition which corresponds (in Linux) to /boot/efi. That’s why we install Grub at /boot/efi, which, since at the time of the installation, Linux system is “live” and knows (we flag for UEFI) that has to install on /boot/efi in whatever drive it is already mounted, so we install without any target drive grub-install
      Then UEFI scans the drives during initialization/boot and finds any proper files/loaders at any proper readable (VFAT) partitions on any drive. And fills the bootloader list.

Now in your situation, UEFI will not find /sda5 uefi, because it is the same as the sda VFAT partition (mounted from grub/Linux) as /boot/efi
What is different is more boot entries, so we can create more Boot Sets in /boot/efi in a folder containing several boot sets (bootloaders/files, rEfind loader set etc)

@gohlip should confirm or correct this.

1 Like

This may very well be an UEFI bug, in which case it is a good idea to check for an UEFI update at your manufacturer.

Aha, good that you have that screenshot.
It clearly shows a ‘manjaro’ in that “EFI Boot Sources” so at least your firmware is not that ‘bad’ and we can install another distro :sweat_smile: and select priority from that screen.
Just that in efibootmgr from terminal, it won’t appear but with “Could not prepare Boot variable: No such file or directory”. Strange still, but better than expected. Good.

Now, your question.

Normally, but remember your system is a bit ‘different’, removing a whole OS (meaning sda5) will still leave the efi file in $esp, and even if we remove that efi-file, say ubuntu/grubx64.efi, the bootentry will remain and will show in ‘efibootmgr’ command until we remove it with command “efibootmgr -b xxxx -B”. Again, remember your system does not even show anything in ‘efibootmgr’ even though it is clearly there.

And having 2 manjaro OS’s will only create one ‘manjaro’ efibootentry and that will be latest OS that we generate the efibootentry (like efibootmgr -c -d …). We can have 2 manjaro bootentries if we ‘label’ them differently using --bootloader-id=manjaro2 for example and proposed by petsam earlier on.

I think that also clarifies petsam’s post above.

Also petsam suggestion for a firmware upgrade for your bios may be a good idea, but it can be difficult and risky if not done well. Most will leave it alone than taking that risk. Hopefully, it will be simpler (and less risky) in the future. If unsure, leave that alone. I myself have not done this and not willing to take the risk, but I do not have any major issue with my bios. If petsam or others wants to guide you along, that will be good.

Cheers. Good to have that screenshot.

[edit] - oh, an explanation for petsam’s suggestion to ‘copy’ not ‘transcribe’ my commands.
this discourse forum ‘modifies’ the parenthesis from ("xxxx") to (“xxxx”) { can you see the difference?} if it is not placed in ‘codes’ or fences. He wants to be sure you wrote or copied the parenthesis well. I made sure it is ‘fences’ so you can copy correctly, but it is good of him to make doubly sure this wasn’t the cause of the ‘error’.

2 Likes

OK. Thank you @gohlip and @AgentS for your help.
I assume that GRUB from sda5 will never appears again (as it did few months ago - probably in connection with multiple Manjaro’s installations + Windows + disks on UEFI + MBR).
And I do not want to try and risk to upgrade BIOS, as generally it works.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by Bytemark