[master/rhel7-branch] Show dialog if kernel cmdline in zipl.conf is too long. (#885011)

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Aug 4 09:20:23 UTC 2014


On s390x, the kernel cmdline has a hard limit of 896 bytes in length.
There is nothing we can do to circumvent this, so instead of just
crashing, handle the error gracefully by behaving the same as when
unsupported hardware is detected.

Resolves: rhbz#885011
---
 pyanaconda/bootloader.py | 5 +++++
 pyanaconda/exception.py  | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index a30f2cd..400314a 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2150,6 +2150,11 @@ class ZIPL(BootLoader):
                 # We want to extract the device name and pass that.
                 name = re.sub(r".+?: ", "", line)
                 self.stage1_name = re.sub(r"(\s\(.+\))?\.$", "", name)
+            # a limitation of s390x is that the kernel parameter list must not
+            # exceed 896 bytes; there is nothing we can do about this, so just
+            # catch the error and show it to the user instead of crashing
+            elif line.startswith("Error: The length of the parameters "):
+                raise BootLoaderError(line)
 
         if not self.stage1_name:
             raise BootLoaderError("could not find IPL device")
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 9767c00..b8ca97a 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -33,6 +33,7 @@ import time
 import kickstart
 import blivet.errors
 from pyanaconda.errors import CmdlineError
+from pyanaconda.bootloader import BootLoaderError
 from pyanaconda.ui.communication import hubQ
 from pyanaconda.constants import ROOT_PATH, THREAD_EXCEPTION_HANDLING_TEST
 from pyanaconda.threads import threadMgr
@@ -92,6 +93,14 @@ class AnacondaExceptionHandler(ExceptionHandler):
                              "The installer will now terminate.") % str(value)
             self.intf.messageWindow(_("Hardware error occured"), hw_error_msg)
             sys.exit(0)
+        elif issubclass(ty, BootLoaderError) and str(value).startswith("Error: The length of the parameters line"):
+            # this only is a risk for s390(x) since there's a hardware limit on
+            # the length of the kernel parameter list for bootloader entries
+            bl_error_msg = _("The installation was stopped due to an error "
+                             "installing the bootloader. The exact error "
+                             "message is:\n\n%s.\n\n "
+                             "The installer will now terminate.") % str(value)
+            self.intf.messageWindow(_("Boot loader error occured"), bl_error_msg)
         elif (issubclass (ty, CmdlineError)):
 
             cmdline_error_msg = _("\nThe installation was stopped due to an "
-- 
1.8.3.1



More information about the anaconda-patches mailing list