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

I have installed a main Manjaro UEFI on sda2 with a GRUB installed on this partition.
(Here I described in details my disks and partions.)

But it the past I installed the second version of Manjaro (16.10) on sda5 and mistakenly installed the second GRUB on sda5.
Then I restored the GRUB on sda2 and used my main Manjaro successfully on sda2 for some time.

But recently I had inexplicable problems with GRUB and now I understood that during booting I do not see the current GRUB from sda2 but the old GRUB from sda5.

I wanted to restore the GRUB on sda2. But despite that I was restoring GRUB to sda2 without any errors, after rebooting I still got the old (and false) GRUB Menu from sda5.

Afer the result of this command:

efibootmgr -v
BootCurrent: 000F
Timeout: 0 seconds
No BootOrder is set; firmware will attempt recovery

I decided to set a boot order to boot from the GRUB on sda2, using the instruction from the website: https://wiki.gentoo.org/wiki/Efibootmgr .

As root, I executed the suggested commands:
mount | grep efivars
mount -o remount,rw -t efivarfs efivarfs /sys/firmware/efi/efivars

And I added, on the basis of the Gentoo’s instruction, as I thought, a correct entry:
efibootmgr -c -d /dev/sda -p 1 -L "Manjaro" -l /boot/PATH_TO_MANJARO.efi
(my EFI partition is sda1)

After that, the command: efibootmgr -v showed a result similar to that of Gentoo, so it seemed to be OK. However, after restart there is an error: https://imgur.com/a/QWS0YZG

What should I do now to restore the normal GRUB Menu and to boot from GRUB on sda2 (and to remove GRUB from sda5 completely)?

Use Manjaro Tutorial

3 Likes

Need help, @majo?
I can make it ‘customized’ to you here.
I understand you want sda2.
But first make sure your sda2 OS has resolved that linux4.9 problem.
Has it?

Please fix that linux4.9 issue in sda2, confirm it fixed and let me know so we can customize the commands for you to get your grub back in sda2.

I’ll wait for your confirmation.

ps: you should be able to boot into sda2 from sda5 grub if linux49 is fixed in sda2.
You can also chroot into sda2 from sda5 to fix your linux49 in sda2.

If you need further help chrooting, or fixing linux49, let us know.
Use the method benob and marcottedan outlined.

[edit] - FYI, just to explain, when you used chroot, probably mhwd-chroot/manjaro-chroot, it took on sda5 instead of sda2. I’ve never used mhwd-chroot/manjaro-chroot and when I chroot (and I cannot remember the last time I did it - probably to test), I use the “basic” chroot method. And don’t forget to also mount $esp (as /mnt/boot/efi).

I have partially solved the problem and now I have the proper GRUB Menu from sda2 :slight_smile:

Answering @gohlip, I have resolved linux4.9 problem.

Unfortunately, I could not apply the whole instruction from Manjaro Tutorial by gohlip.
It was not possible to press ‘c’ as written in point 2. of this instruction on my working Manjaro liveUSB 16.10.3 (I know it should be 17.0.1 and above) and I could not start another liveUSB Manjaro 17.1.10 (maybe it is some problem with my pendrive).

From Manjaro liveUSB 16.10.3 I chrooted to sda2 and, based on gohlip’s tutorial, I did:

sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi
sudo efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l "\EFI\Manjaro\grubx64.efi"

After that I checked boot entries with a command efibootmgr -v and this time there was one correct entry. So I rebooted and a correct GRUB Menu from sda2 appeared (first time since few months).

Now, the situation is as follows:

  1. Booting is correct and now I can finally use a current Manjaro shown in this GRUB Menu ( from sda2).
uname -a
Linux pcn 4.14.48-1-MANJARO #1 SMP PREEMPT Tue Jun 5 18:53:59 UTC 2018 x86_64 GNU/Linux
  1. A command below shows I have no boot entry (though, when I was in chroot mode, there was one boot entry seen here). It it OK, or should I do something?
efibootmgr -v
BootCurrent: 0000
Timeout: 0 seconds
No BootOrder is set; firmware will attempt recovery
  1. I want to remove GRUB from sda5 completely. How to do this? Or maybe it is already removed as a directory /boot/efi/ on sda5 is empty?

  2. When choosing from GRUB Menu to boot from my second Manjaro (16.10.3) on sda5, it is not booting properly (it does not start in graphical mode and when starting from tty it allows you to run only some packages). Few months ago it worked properly. Since I did not update this version of the system, I think that nothing should be changed in this system, and the problems with booting of this system are caused by the wrong call by the current GRUB. How to fix it?

Update the system

It seems so.

You don’t change a winning team. :wink: Though, you might try creating one more boot entry using the same command with different Label (say “Manjaro2”)

1 Like

And if I want not to update it to the current version and to have this second Manjaro in the form it was installed (as 16.10.3), when it was working properly in this time?

@majo

Since, there have been ‘movements’, provide afresh the following booted to sda2 OS.

efibootmgr -v
sudo parted -l
sudo blkid
findmnt -s
findmnt /boot/efi
note: ‘parted -l’ --> small ‘L’ and provide information of all disks.

That does not fit to my answer. My answer is (was?) “Start a new Topic to troubleshoot”, but most troubleshooting starts with “Do a full update first” :smile:

Edit: Infinite loop

@gohlip

efibootmgr -v
BootCurrent: 0000
Timeout: 0 seconds
No BootOrder is set; firmware will attempt recovery
sudo parted -l
Model: ATA ST3500413AS (scsi)
Dysk /dev/sda: 500GB
Rozmiar sektora (logiczny/fizyczny): 512B/512B
Tablica partycji: gpt
Flagi dysku: 

Numer  Początek  Koniec  Rozmiar  System plików   Nazwa   Flaga
 1     2098kB    317MB   315MB    fat32                   ładowalna, esp
 2     317MB     105GB   105GB    ext4            M
 6     105GB     448GB   343GB    ext4            bd
 4     448GB     474GB   25,8GB   ext4            tst24g
 5     474GB     490GB   15,8GB   ext4
 7     490GB     491GB   1341MB   ext4            slitaz
 3     491GB     500GB   8869MB   linux-swap(v1)


Model: ATA FUJITSU MHY2200B (scsi)
Dysk /dev/sdb: 200GB
Rozmiar sektora (logiczny/fizyczny): 512B/512B
Tablica partycji: gpt
Flagi dysku: 

Numer  Początek  Koniec  Rozmiar  System plików  Nazwa             Flaga
 1     1049kB    316MB   315MB    fat32          EFI System        ładowalna, esp
 2     316MB     44,5GB  44,2GB   ntfs           W7                msftdata
 5     44,5GB    200GB   156GB    ext4           Linux filesystem
sudo blkid
/dev/sda1: UUID="DFDC-27CF" TYPE="vfat" PARTUUID="33e218e3-f7ab-4b1e-8a65-15e52ee43baa"
/dev/sda2: LABEL="M" UUID="79492466-7c01-4f91-93b6-d7bc1a79f22d" TYPE="ext4" PARTLABEL="M" PARTUUID="30c70731-28aa-4c2e-8e9b-951f0dc0e81d"
/dev/sda3: UUID="4a557fab-5124-49d5-b531-2d023b88efef" TYPE="swap" PARTUUID="c6e308e6-60df-47f8-b803-ba0bc1f0d90f"
/dev/sda4: LABEL="testy24g" UUID="ccb66e9c-28a3-407a-9e98-33cdfc33a105" TYPE="ext4" PARTLABEL="tst24g" PARTUUID="4b970c56-4688-424b-97de-f3d9dd7ae00d"
/dev/sda5: LABEL="M2r16g" UUID="c0fe9982-bfcf-43b7-a26e-d480011ed2a0" TYPE="ext4" PARTUUID="e233939e-42a6-4eb8-b751-70477d0b4908"
/dev/sda6: LABEL="bd" UUID="84e26864-1cb9-4bd7-9cfd-915a847f1859" TYPE="ext4" PARTLABEL="bd" PARTUUID="26639df1-1172-45f7-9a84-b0144ba68889"
/dev/sda7: LABEL="slit" UUID="f9e1a6e3-9ab1-4e97-ae1f-1d0f953d5ed4" TYPE="ext4" PARTLABEL="slitaz" PARTUUID="aca6d5df-b090-4fe3-817b-ebb712772488"
/dev/sdb1: LABEL="EFI-B" UUID="5576-CD7B" TYPE="vfat" PARTLABEL="EFI System" PARTUUID="4f068499-e42c-40b2-b4b3-987edd834908"
/dev/sdb2: LABEL="hdW7" UUID="0C7F14897F0DDEED" TYPE="ntfs" PARTLABEL="W7" PARTUUID="376d94f8-a572-44f3-af71-ed6c89d3cffa"
/dev/sdb5: LABEL="hdKop" UUID="264e382b-4b5d-4a3f-87c0-69e9c36b43c5" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="f7e2466d-091e-4be1-8528-fe7f5c3ec800"
findmnt -s
TARGET         SOURCE                                    FSTYPE OPTIONS
/boot/efi      UUID=DFDC-27CF                            vfat   defaults,noatime
/              UUID=79492466-7c01-4f91-93b6-d7bc1a79f22d ext4   defaults,noatime
/run/media/ja/bd
               UUID=84e26864-1cb9-4bd7-9cfd-915a847f1859 ext4   defaults,noatime
swap           UUID=4a557fab-5124-49d5-b531-2d023b88efef swap   defaults,noatime
findmnt /boot/efi
TARGET    SOURCE    FSTYPE OPTIONS
/boot/efi /dev/sda1 vfat   rw,noatime,fmask=0022,dmask=0022,codepage=437,iochars

Okay, boot into sda2 OS and at terminal, do the following first.

sudo pacman-mirrors -f 5
sudo pacman -Syyu

Then follow up with the following…
Please print out your input commands as well as the output

LANG=C
uname -r
sudo grub-install
sudo update-grub
sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi
sudo efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l "\EFI\Manjaro\grubx64.efi"
efibootmgr

Reboot (** do not shutdown**) and tell us if it boots and provide new output of

efibootmgr -v

One more thing, can you tell us your computer make and model?

ps: sorry to take some time to reply.
I am thinking there’s nothing there’s obviously wrong with your computer except that your firmware cannot keep the uefi bootentry (and which was working before the linux49 issue)

  • do not pull out any disk
  • do not shutdown, just reboot (maybe a cmos battery)
  • do not pass ‘go’ {just kidding :grinning:}

Is it normal that, even with a proper boot, there is no boot entry in efibootmgr -v ?
I was having a look at this workaround (different path for bootmgr and Win-centric)

UEFI boot loader does not show up in firmware menu

That happens with the few cases of Lenovo like here with the solution.
But since majo was alright before the linux49 issue, it is unlikely to be the case, but I asked what his computer make and model to be sure. Of course if his earlier (before linux49) was in bios-legacy and now it is in uefi, it may be also probable.

Thanks for the brainstorming.

1 Like

@gohlip

My PC data:

inxi -M
Machine:
  Type: Desktop System: Hewlett-Packard product: HP Compaq 6200 Pro SFF PC 
  v: N/A serial: <root required> 
  Mobo: Hewlett-Packard model: 1497 serial: <root required> 
  UEFI: Hewlett-Packard v: J01 v02.15 date: 11/10/2011

And the commands:

sudo pacman-mirrors -f 5
sudo pacman -Syyu

There was a major update here (151 packages, 478,61 MiB , including linux49-4.9.107-2-x86_64.pkg.tar.xz).

The rest of commands:

LANG=C
uname -r
4.14.48-1-MANJARO
 sudo grub-install
Installing for x86_64-efi platform.
Installation finished. No error reported.

sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/boot/bootx64.efi

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

But with sudo there was no error:

sudo efibootmgr -c -d /dev/sda -p 1 -L "manjaro" -l "\EFI\Manjaro\grubx64.efi"
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000
Boot0000* manjaro
efibootmgr
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000
Boot0000* manjaro

Now I will reboot … and we will see :slight_smile:

And after successful rebooting:

efibootmgr -v
BootCurrent: 0000
Timeout: 0 seconds
No BootOrder is set; firmware will attempt recovery

Post also this

inxi -Mxxz

inxi -Mxxz
Machine:
Type: Desktop System: Hewlett-Packard product: HP Compaq 6200 Pro SFF PC
v: N/A serial: Chassis: type: 6 serial:
Mobo: Hewlett-Packard model: 1497 serial: UEFI: Hewlett-Packard
v: J01 v02.15 date: 11/10/2011

I wouls suggest to try this

sudo cp /boot/grub/x86_64-efi/core.efi /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi

Maybe this is important. When I was chrooting to restore GRUB, I had a message:
EFI variables are not supported on this system.
and I had to apply a command to solve this problem:
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
as hinted in https://wiki.manjaro.org/index.php/Restore_the_GRUB_Bootloader#Note

@AgentS
I do not have Windows at the moment. Why should I use something from Microsoft?

Nice question!!
I have no naughty intensions or irony. It is noticed that some hardware are stuborn and they can only “think” of Windows! True Love!!
So, that’s a workaround “in shame”…

Edit: check the link in my previous post (Archwiki)

@mayo,

This is because you were not in uefi boot when you chrooted. Now you are in uefi, otherwise you would get an error too when you use ‘efibootmgr’ command.

That brings up this question. Before the linux49 issue, are you certain you had your sda2 OS in uefi?
Your partitioning may be gpt and you may still have an $esp, but that does not mean it is uefi booted.

Also note in the link, many people with HP has problems with uefi and they resorted to using bios-legacy instead. See the link within that link, under [Difficult setup] - HP link.

And as to ‘using’ or faking windows efi file, that’s because Lenovo (some models) is tied up with microsoft and will only boot windows (or when it is there).

But please try to recollect (or at least guess) if your system was in bios-legacy (pre-linux49 issue).