[PATCH 1/4] RAM requirements depend on squashfs.img's origin

Vratislav Podzimek vpodzime at redhat.com
Fri Jul 25 10:36:59 UTC 2014


We have much higher memory requirements if the squashfs.img was fetched from
somewhere and has to be kept in RAM. With not enough RAM, the loop1 process
freaks out, takes 100 % CPU and eventually oom_kill kills the anaconda-yum
process.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 anaconda                    |  8 ++++++++
 pyanaconda/isys/__init__.py |  1 +
 pyanaconda/iutil.py         | 14 ++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/anaconda b/anaconda
index 9374d1c..9f1dbb4 100755
--- a/anaconda
+++ b/anaconda
@@ -578,6 +578,9 @@ def gtk_warning(title, reason):
 
 # pylint: disable=redefined-outer-name
 def check_memory(anaconda, options, display_mode=None):
+    from pyanaconda import isys
+    from pyanaconda.iutil import persistent_root_image
+
     reason_strict = _("%(product_name)s requires %(needed_ram)s MB of memory to "
                       "install, but you only have %(total_ram)s MB on this machine.\n")
     reason_graphical = _("The %(product_name)s graphical installer requires %(needed_ram)s "
@@ -602,6 +605,11 @@ def check_memory(anaconda, options, display_mode=None):
     needed_ram = int(isys.MIN_RAM / 1024)
     graphical_ram = int(isys.MIN_GUI_RAM / 1024)
 
+    # count the squashfs.img in if it is kept in RAM
+    if not persistent_root_image():
+        needed_ram += isys.SQUASHFS_RAM
+        graphical_ram += isys.SQUASHFS_RAM
+
     log.info("check_memory(): total:%s, needed:%s, graphical:%s",
              total_ram, needed_ram, graphical_ram)
 
diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index def8e96..06291f6 100644
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -53,6 +53,7 @@ else:
     GUI_INSTALL_EXTRA_RAM = 90 * 1024
 
 MIN_GUI_RAM = MIN_RAM + GUI_INSTALL_EXTRA_RAM
+SQUASHFS_EXTRA_RAM = 750 * 1024
 
 ## Flush filesystem buffers.
 def sync ():
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index 642e7b0..3f0cc0e 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -29,6 +29,7 @@ import subprocess
 import unicodedata
 import string
 import types
+import re
 from threading import Thread
 from Queue import Queue, Empty
 from urllib import quote, unquote
@@ -878,3 +879,16 @@ def xprogressive_delay():
     while True:
         yield 0.25*(2**counter)
         counter += 1
+
+def persistent_root_image():
+    """:returns: whether we are running from a persistent (not in RAM) root.img"""
+
+    for line in execReadlines("losetup", ["--list"]):
+        # if there is an active loop device for a curl-fetched file that has
+        # been deleted, it means we run from a non-persistent root image
+        # EXAMPLE line:
+        # /dev/loop0  0 0 0 1 /tmp/curl_fetch_url0/my_comps_squashfs.img (deleted)
+        if re.match(r'.*curl_fetch_url.*\(deleted\)\s*$', line):
+            return False
+
+    return True
-- 
1.9.3



More information about the anaconda-patches mailing list