[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1031183: grub-installer: postinst fails if efivarfs cannot be mounted



Package: grub-installer
Version: 1.186
Severity: important

Hi,

On systems where efivarfs cannot be mounted, the grub installation step fails
even though it would have otherwise worked just fine skipping the mount
efivarfs command, i.e. system installation is successful with this preseed file:

  d-i partman/early_command string sed -i 's/mountvirtfs efivarfs/#/' /var/lib/dpkg/info/grub-installer.postinst

The relevant code in d/postinst looks as follows, suggesting the intention to
ignore failures:

  mountvirtfs efivarfs /target/sys/firmware/efi/efivars || true

However, mountvirtfs itself is exiting with 1 in case of mount errors:

  mountvirtfs () {
          fstype="$1"
          path="$2"
          if grep -q "[[:space:]]$fstype\$" /proc/filesystems && \
             ! grep -q "^[^ ]\+ \+$path " /proc/mounts; then
                  mkdir -p "$path" || \
                          die grub-installer/mounterr "Error creating $path"
                  mount -t "$fstype" "$fstype" "$path" || \
                          die grub-installer/mounterr "Error mounting $path"
                  trap "umount $path" HUP INT QUIT KILL PIPE TERM EXIT
          fi
  }
  
I'm unsure as to what the best course of action is here, but perhaps an idea is
to avoid calling "die" when mount fails for efivarfs, and log an error to
/var/log/syslog instead? Of course the relevant umount should be skipped too.

In any case, the "|| true" part in the mountvirtfs efivarfs call should
probably be dropped.

Please note that this issue is different from https://bugs.debian.org/933523.
In that case, installing grub fails *because* efivarfs does not get mounted
properly, and the surprising bit is that the mountvirtfs efivarfs call does
*not* fail for some reason. :-)

FTR here's the error I get trying to mount efivarfs manually:

  ~ # mount -t efivarfs efivarfs /target/sys/firmware/efi/efivars
  mount: mounting efivarfs on /target/sys/firmware/efi/efivars failed: Operation not supported

Thanks!
  ema


Reply to: