[ostree] switchroot: Bind mount /lib/modules after we mount /lib



commit 8729997eabba9b7d9896805c44c8f379f7c1e199
Author: Colin Walters <walters verbum org>
Date:   Mon Feb 13 10:56:13 2012 -0500

    switchroot: Bind mount /lib/modules after we mount /lib
    
    Otherwise we don't ge the right /lib/modules.

 src/switchroot/ostree-switch-root.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/switchroot/ostree-switch-root.c b/src/switchroot/ostree-switch-root.c
index 3e1155c..60306e6 100644
--- a/src/switchroot/ostree-switch-root.c
+++ b/src/switchroot/ostree-switch-root.c
@@ -283,14 +283,6 @@ main(int argc, char *argv[])
 	}
     }
 
-  snprintf (srcpath, sizeof(srcpath), "/ostree/modules");
-  snprintf (destpath, sizeof(destpath), "/ostree/%s/lib/modules", ostree_target);
-  if (mount (srcpath, destpath, NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
-    {
-      perrorv ("failed to bind mount (class:bind) %s to %s", srcpath, destpath);
-      exit (1);
-    }
-
   for (i = 0; readonly_bind_mounts[i] != NULL; i++)
     {
       snprintf (destpath, sizeof(destpath), "/ostree/%s%s", ostree_target, readonly_bind_mounts[i]);
@@ -305,7 +297,16 @@ main(int argc, char *argv[])
 	  exit (1);
 	}
     }
-  
+
+  /* This should come after we've bind mounted /lib */
+  snprintf (srcpath, sizeof(srcpath), "/ostree/modules");
+  snprintf (destpath, sizeof(destpath), "/ostree/%s/lib/modules", ostree_target);
+  if (mount (srcpath, destpath, NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
+    {
+      perrorv ("failed to bind mount %s to %s", srcpath, destpath);
+      exit (1);
+    }
+
   snprintf (destpath, sizeof(destpath), "/ostree/%s", ostree_target);
   if (chroot (destpath) < 0)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]