[elbe-devel] [PATCH] commands init: Ignore files for elbe-devel.tar.bz2

Olivier Dion dion at linutronix.de
Wed May 27 17:41:38 CEST 2020


TLDR; Unnecessary files are copied into the initvm from the
development directory.  This results in a kernel panic when installing
a new initvm with '--devel'.

--

When creating a new initvm with the '--devel' flag, a compressed
archive called 'elbe-devel.tar.bz2' is created from the development
directory.  That archive is cpio into the initrd of the initvm
installer and, at a late stage, is decompressed into the filesystem of
the initvm.  Resulting in a exact copy of the development directory.

However, this caused me a headache yesterday when I was unable to
generate a new initvm.

This is QEMU complaining about the initrd is taking all the RAM:
----------------------------------------------------------------------
/usr/bin/qemu-system-x86_64
qemu: initrd is too large, cannot support.(max: 1073577983, need 1081853998)
----------------------------------------------------------------------
one way to overcome this is to double the default size, up to 2Gib.

However, even if that's the case, the kernel will panic after
decompressing the initrd:
----------------------------------------------------------------------
[    0.017764] Kernel panic - not syncing: initrd too large to handle, disabling initrd (1080776424 needed, 1073469440 available)
----------------------------------------------------------------------

The culprits are the .git directory if not 'git-gc' recently.  This and
the elbe-build* that are blindly copied into the initvm.  Thus,
exclusion rules were added to the archiving of the development
directory.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/commands/init.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index a97d45df..e77688ce 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -263,12 +263,16 @@ def run_command(argv):
 
         if opt.devel:
             out_real = os.path.realpath(out_path)
-            ignore = ''
+            opts = []
             if out_real.startswith(elbe_dir + os.sep):
-                ignore = '--exclude "%s"' % os.path.relpath(out_path,
-                                                            start=elbe_dir)
+                opts.append('--exclude "%s"' %
+                            os.path.relpath(out_path, start=elbe_dir))
 
+            opts.append("--exclude-vcs")
+            opts.append("--exclude-vcs-ignores")
+            opts.append("--exclude='elbe-build*'")
+            opts.append("--exclude='docs/*'")
             tar_fname = os.path.join(out_path, "elbe-devel.tar.bz2")
             system('tar cfj "%s" %s -C "%s" .' % (tar_fname,
-                                                  ignore,
+                                                  " ".join(opts),
                                                   elbe_dir))
-- 
2.26.2




More information about the elbe-devel mailing list