From 8729997eabba9b7d9896805c44c8f379f7c1e199 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 13 Feb 2012 10:56:13 -0500 Subject: [PATCH] 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 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/switchroot/ostree-switch-root.c b/src/switchroot/ostree-switch-root.c index 3e1155c0..60306e6c 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) {