--- pkgsrc.orig/grub-core/loader/i386/linux.c.orig 2020-09-04 15:11:44.310758987 -0400 +++ pkgsrc/grub-core/loader/i386/linux.c 2020-09-04 15:17:34.017961849 -0400 @@ -731,6 +731,13 @@ grub_dprintf ("linux", "linuxefi failed and secure boot is enabled (%d)\n", grub_errno); goto fail; } + else + { + /* if CONFIG_EFI_STUB was not enabled, we will get + * GRUB_ERR_BAD_OS in grub_errno. We need to reset it or the + * fallback will fail (will never set loaded = 1 later). */ + grub_errno = GRUB_ERR_NONE; + } } }