You are not logged in.

#1 2013-10-07 20:29:47

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

[SOLVED] efibootmgr fails from October ISO boot

[Solution] ...in the place of 'modprobe efivars' in the script, ... 'mount -t efivarfs efivarfs /sys/firmware/efi/efivars' instead. Get the Error in `efibootmgr': free(): invalid pointer:  error even though booting into new install is successful. See below for details.

I have a unique situation where efibootmgr does not add the stub kernel boot entry from the Arch October install image ISO but the exact same script does add the entry if I run it from an existing install on the same rig. The existing install hasn't been updated for several weeks while, by its very nature, the new install is as up to date as the mirrors.

Would it be useful in determining the cause by providing details from the install image ISO environment and existing install for comparison? If so, which details?

Additionally, when I do boot into the new install via the entry created in the existing install the script is able to add a second boot entry for the new install. It seems that efibootmgr's failure to add a new entry only occurs when booted into the install image ISO environment.

Last edited by KairiTech (2013-10-15 02:24:47)

Offline

#2 2013-10-07 21:23:37

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: [SOLVED] efibootmgr fails from October ISO boot

@Kairitech: Read the entire https://wiki.archlinux.org/index.php/Un … _Interface article as lots of changes have taken place both in the wiki as well as the tools and kernel.

From ur observation, I suppose efibootmgr works fine in the existing and new install but fails inside the iso env. Am I right? It would be better if you can post the kernel and efibootmgr versions used, "efibootmgr -v" and "efivar -l" (if efivar is available) in all the 3 cases. Have you tried latest Archboot iso? Can you try within archboot env (i.e. outside its setup)?

Last edited by the.ridikulus.rat (2013-10-07 21:24:46)

Offline

#3 2013-10-08 10:11:11

Smoerrebroed
Member
From: Germany
Registered: 2011-07-24
Posts: 110

Re: [SOLVED] efibootmgr fails from October ISO boot

efibootmgr only works when you boot using EFI. Have you booted using EFI? The CD is dual boot so you might just be using BIOS mode instead.

Cheers

Smoerrebroed

Offline

#4 2013-10-08 14:13:55

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] efibootmgr fails from October ISO boot

@Smoerrebroed, KairiTech is well versed in the ways of UEFI.  Though he/she unfortunately seems to run into issues with efibootmgr rather frequently.  I would chalk that up to the hardware in use though, as UEFI firmware can still be pretty buggy.

@KairiTech, there was a change in the way the efibootmgr works (okay, we actually switched to Peter Jones' fork).  So it might help if you actually posted your script that you have made to handle this.  No longer does efibootmgr require the switch to sysfs-efivar and now uses the efivarfs instead… or I might have that backwards, its whatever one uses /sys/firmware/efi/efivars.

Offline

#5 2013-10-09 15:32:59

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: [SOLVED] efibootmgr fails from October ISO boot

@Kairitech: I think I understand why efibootmgr in iso env fails.

In existing install you have OLD efibootmgr which uses only the OLD sysfs-efivars (efivars kernel module, /sys/firmware/efi/vars, 1024 byte max var size limitation, not recommended by kernel devs anymore). Since you most likely have an old kernel which contains efivars kernel module (either built-in or external) and you most likely be modprobe'ing efivars in your script anyway, OLD efibootmgr with OLD sysfs-efivars interface should be working fine in the existing install.

Efivarfs is the replacement for OLD sysfs-efivars which does not have the max var size limitation. It is provided by efivarfs kernel module and by default mounted at /sys/firmware/efi/efivars (its efi/efivars, not efi/vars or efi/efivar or efi/efivarfs). Due to inconsistency issues on havind both OLD sysfs-efivars and NEW efivarfs enabled simultaneously, the former is completely disabled in Arch core/linux >=3.11.1 (i.e. efivars module is no longer built). This change is only in Arch kernel, the OLD sysfs-efivars code is still present upstream.

Now both the iso and new install should have the NEW efibootmgr (Peter Jones aka vathpela's fork in github, uses his own efivar external library which is a separate project, actually supports both OLD sysfs-efivars and NEW efivarfs) and NEW kernel (> 3.11.1). Recent systemd version, if booted in EFI mode and if efivarfs support is present, automatically mount efivarfs at /sys/firmware/efi/efivars, without any manual config in fstab etc. required. That is the reason why NEW efibootmgr and NEW kernel with systemd as init works fine in new install.

But since the official iso (archiso) does not use systemd as its init (I am talking about iso env, not installed system), so NEW efivarfs is not auto-mounted in the env and NEW efibootmgr fails. So in the place of 'modprobe efivars' in the script, you need to do 'mount -t efivarfs efivarfs /sys/firmware/efi/efivars'. That should fix your script.

Note that OLD efibootmgr (original upstream version aka from linux-dell) does not support NEW efivarfs,  so it will not work in both the iso env and  the new install. You HAVE TO use only the NEW efibootmgr going forward, till the dell-linux efibootmgr also incorporates NEW efivarfs support from vathpela's fork.

Last edited by the.ridikulus.rat (2013-10-09 15:34:09)

Offline

#6 2013-10-15 01:31:20

KairiTech
Member
From: Toronto, Canada
Registered: 2011-06-04
Posts: 275

Re: [SOLVED] efibootmgr fails from October ISO boot

the.ridikulus.rat wrote:

So in the place of 'modprobe efivars' in the script, you need to do 'mount -t efivarfs efivarfs /sys/firmware/efi/efivars'. That should fix your script.

Works perfectly. Thanks for everyone's help. I was also able to get the boot entry added before I tried your solution if I exited the chroot before I executed efibootmgr but it silently added the entry.

efibootmgr -v reports the error *** Error in `efibootmgr': free(): invalid pointer: ... but I'm going to clear the NVRAM completely and start over using your method to see if that clears up any artifacts from my previous attempts that might explain this.

[Edit]
No luck with clearing the NVRAM. See below for the invalid pointer error details after successfully booting into the new install...

efibootmgr


BootCurrent: 0000
Timeout: 3 seconds
BootOrder: 0000,0003,0004,0005,0006,0007,0002,0001
Boot0000* KEST 2013-10-14 22:07:27
Boot0001* UEFI: KingstonDataTraveler 108
Boot0002* Optiarc DVD RW AD-7240S
Boot0003* WDC WD7500BPKT-2
Boot0004* KingstonDataTraveler 108
Boot0005* KINGSTON SNV425S264GB
Boot0006* KINGSTON SNV425S264GB
Boot0007* KINGSTON SNV425S264GB

efibootmgr -v  -v


BootCurrent: 0000
Timeout: 3 seconds
BootOrder: 0000,0003,0004,0005,0006,0007,0002,0001
Boot0000* KEST 2013-10-14 22:07:27	HD(1,800,7d000,a59faf09-46fc-4e7c-885b-5cddb28a4cf1)File(\EFI\KEST\vmlinuz-linux.efi)i.n.i.t.r.d.=.\.E.F.I.\.K.E.S.T.\.i.n.i.t.r.a.m.f.s.-.l.i.n.u.x...i.m.g. .r.o.o.t.=./.d.e.v./.m.a.p.p.e.r./.v.g.T.E.S.T.D.r.i.v.e.-.l.v.R.o.o.t. .c.r.y.p.t.d.e.v.i.c.e.=./.d.e.v./.m.d.2.5.:.v.g.T.E.S.T.D.r.i.v.e. .p.c.i.e._.a.s.p.m.=.f.o.r.c.e. .q.u.i.e.t. .l.o.g.l.e.v.e.l.=.0.
*** Error in `efibootmgr': free(): invalid pointer: 0x00007ffffac32f68 ***
======= Backtrace: =========
/usr/lib/libc.so.6[0x3757e72ecf]
/usr/lib/libc.so.6[0x3757e7869e]
/usr/lib/libc.so.6[0x3757e79377]
efibootmgr[0x405bc5]
efibootmgr[0x402e0f]
efibootmgr[0x4029cd]
/usr/lib/libc.so.6(__libc_start_main+0xf5)[0x3757e21bc5]
efibootmgr[0x402ad9]
======= Memory map: ========
00400000-00409000 r-xp 00000000 fe:01 134750                             /usr/bin/efibootmgr
00608000-00609000 r--p 00008000 fe:01 134750                             /usr/bin/efibootmgr
00609000-0060a000 rw-p 00009000 fe:01 134750                             /usr/bin/efibootmgr
01c4a000-01c73000 rw-p 00000000 00:00 0                                  [heap]
3756200000-3756220000 r-xp 00000000 fe:01 196561                         /usr/lib/ld-2.18.so
375641f000-3756420000 r--p 0001f000 fe:01 196561                         /usr/lib/ld-2.18.so
3756420000-3756421000 rw-p 00020000 fe:01 196561                         /usr/lib/ld-2.18.so
3756421000-3756422000 rw-p 00000000 00:00 0 
3756600000-3756606000 r-xp 00000000 fe:01 142049                         /usr/lib/libefivar.so.0
3756606000-3756805000 ---p 00006000 fe:01 142049                         /usr/lib/libefivar.so.0
3756805000-3756806000 rw-p 00005000 fe:01 142049                         /usr/lib/libefivar.so.0
3756a00000-3756a0b000 r-xp 00000000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756a0b000-3756c0a000 ---p 0000b000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756c0a000-3756c0b000 r--p 0000a000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756c0b000-3756c0c000 rw-p 0000b000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3757e00000-3757fa2000 r-xp 00000000 fe:01 196562                         /usr/lib/libc-2.18.so
3757fa2000-37581a1000 ---p 001a2000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a1000-37581a5000 r--p 001a1000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a5000-37581a7000 rw-p 001a5000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a7000-37581ab000 rw-p 00000000 00:00 0 
375ae00000-375ae14000 r-xp 00000000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375ae14000-375b013000 ---p 00014000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b013000-375b014000 r--p 00013000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b014000-375b015000 rw-p 00014000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b015000-375b017000 rw-p 00000000 00:00 0 
3767c00000-3767c15000 r-xp 00000000 fe:01 183578                         /usr/lib/libgcc_s.so.1
3767c15000-3767e15000 ---p 00015000 fe:01 183578                         /usr/lib/libgcc_s.so.1
3767e15000-3767e16000 rw-p 00015000 fe:01 183578                         /usr/lib/libgcc_s.so.1
7f4f27c9b000-7f4f27ca0000 rw-p 00000000 00:00 0 
7f4f27cbb000-7f4f27cbd000 rw-p 00000000 00:00 0 
7ffffac13000-7ffffac34000 rw-p 00000000 00:00 0                          [stack]
7ffffac5a000-7ffffac5c000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Boot0001* UEFI: KingstonDataTraveler 108zsh: abort (core dumped)  efibootmgr -v

Last edited by KairiTech (2013-10-15 13:37:56)

Offline

#7 2013-10-15 14:33:33

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: [SOLVED] efibootmgr fails from October ISO boot

KairiTech wrote:

efibootmgr -v reports the error *** Error in `efibootmgr': free(): invalid pointer: ... but I'm going to clear the NVRAM completely and start over using your method to see if that clears up any artifacts from my previous attempts that might explain this.

[Edit]
No luck with clearing the NVRAM. See below for the invalid pointer error details after successfully booting into the new install...

efibootmgr


BootCurrent: 0000
Timeout: 3 seconds
BootOrder: 0000,0003,0004,0005,0006,0007,0002,0001
Boot0000* KEST 2013-10-14 22:07:27
Boot0001* UEFI: KingstonDataTraveler 108
Boot0002* Optiarc DVD RW AD-7240S
Boot0003* WDC WD7500BPKT-2
Boot0004* KingstonDataTraveler 108
Boot0005* KINGSTON SNV425S264GB
Boot0006* KINGSTON SNV425S264GB
Boot0007* KINGSTON SNV425S264GB

efibootmgr -v  -v


BootCurrent: 0000
Timeout: 3 seconds
BootOrder: 0000,0003,0004,0005,0006,0007,0002,0001
Boot0000* KEST 2013-10-14 22:07:27	HD(1,800,7d000,a59faf09-46fc-4e7c-885b-5cddb28a4cf1)File(\EFI\KEST\vmlinuz-linux.efi)i.n.i.t.r.d.=.\.E.F.I.\.K.E.S.T.\.i.n.i.t.r.a.m.f.s.-.l.i.n.u.x...i.m.g. .r.o.o.t.=./.d.e.v./.m.a.p.p.e.r./.v.g.T.E.S.T.D.r.i.v.e.-.l.v.R.o.o.t. .c.r.y.p.t.d.e.v.i.c.e.=./.d.e.v./.m.d.2.5.:.v.g.T.E.S.T.D.r.i.v.e. .p.c.i.e._.a.s.p.m.=.f.o.r.c.e. .q.u.i.e.t. .l.o.g.l.e.v.e.l.=.0.
*** Error in `efibootmgr': free(): invalid pointer: 0x00007ffffac32f68 ***
======= Backtrace: =========
/usr/lib/libc.so.6[0x3757e72ecf]
/usr/lib/libc.so.6[0x3757e7869e]
/usr/lib/libc.so.6[0x3757e79377]
efibootmgr[0x405bc5]
efibootmgr[0x402e0f]
efibootmgr[0x4029cd]
/usr/lib/libc.so.6(__libc_start_main+0xf5)[0x3757e21bc5]
efibootmgr[0x402ad9]
======= Memory map: ========
00400000-00409000 r-xp 00000000 fe:01 134750                             /usr/bin/efibootmgr
00608000-00609000 r--p 00008000 fe:01 134750                             /usr/bin/efibootmgr
00609000-0060a000 rw-p 00009000 fe:01 134750                             /usr/bin/efibootmgr
01c4a000-01c73000 rw-p 00000000 00:00 0                                  [heap]
3756200000-3756220000 r-xp 00000000 fe:01 196561                         /usr/lib/ld-2.18.so
375641f000-3756420000 r--p 0001f000 fe:01 196561                         /usr/lib/ld-2.18.so
3756420000-3756421000 rw-p 00020000 fe:01 196561                         /usr/lib/ld-2.18.so
3756421000-3756422000 rw-p 00000000 00:00 0 
3756600000-3756606000 r-xp 00000000 fe:01 142049                         /usr/lib/libefivar.so.0
3756606000-3756805000 ---p 00006000 fe:01 142049                         /usr/lib/libefivar.so.0
3756805000-3756806000 rw-p 00005000 fe:01 142049                         /usr/lib/libefivar.so.0
3756a00000-3756a0b000 r-xp 00000000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756a0b000-3756c0a000 ---p 0000b000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756c0a000-3756c0b000 r--p 0000a000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3756c0b000-3756c0c000 rw-p 0000b000 fe:01 152532                         /usr/lib/libpci.so.3.2.0
3757e00000-3757fa2000 r-xp 00000000 fe:01 196562                         /usr/lib/libc-2.18.so
3757fa2000-37581a1000 ---p 001a2000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a1000-37581a5000 r--p 001a1000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a5000-37581a7000 rw-p 001a5000 fe:01 196562                         /usr/lib/libc-2.18.so
37581a7000-37581ab000 rw-p 00000000 00:00 0 
375ae00000-375ae14000 r-xp 00000000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375ae14000-375b013000 ---p 00014000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b013000-375b014000 r--p 00013000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b014000-375b015000 rw-p 00014000 fe:01 137454                         /usr/lib/libresolv-2.18.so
375b015000-375b017000 rw-p 00000000 00:00 0 
3767c00000-3767c15000 r-xp 00000000 fe:01 183578                         /usr/lib/libgcc_s.so.1
3767c15000-3767e15000 ---p 00015000 fe:01 183578                         /usr/lib/libgcc_s.so.1
3767e15000-3767e16000 rw-p 00015000 fe:01 183578                         /usr/lib/libgcc_s.so.1
7f4f27c9b000-7f4f27ca0000 rw-p 00000000 00:00 0 
7f4f27cbb000-7f4f27cbd000 rw-p 00000000 00:00 0 
7ffffac13000-7ffffac34000 rw-p 00000000 00:00 0                          [stack]
7ffffac5a000-7ffffac5c000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Boot0001* UEFI: KingstonDataTraveler 108zsh: abort (core dumped)  efibootmgr -v

Can you rebuild "efivar" and "efibootmgr" pkgs with debug symbols enabled and then give a full backtrace with debug info? Also please contact Peter Jones via https://github.com/vathpela with the debug info. That will help him fix this issue in the next efibootmgr release.

Offline

Board footer

Powered by FluxBB