[gnome-build-meta/valentindavid/pinebook-pro: 2/2] ostree: Do not make root private



commit 524bd7bd31320122de66884f2cbaf7e08bc1848f
Author: Valentin David <valentin david codethink co uk>
Date:   Mon Apr 27 13:20:21 2020 +0000

    ostree: Do not make root private

 elements/core-deps/libostree.bst      |  5 +++++
 files/ostree/ostree-shared-root.patch | 38 +++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
---
diff --git a/elements/core-deps/libostree.bst b/elements/core-deps/libostree.bst
index 3e782b96..0bbe33c5 100644
--- a/elements/core-deps/libostree.bst
+++ b/elements/core-deps/libostree.bst
@@ -5,6 +5,11 @@ sources:
   url: github_com:ostreedev/ostree/releases/download/v2019.5/libostree-2019.5.tar.xz
 - kind: patch
   path: files/ostree/no-boot-symlink.patch
+- kind: patch
+  # This is required to allow BuildStream and Flatpak Builder flatpaks
+  # to run. Most distributions have root recursive shared. Doing
+  # differently can cause a different behavior.
+  path: files/ostree/ostree-shared-root.patch
 
 build-depends:
 - sdk/gobject-introspection.bst
diff --git a/files/ostree/ostree-shared-root.patch b/files/ostree/ostree-shared-root.patch
new file mode 100644
index 00000000..a5a19364
--- /dev/null
+++ b/files/ostree/ostree-shared-root.patch
@@ -0,0 +1,38 @@
+diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
+index c25d3fe9..0e5dca57 100644
+--- a/src/switchroot/ostree-prepare-root.c
++++ b/src/switchroot/ostree-prepare-root.c
+@@ -173,15 +173,6 @@ main(int argc, char *argv[])
+         err (EXIT_FAILURE, "failed to umount proc from /proc");
+     }
+ 
+-  /* Work-around for a kernel bug: for some reason the kernel
+-   * refuses switching root if any file systems are mounted
+-   * MS_SHARED. Hence remount them MS_PRIVATE here as a
+-   * work-around.
+-   *
+-   * https://bugzilla.redhat.com/show_bug.cgi?id=847418 */
+-  if (mount (NULL, "/", NULL, MS_REC|MS_PRIVATE, NULL) < 0)
+-    err (EXIT_FAILURE, "failed to make \"/\" private mount");
+-
+   /* Make deploy_path a bind mount, so we can move it later */
+   if (mount (deploy_path, deploy_path, NULL, MS_BIND, NULL) < 0)
+     err (EXIT_FAILURE, "failed to make initial bind mount %s", deploy_path);
+@@ -300,17 +291,6 @@ main(int argc, char *argv[])
+         err (EXIT_FAILURE, "couldn't remove temporary sysroot /sysroot.tmp");
+     }
+ 
+-  /* The /sysroot mount needs to be private to avoid having a mount for e.g. /var/cache
+-   * also propagate to /sysroot/ostree/deploy/$stateroot/var/cache
+-   *
+-   * Now in reality, today this is overridden by systemd: the *actual* way we fix this up
+-   * is in ostree-remount.c.  But let's do it here to express the semantics we want
+-   * at the very start (perhaps down the line systemd will have compile/runtime option
+-   * to say that the initramfs environment did everything right from the start).
+-   */
+-  if (mount ("none", "sysroot", NULL, MS_PRIVATE, NULL) < 0)
+-    err (EXIT_FAILURE, "remounting 'sysroot' private");
+-
+   if (running_as_pid1)
+     {
+       execl ("/sbin/init", "/sbin/init", NULL);


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