#847694 refind: fails to install in i386 chroot on amd64 host

Package:
refind
Source:
refind
Description:
boot manager for EFI-based computers
Submitter:
Andreas Beckmann
Date:
2023-04-30 03:39:06 UTC
Severity:
important
#847694#5
Date:
2016-12-10 17:24:09 UTC
From:
To:
Hi,

during a test with piuparts I noticed your package failed to install.
This was specifically observed in an i386 chroot on an amd64 host.
(amd64 chroot on and64 host works fine)

  Setting up refind (0.10.4-1) ...
  Installing rEFInd to the ESP...
  EFI variables are not supported on this system.
  dpkg: error processing package refind (--configure):
   subprocess installed post-installation script returned error exit status 1


cheers,

Andreas

#847694#12
Date:
2017-12-08 14:34:51 UTC
From:
To:
Running refind-install directly would produce more output, which might
be helpful; however, I'm 80% sure that this is a result of EFI
architecture limitations. Specifically, tools like efibootmgr, upon
which the refind-install script (and hence the package installation
procedure) depends, work for like architectures only. That is, I would
not expect efibootmgr in a 32-bit chroot environment on a 64-bit
platform to work. If efibootmgr is installed but doesn't work, then
refind-install will fail.

Although it would be possible to modify refind-install to work around
this limitation, I'm not sure that doing so would be advisable. For
context, be aware that refind-install WILL work in a BIOS boot mode, in
which efibootmgr also does not work; however, rEFInd will not actually
be fully installed in this case. The files will be installed to the ESP
using the fallback filename (EFI/BOOT/bootx64.efi), but the EFI NVRAM
entries won't be set. This is desirable because there are situations in
which you might need to install rEFInd from a BIOS-mode boot -- for
instance, if you accidentally installed your OS in BIOS mode rather than
in EFI mode. In this case, installing rEFInd to the ESP and then relying
on the fallback boot loader filename to boot may work, depending on what
else is installed; and even if something else takes precedence, there
may be ways to override that or adjust the default in the non-Linux OS.

OTOH, I don't see what the point of installing rEFInd from within a
32-bit (i386/IA32/x86) chroot on a 64-bit (AMD64/X64/x86-64)
installation would be. By definition, a 64-bit environment is available
on the computer, and a non-chroot environment is likely to be better for
handling low-level hardware configuration in any event, so why not use
it? If you can present a reasonable use case for why installing rEFInd
in a chroot environment rather than in the host environment is
desirable, then I'll consider adjusting refind-install to handle this
situation.

Of course, this assumes that my assumption about the cause is correct,
too; it could be that something else is going wrong. Even if that's the
case, though, the question of why you'd want to install a low-level
firmware-interfacing tool from within a chroot environment -- especially
one that doesn't match the EFI's bit depth.

#847694#23
Date:
2020-07-23 17:52:53 UTC
From:
To:
I've finally gotten around to reproducing this, and I was able to
reproduce even on the 0.12.0-1 version.

In order to try and trace it further, I reproduced interactively, and
said "no" to the "Automatically install rEFInd to the ESP?" question
so that I could run "refind-install" manually and look for clues.
Here's what I get:

| $ refind-install
| The rEFInd binary file is missing! Aborting installation!

However, if I run the install via "linux32" so that the kernel reports
a 32bit architecture, it more appropriately bails with the expected
error:

| $ linux32 refind-install
| ShimSource is none
| Installing rEFInd on Linux....
| The ESP doesn't seem to be mounted! Trying to find it....
| // doesn't seem to be on a VFAT filesystem. The ESP must be
| mounted at //boot, //efi, or //boot/efi, and it must be
| VFAT (not msdos)! Aborting!
| The computer appears to be running in BIOS mode and has no ESP. You should
| create an ESP, and ideally boot in EFI mode, before installing rEFInd.

So I think the problem is that "refind-install" appears to be using
"uname -m" for architecture detection, which it then uses to try and
find the rEFInd binary file? (and that failure is a non-zero exit
code, versus the zero exit code that the "we can't install because we
can't find EFI" error above gives)

♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4