[blivet][PATCH] Provide more meaningful error message if bootloader installation fails

Martin Kolman mkolman at redhat.com
Mon Oct 21 17:46:05 UTC 2013


If bootloader installation fails due to missing stage 1 target,
provide a more meaningful error messages for the MBR and EFI
installation methods.

Related: rhbz#1012132
Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 blivet/__init__.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 0aa4897..a4b7fef 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -106,11 +106,15 @@ def enable_installer_mode():
     global BootLoaderError
     global errorHandler
     global ERROR_RAISE
+    global BOOT_METHOD_MBR
+    global BOOT_METHOD_EFI
 
     from pyanaconda import isys
     from pyanaconda.constants import ROOT_PATH
     from pyanaconda.constants import shortProductName
     from pyanaconda.constants import productName
+    from pyanaconda.constants import BOOT_METHOD_MBR
+    from pyanaconda.constants import BOOT_METHOD_EFI
     from pyanaconda.bootloader import get_bootloader
     from pyanaconda.bootloader import BootLoaderError
     from pyanaconda.errors import errorHandler
@@ -1546,8 +1550,19 @@ class Blivet(object):
         if self.bootloader and not self.bootloader.skip_bootloader:
             stage1 = self.bootloader.stage1_device
             if not stage1:
-                errors.append(_("you have not created a bootloader stage1 "
-                                "target device"))
+                # check which boot method would have been used
+                # and show appropriate error message about missing
+                # stage1 boot target device
+                if self.bootloader.boot_method == BOOT_METHOD_MBR:
+                    # MBR specific error message
+                    errors.append(_("you need to create BIOSBoot mountpoint"))
+                elif self.bootloader.boot_method == BOOT_METHOD_EFI:
+                    # EFI specific error message
+                    errors.append(_("you need to create /boot/efi mountpoint"))
+                else:
+                    # unknown method, use generic error message
+                    errors.append(_("you have not created a bootloader stage1 "
+                                    "target device"))
             else:
                 self.bootloader.is_valid_stage1_device(stage1)
                 errors.extend(self.bootloader.errors)
-- 
1.8.3.1



More information about the anaconda-patches mailing list