Package: efibootmgr
Version: 0.11.0-1
Severity: critical
Justification: breaks the whole system

Dear Maintainer,

On my system, reading Boot0005 fails with EIO:

openat(AT_FDCWD, "/sys/firmware/efi/vars/", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
brk(0)                                  = 0xfda000
brk(0x1003000)                          = 0x1003000
fcntl(3, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
getdents(3, /* 103 entries */, 32768)   = 7336
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/sys/firmware/efi/vars/Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var",
 O_RDONLY) = 3
read(3, "B\0o\0o\0t\0000\0000\0000\0000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 2084
read(3, "", 2012)                       = 0
close(3)                                = 0
open("/sys/firmware/efi/vars/Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var",
 O_RDONLY) = 3
read(3, "B\0o\0o\0t\0000\0000\0000\0001\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 2084
read(3, "", 2012)                       = 0
close(3)                                = 0
open("/sys/firmware/efi/vars/Boot0002-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var",
 O_RDONLY) = 3
read(3, "B\0o\0o\0t\0000\0000\0000\0002\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
4096) = 2084
read(3, "", 2012)                       = 0
close(3)                                = 0
open("/sys/firmware/efi/vars/Boot0005-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var",
 O_RDONLY) = 3
read(3, 0xfdb170, 4096)                 = -1 EIO (Input/output error)
close(3)                                = 0
write(2, "efibootmgr: ", 12)            = 12
write(2, "efibootmgr", 10)              = 10
write(2, ": ", 2)                       = 2
write(2, "Input/output error\n", 19)    = 19
exit_group(1)                           = ?

Old versions of efibootmgr and libefivar0 allowed me to install the
necessary EFI boot entries. It seems that an old libefivar0 did not report
read errors.

Then libefivar0 started to crash on unreadable variables (see Debian bug
764386). Since that bug has been fixed, efibootmgr doesn't crash anymore,
but the read errors are reported and efibootmgr always fails with an
input/output error.

The following simple patch makes read_vars() skip unreadable variables. It
allows efibootmgr to create boot entries on my system again.

--- efibootmgr-0.11.0.orig/src/efibootmgr/efibootmgr.c  2014-10-21 
22:17:27.000000000 +0200
+++ efibootmgr-0.11.0/src/efibootmgr/efibootmgr.c       2014-11-05 
00:34:15.883935672 +0100
@@ -110,8 +110,12 @@
                        rc = efi_get_variable(EFI_GLOBAL_GUID, namelist[i],
                                               &entry->data, &entry->data_size,
                                               &entry->attributes);
-                       if (rc < 0)
-                               goto err;
+                       if (rc < 0) {
+                               /* skip unreadable variable */
+                               warn("reading variable %s", namelist[i]);
+                               free(entry);
+                               continue;
+                       }
 
                        /* latest apple firmware sets high bit which appears
                         * invalid to the linux kernel if we write it back so

However, I'm not sure if this is the right way to solve the problem. It
could be the firmware that needs a fix (there are newer versions available,
but I haven't tried them yet). It could be a bug in the kernel (maybe it
shouldn't fail with EIO). Anyway, an efibootmgr that is more fault tolerant
would be helpful.

PS: When testing the patch, I got a second unreadable boot entry that seems
to have been automatically created by the BIOS. The BIOS called it
"Generic-SD/MMC" which is one of the slots of a card reader. Together with
some other anomalies in the BIOS boot configuration, I'm now pretty sure
that at least one BIOS bug is involved. Nevertheless, I think an efibootmgr
that's not so easy to scare and creates boot entries even in face of such
adversities would be nice ...

Mainboard: Asus P9D WS, BIOS version 1406

-- System Information:
Debian Release: 7.7
  APT prefers stable
  APT policy: (820, 'stable'), (600, 'unstable'), (550, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages efibootmgr depends on:
ii  libc6       2.19-12
ii  libefivar0  0.15-2
ii  libpci3     1:3.2.1-3
ii  zlib1g      1:1.2.7.dfsg-13

efibootmgr recommends no packages.

efibootmgr suggests no packages.

-- no debconf information

-- 
Jan


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to