On some older Debian-based distros (in particular, this is true for
Debian 8) GRUB config file doesn't reside on EFI partition, but rather
at /boot/grub/grub.cfg even if UEFI firmware is being used. As a
result, in the UEFI case we get "error: no bootloader detected". Let's
just append this path to the end of the corresponding list as a workaround
when dealing with UEFI guests.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev(a)virtuozzo.com>
---
mldrivers/linux_bootloaders.ml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mldrivers/linux_bootloaders.ml b/mldrivers/linux_bootloaders.ml
index 6f8857e..91c5ab9 100644
--- a/mldrivers/linux_bootloaders.ml
+++ b/mldrivers/linux_bootloaders.ml
@@ -375,6 +375,18 @@ let detect_bootloader (g : G.guestfs) root i_firmware =
with G.Error msg ->
error (f_"could not find bootloader mount point (%s): %s") mp msg in
+ (*
+ * Workaround for older UEFI-based Debian which may not have
+ * /boot/efi/EFI/debian/grub.cfg.
+ *)
+ let paths =
+ if g#exists "/boot/grub/grub.cfg" then
+ match i_firmware with
+ | Firmware.I_BIOS -> paths
+ | I_UEFI _ -> paths @ ["/boot/grub/grub.cfg"]
+ else paths
+ in
+
(* We can determine if the bootloader config file is grub 1 or
* grub 2 just by looking at the filename.
*)
--
2.39.3