summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-boot.scm43
1 files changed, 13 insertions, 30 deletions
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 3712abe910..a1ff4dd1ea 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -241,20 +241,10 @@ the last argument of `mknod'."
           (filter-map string->number (scandir "/proc")))))
 
 (define* (mount-root-file-system root type
-                                 #:key volatile-root? (unionfs "unionfs"))
+                                 #:key volatile-root?)
   "Mount the root file system of type TYPE at device ROOT.  If VOLATILE-ROOT?
-is true, mount ROOT read-only and make it a union with a writable tmpfs using
-UNIONFS."
-  (define (mark-as-not-killable pid)
-    ;; Tell the 'user-processes' shepherd service that PID must be kept alive
-    ;; when shutting down.
-    (mkdir-p "/root/etc/shepherd")
-    (let ((port (open-file "/root/etc/shepherd/do-not-kill" "a")))
-      (chmod port #o600)
-      (write pid port)
-      (newline port)
-      (close-port port)))
-
+is true, mount ROOT read-only and make it a overlay with a writable tmpfs
+using the kernel build-in overlayfs."
   (if volatile-root?
       (begin
         (mkdir-p "/real-root")
@@ -262,24 +252,17 @@ UNIONFS."
         (mkdir-p "/rw-root")
         (mount "none" "/rw-root" "tmpfs")
 
+        ;; Create the upperdir and the workdir of the overlayfs
+        (mkdir-p "/rw-root/upper")
+        (mkdir-p "/rw-root/work")
+
         ;; We want read-write /dev nodes.
-        (mkdir-p "/rw-root/dev")
-        (mount "none" "/rw-root/dev" "devtmpfs")
-
-        ;; Make /root a union of the tmpfs and the actual root.  Use
-        ;; 'max_files' to set a high RLIMIT_NOFILE for the unionfs process
-        ;; itself.  Failing to do that, we quickly run out of file
-        ;; descriptors; see <http://bugs.gnu.org/17827>.
-        (unless (zero? (system* unionfs "-o"
-                                "cow,allow_other,use_ino,suid,dev,max_files=65536"
-                                "/rw-root=RW:/real-root=RO"
-                                "/root"))
-          (error "unionfs failed"))
-
-        ;; Make sure unionfs remains alive till the end.  Because
-        ;; 'fuse_daemonize' doesn't tell the PID of the forked daemon, we
-        ;; have to resort to 'pidof' here.
-        (mark-as-not-killable (pidof unionfs)))
+        (mkdir-p "/rw-root/upper/dev")
+        (mount "none" "/rw-root/upper/dev" "devtmpfs")
+
+        ;; Make /root an overlay of the tmpfs and the actual root.
+        (mount "none" "/root" "overlay" 0
+               "lowerdir=/real-root,upperdir=/rw-root/upper,workdir=/rw-root/work"))
       (begin
         (check-file-system root type)
         (mount root "/root" type)))