Browse Source

fix(grub): Fix failure to boot when using standalone mode.

When introducing grub.d integration, we switched to using the already-
installed grub binary if it existed. But this is not a good idea,
because it may come with hardcoded paths which may fail to load the
script that we put in `/EFI/BOOT`. So revert to the old behavior,
install our own pre-compiled grub binary if grub.d integration is off.

No changelog, since we never released this regression.

Changelog: None
Ticket: None

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
automatic_bootstrap_artifact
Kristian Amlie 3 years ago
parent
commit
1de050c78f
No known key found for this signature in database GPG Key ID: F464407C996AF03F
  1. 14
      mender-convert-modify
  2. 9
      modules/probe.sh

14
mender-convert-modify

@ -140,21 +140,21 @@ if [ "${MENDER_GRUB_EFI_INTEGRATION}" == "y" ]; then
# Check for known U-Boot problems in all files on the boot partition.
check_for_broken_uboot_uefi_support work/boot
if has_grub_efi "work/boot"; then
if [ "$MENDER_GRUB_D_INTEGRATION" = y ] || ( [ "$MENDER_GRUB_D_INTEGRATION" = auto ] && supports_grub_d "work/rootfs" ); then
# No need to install Grub, use the one already present, and only install
# our tools.
log_info "GRUB EFI bootloader already present, not installing one."
log_info "Not installing GRUB EFI bootloader, relying on platform provided one."
log_info "Installing Mender GRUB tools..."
grub_install_grub_editenv_binary
else
log_info "Installing GRUB EFI bootloader..."
grub_install_mender_grub
fi
if [ "$MENDER_GRUB_D_INTEGRATION" = y ] || ( [ "$MENDER_GRUB_D_INTEGRATION" = auto ] && supports_grub_d "work/rootfs" ); then
log_info "Generating grub config using update-grub..."
grub_create_grub_config
grub_install_grub_d_config
else
log_info "Installing GRUB EFI bootloader..."
grub_install_mender_grub
log_info "Generating the mender-grub config..."
grub_create_grub_config
grub_install_standalone_grub_config

9
modules/probe.sh

@ -345,15 +345,6 @@ is_efi_compatible_kernel() {
return 0
}
# has_grub_efi
#
# $1 - the boot partition to search for a grub*.efi
#
# Checks the EFI/* filesystem for the presence of a GRUB bootloader
has_grub_efi() {
find "${1}" -type f -name 'grub*.efi' -print0 | grep -qz grub
}
supports_grub_d() {
test -d "$1"/etc/grub.d || return 1

Loading…
Cancel
Save