You are not logged in.

#1 2018-03-21 04:55:41

Biboozz
Member
Registered: 2016-10-18
Posts: 64

efibootmgr reset after reboot

Hello,

I'm in trouble with my EFI systeme partition. I followed the steps detailes in the official wiki and it work really well until i reboot my computer.

ust after running the following commands it look like everything went well:

$ grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=arch_grub
Installing for x86_64-efi platform.
Installation finished. No error reported.

$ efibootmgr
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0000,0003,0001,0002
Boot0000* arch_grub
Boot0001  Hard Drive
Boot0002  USB KEY
Boot0003* UEFI OS

$ ls /boot/efi/EFI/arch_grub/
grubx64.efi

$ parted /dev/sda print
Model: ATA OCZ-TRION150 (scsi)
Disk /dev/sda: 240GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End    Size   File system  Name  Flags
 1      1049kB  316MB  315MB  fat32              boot, esp
 2      316MB   108GB  107GB  ext4
 3      108GB   240GB  132GB  ext4

As you can see everything look normal, and my esp is in /boot/efi on wich is mounted /dev/sda1 with the following properties:

  • Size: 300Mo

  • Filesystem: fat32

  • Flags: boot, esp

The problem

Well it start just after rebooting my computer first of all no entry are found on bootup (in BIOS level) so i boot on my live USB stick (or on nothing if it is not plugged in).

Si if i run the following command (with or without chroot) it look like my efibootmgr change were not saved:

$ efibootmgr
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0001,0002
Boot0001  Hard Drive
Boot0002  USB KEY
Boot0003* UEFI OS

$ mount /dev/sda2 /mnt
$ mount /dev/sda1 /mnt/boot/efi
$ mount /dev/sda3 /mnt/home

$ arch-chroot /mnt

$ efibootmgr
BootCurrent: 0003
Timeout: 1 seconds
BootOrder: 0003,0001,0002
Boot0001  Hard Drive
Boot0002  USB KEY
Boot0003* UEFI OS

$ ls /boot/efi/EFI/arch_grub/
grubx64.efi

What i don't understand is why is everything still in place except my efi entries...
I have no fastboot nor secureboot enabled, in bios.

Others informations

I'm using an MSI Z270 gaming pro carbon motherboard which is supposed to natively support EFI GPT boot.

Offline

#2 2018-03-21 08:16:55

spegesilden
Member
From: Denmark
Registered: 2010-12-22
Posts: 17

Re: efibootmgr reset after reboot

Did you remember to generate the configuration file for grub?
https://wiki.archlinux.org/index.php/GR … ation_file

Offline

#3 2018-03-21 08:25:34

spegesilden
Member
From: Denmark
Registered: 2010-12-22
Posts: 17

Re: efibootmgr reset after reboot

Also I'm a bit worried about the

$ grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=arch_grub

Shouldn't the efi-directory be either /boot or /boot/efi as mentioned here?

Offline

#4 2018-03-21 08:25:40

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,672

Re: efibootmgr reset after reboot

That will not have a relevance on the sudden removal from the NVRAM variables.

@Bibozz  some UEFI implementations only allow changing the NVRAM entries through their own means, so look through your firmware options if there's a possibility of adding a custom EFI entry.

Offline

#5 2018-03-21 12:11:49

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

@spegesilden :

Yes i ran the following command in order to generate grub config:

$ grub-mkconfig -o /boot/grub/grub.cfg

And i'm sorry i copied the archwiki command line but i ran the command replacing esp by /boot/efi

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub
@V1del

I didn't saw any option like that, i'm going to take a look and search for a manual if i can't find any entry
EDIT: No i found nothing like neither in manual nor in options

In general

I think it doesn't work because my bios or motherboard (i don't know exactly how it cork) doesn't recognise my /dev/sda1 partition as the efi partition.
Because i previously tried to install linux with ubuntu and i installed it in the esp created by windows (boot loader didn't worked but the entry showed up), but at this time my boot or efi partition was an msdos type.
(Sorry it's king of blurred but i didn't made check before erasing all my disks for a clean install)

Edit2: Windows

Well i just tried to install windows to see if it recognised my esp and well... it does

So i have now an entry Windows Boot Loader when i boot my computer. and if i run the following commands it look like my esp is clean and correct:

$ mount /dev/sda2 /mnt
$ mount /dev/sda1 /mnt/boot/efi
$ mount /dev/sda3 /mnt/home

$ arch-chroot /mnt

$ ls /boot/efi/EFI
arch_grub Boot Microsoft

$ ls /boot/efi/EFI/Boot
bootx64.efi

I think this strange behaviour is due to the Boot directory
EDIT: Well no it doen't, i moved grub in place of Boot and renamed grubx64.efi to bootx64.efi and it change nothing

Last edited by Biboozz (2018-03-21 13:03:52)

Offline

#6 2018-03-21 19:27:54

Condor
Member
Registered: 2017-12-01
Posts: 54

Re: efibootmgr reset after reboot

What is the output of efibootmgr -v ?
It should show UUIDs. Compare those to the output of blkid – is the UUID of your EFI boot partition listed?

Offline

#7 2018-03-21 21:19:51

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: efibootmgr reset after reboot

Biboozz wrote:

i moved grub in place of Boot and renamed grubx64.efi to bootx64.efi and it change nothing

Try copying grubx64.efi to $ESP/EFI/Microsoft/Boot/bootmgfw.efi

I have found that Windows (10) will still boot (and update) from bootmgfw.efi.bak (with a custom boot entry ofc).

Last edited by Head_on_a_Stick (2018-03-21 21:20:14)

Offline

#8 2018-03-21 21:21:36

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

@ Condor

If i run with verbose option i have the follwong

$ efibootmgr -v
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0000,0006,0004,0005
Boot0000* Windows Boot Manager  HD(1,GPT,01ea2eb3-cbac-3f40-b5cb-6d6fa4ace2ac,0x800,0x96000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................
Boot0004  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)..GO..NO..........O.C.Z.-.T.R.I.O.N.1.5.0...................\.,.@.r.d.=.X..........A...........................>..Gd-.;.A..MQ..L.6.2.B.Q.0.5.Q.J.1.K.U.B. . . . . . . . ........BO..NO..........S.a.m.s.u.n.g. .S.S.D. .7.5.0. .E.V.O. .2.5.0.G.B...................\.,.@.r.d.=.X..........A...........................>..Gd-.;.A..MQ..L.3.S.S.3.W.N.H.B.5.7.0.5.8.6. .P. . . . ........BO..NO..........S.T.4.0.0.0.D.M.0.0.5.-.2.D.P.1.6.6...................\.,.@.r.d.=.X..........A...........................>..Gd-.;.A..MQ..L. . . . . . . . . . . . .D.Z.1.H.9.L.0.B........BO
Boot0005  USB KEY       BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0b00)..GO..NO........y.U.S.B. .F.l.a.s.h. .D.i.s.k. .1.1.0.0...................\.,.@.r.d.=.X..........A.......................6..Gd-.;.A..MQ..L.F.B.F.1.0.0.8.1.8.0.0.1.0.0.4.6........BO
Boot0006* UEFI OS       HD(1,MBR,0x32051230,0xa4,0x20000)/File(\EFI\BOOT\BOOTX64.EFI)..BO

wich is pretty charged but i think it can be resumed as:

$ efibootmgr -v
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0000,0006,0004,0005
Boot0000* Windows Boot Manager  HD(1,GPT,01ea2eb3-cbac-3f40-b5cb-6d6fa4ace2ac,0x800,0x96000)
Boot0004  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)
Boot0005  USB KEY       BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0b00)
Boot0006* UEFI OS       HD(1,MBR,0x32051230,0xa4,0x20000)/File(\EFI\BOOT\BOOTX64.EFI)

As you can see i have no arch_grub entry but if i'm going to give you all the details here:

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub
Installing for x86_64-efi platform.
Installation finished. No error reported.

# I have no arch_grub entries before i run grub-install
$ efibootmgr -v
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0001,0000,0006,0004,0005
Boot0000* Windows Boot Manager  HD(1,GPT,01ea2eb3-cbac-3f40-b5cb-6d6fa4ace2ac,0x800,0x96000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)
Boot0001* arch_grub     HD(1,GPT,01ea2eb3-cbac-3f40-b5cb-6d6fa4ace2ac,0x800,0x96000)/File(\EFI\arch_grub\grubx64.efi)
Boot0004  Hard Drive    BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0200)
Boot0005  USB KEY       BBS(HD,,0x0)/VenHw(5ce8128b-2cec-40f0-8372-80640e3dc858,0b00)
Boot0006* UEFI OS       HD(1,MBR,0x32051230,0xa4,0x20000)/File(\EFI\BOOT\BOOTX64.EFI)

It look like windows and grub are at the same place, that make sense.

Edit: i totally forgot to give you this:

$ blkid
/dev/sda1: UUID="365B-D470" TYPE="vfat" PARTUUID="01ea2eb3-cbac-3f40-b5cb-6d6fa4ace2ac"
/dev/sda2: UUID="1a71c82d-e2f3-48ad-ae41-de404fbe65e5" TYPE="ext4" PARTUUID="a0632094-ea01-e048-971e-e91e54d8c029"
/dev/sda3: UUID="ba561d85-0d1b-4a03-9874-c60d455a870f" TYPE="ext4" PARTUUID="1803dbfa-577a-874e-bd4c-d400fa274490"
/dev/sdd: PTUUID="15cf100c-6701-da4c-b843-994b00194bb8" PTTYPE="gpt"
/dev/sdc1: LABEL="Data" UUID="80E86DFCE86DF0B8" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="20646c2f-61cc-444b-846e-b148bfc8967d"
/dev/sdb1: PARTLABEL="Microsoft reserved partition" PARTUUID="da4f2d2a-2a36-43b3-b72f-5dbe4cd8f473"
/dev/sdb2: UUID="54EE71D1EE71AC3C" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="f52e58fc-8572-4146-9a3a-04e77e384f55"
/dev/sde1: UUID="2018-02-01-17-58-24-00" LABEL="ARCH_201802" TYPE="iso9660" PTUUID="32051230" PTTYPE="dos" PARTUUID="32051230-01"
/dev/sde2: SEC_TYPE="msdos" LABEL="ARCHISO_EFI" UUID="5132-70A1" TYPE="vfat" PARTUUID="32051230-02"
/dev/loop0: TYPE="squashfs"
@ Head_on_a_Stick (EDIT)
$ cd /boot/efi/EFI/Microsoft/Boot/
$ mv bootmgfw.efi bootmgfw.efi.bak
$ cp /boot/efi/EFI/arch_grub/grubx64.efi bootmgfw.efi

I just did this and when i select windows now it boot on grub (and that's a big step forward) but i'm landing in grub rescue shell
And i have no other entry for bootmgfw.efi.bak

Last edited by Biboozz (2018-03-22 00:00:05)

Offline

#9 2018-03-21 22:49:51

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: efibootmgr reset after reboot

Biboozz wrote:
cp /boot/efi/EFI/arch_grub/grubx64.efi bootmgfw.efi

IIRC, it's called arch, not arch_grub, so you should go back and double-check; run the `grub-install` & `grub-mkconfig` commands again (from the chroot) beforehand, just in case.

Biboozz wrote:

i have no other entry for bootmgfw.efi.bak

You have to make one yourself:

title Windows (real)
efi /EFI/Microsoft/Boot/bootmgfw.efi.bak

Offline

#10 2018-03-21 23:46:39

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

Well as you can see in my commend i'm using the bootloader-id --bootloader-id=arch_grub and changing it's name wont change anything i think. I going to retry grub install and grub mkconfig as you sait but i do'nt think it will change anything.

You said i have to make an entry for windows efi but how ? with efibootmgr ?

EDIT: Well i re-ran my grub installation with arch instead of arch_boot and it change nothing, here are the commands i used:

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch
Installing for x86_64-efi platform.
Installation finished. No error reported.

$ grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
done

EDIT2:
I also tried to create an efi entry manually but it gave nothing

$ efibootmgr -c -d /dev/sda -p 1 -L Archlinux -l "\boot\efi\EFI\arch\grubx64.efi"
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0000,0007,0006,0004,0005
Boot0004  Hard Drive
Boot0005  USB KEY
Boot0006* UEFI OS
Boot0007* Windows Boot Manager
Boot0000* Archlinux

Last edited by Biboozz (2018-03-22 00:04:17)

Offline

#11 2018-03-22 00:41:33

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

A huge step forward

Well i updated my bios and it changed my boot mode from UEFI to Legacy + UEFI. "What does it change ?" i said to myself, so i tried to boot using it at first i saw no changes but legacy mod allow me to boot from any disk regardless of if it contain a boot partition or not.
Si i wanted to retry my efi stuff but with legacy mode activated this time, so i created two efi entries with two methods:

  • Archlinux: Created manually using efibootmgr

  • arch_boot: Created automatically with grub-install & grub-mkconfig

commands:

$ efibootmgr -c -d /dev/sda -p 1 -L Archlinux -l "\boot\efi\EFI\arch\grubx64.efi"
BootCurrent: 0006
Timeout: 1 seconds
BootOrder: 0000,0007,0006,0004,0005
Boot0004* Hard Drive
Boot0005* USB KEY
Boot0006* UEFI OS
Boot0007* Windows Boot Manager
Boot0000* Archlinux

$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub
Installing for x86_64-efi platform.
Installation finished. No error reported.

$ grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
done

And now i have the choices Archlinux and arch_grub available at boot time (and i guess efibootmgr will show thoses if i reboot on my usb stick)

What happend now

Well i don't really understand what happen for thoses two choices:

  • Archlinux: Reload boot selection menu (maybe bechause if point to arch/grubx64.efi but i wanted to try both)

  • arch_boot: Fall into grub rescue shell

Last edited by Biboozz (2018-03-22 00:49:06)

Offline

#12 2018-03-22 08:04:12

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: efibootmgr reset after reboot

Biboozz wrote:

i'm using the bootloader-id --bootloader-id=arch_grub and changing it's name wont change anything i think.

No, I don't think so either, that wasn't what I was talking about.

I meant this:

cp /boot/efi/EFI/arch_grub/grubx64.efi bootmgfw.efi

Arch's GRUB folder is called $ESP/EFI/arch not $ESP/EFI/arch_grub, the name of the NVRAM entry is entirely irrelevant.

My supposition was that perhaps you have copied the wrong grubx64.efi so you should re-check that.

You said i have to make an entry for windows efi but how ? with efibootmgr ?

Sorry, for some reason I posted a systemd-boot configuration stanza, that must have been confusing for you.

For GRUB try:

menuentry 'Windows' {
    set root=(hd0,1)
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi.bak
}

Offline

#13 2018-03-22 14:38:26

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

It change nothing. I'm still landing in GRUB rescue shell and i can't understand why.

I now use the Legacy + UEFI mode in order to have arch_grub EFI entry, but same problem, i land in grub rescue shell.

Offline

#14 2018-03-22 18:38:02

Condor
Member
Registered: 2017-12-01
Posts: 54

Re: efibootmgr reset after reboot

Actually, some change was achieved: Initially, your problem was that the UEFI failed to start anything. That seems (?) to be solved now: GRUB is loaded, even if it is only loaded as rescue shell, i.e. with obviously missing or incorrect configuration.

What's your grub config?

Edit:
I suspect GRUB cannot locate the config file and bails out. This would mean a botched installation. Check the GRUB manual for some pointers how determine this.

Last edited by Condor (2018-03-22 18:45:40)

Offline

#15 2018-03-22 18:43:57

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

Yes it look like it is solved, but i fear it will break one day (because i solved it strangely). But what i don't uderstand is that a followed the regular way to create grub with

$ grub-mkconfig -o /boot/grub/grub.cfg

So i should work but i'm asking myself: shouldn't grub config file be in /boot/efi ? (maybe /boot/efi/EFI/arch_grub)

And yes actually the question evolved but it goes in the same direction (i think this error is a backlash of the previous issue)

Offline

#16 2018-03-22 20:42:04

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: efibootmgr reset after reboot

Biboozz wrote:

shouldn't grub config file be in /boot/efi ? (maybe /boot/efi/EFI/arch_grub)

No.

Check /boot/grub/grub.cfg, does it even exist?

I would load up the Arch live ISO, mount all of the partitions, arch-chroot into the system then run `grub-install` again and and use `ls -l` to check that $ESP/EFI/arch/grubx64.efi [1]  has been updated before copying it to bootmgfw.efi

[1] the directory is *not* called  $ESP/EFI/arch_grub/grubx64.efi and if you have a directory that is so-named then you probably made it yourself and that may be why it doesn't work.

Last edited by Head_on_a_Stick (2018-03-22 20:43:25)

Offline

#17 2018-03-22 23:25:34

Biboozz
Member
Registered: 2016-10-18
Posts: 64

Re: efibootmgr reset after reboot

Yes /boot/grub/grub.cfg exist and it contains a totaly regular grub configuration.

actually $ESP/EFI/arch_grub is a directory created by grub-install itself, because i chooses the bootloader id arch_grub i guess.

I'll check GRUB manual and debug.

EDIT: Debug

Alright i removed the folliwing directories

  • $ESP/EFI/arch_grub

  • $ESP/EFI/arch

  • /boot/grub

i totally recreated grub efi and config file with arch as bootloader-id. I also enabled debug mode in grub config file.

$ rm -rf /boot/grub /boot/efi/EFI/arch /boot/efi/EFI/arch_grub

$  grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch
Installing for x86_64-efi platform.
Installation finished. No error reported.

$ grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
done

id edited /boot/grub/grub.cfg and added the following line in the beggining:

set pager=1
set debug=all

And well now when i boot on arch efi entry i fall on a pager (wich mean that grub is reading my configuration file) and well i still fall into grub shell...

EDIT: Well it is not the rescue shell

Well i assumed i falled into the rescue shell but after a few research it is not, have the following text on my screen:

GNU GRUB version 2.02
Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completion. Anywhere else TAB lists possible device or file completion.

grub>
I found the problem !

Well i found it but i have no idea on how to correct it.
In fact grub is correctly generating a config file and booting but it create no menuentry for archlinux wich is the reason why i fall in grub shell

Last edited by Biboozz (2018-03-23 00:25:50)

Offline

#18 2018-03-23 08:12:39

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: efibootmgr reset after reboot

Biboozz wrote:

grub is correctly generating a config file and booting but it create no menuentry for archlinux wich is the reason why i fall in grub shell

Well make your own then:

https://wiki.archlinux.org/index.php/GR … g_grub.cfg

Here's one of mine for inspiration:

https://raw.githubusercontent.com/Head- … r/grub.cfg

Offline

Board footer

Powered by FluxBB