summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2015-01-05 22:07:03 +0800
committer宋文武 <iyzsong@gmail.com>2015-01-05 22:24:00 +0800
commit9331ba5dd9dc2224b427d71f2ee56250463f4ef3 (patch)
treefbcc346e19355c6f25acd9983930041a015621ac /gnu/build
parent4379c35b73e912a42dcea7e89aae1e2edd9708cd (diff)
downloadguix-9331ba5dd9dc2224b427d71f2ee56250463f4ef3.tar.gz
linux-boot: Make /etc/mtab a symlink to /proc/self/mounts.
Fixes <http://bugs.gnu.org/19491>.

* gnu/build/linux-boot.scm (mount-root-file-system): Make /root/etc/mtab
  a symlink to /proc/self/mounts.
* gnu/build/file-systems.scm (mount-file-system): Don't update /etc/mtab.
* guix/build/syscalls.scm (mount, umount): Have #:update-mtab? default to
  #f.
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/file-systems.scm9
-rw-r--r--gnu/build/linux-boot.scm5
2 files changed, 5 insertions, 9 deletions
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 84f58538fd..38e4851515 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -287,13 +287,6 @@ run a file system check."
        (mount source mount-point type (mount-flags->bit-mask flags)
               (if options
                   (string->pointer options)
-                  %null-pointer))
-
-       ;; Update /etc/mtab.
-       (mkdir-p (string-append root "/etc"))
-       (let ((port (open-file (string-append root "/etc/mtab") "a")))
-         (format port "~a ~a ~a ~a 0 0~%"
-                 source mount-point type (or options "rw"))
-         (close-port port))))))
+                  %null-pointer))))))
 
 ;;; file-systems.scm ends here
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index b2ed1a8b54..3096989468 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -275,7 +275,10 @@ UNIONFS."
         (check-file-system root type)
         (mount root "/root" type)))
 
-  (copy-file "/proc/mounts" "/root/etc/mtab"))
+  ;; Make sure /root/etc/mtab is a symlink to /proc/self/mounts.
+  (when (file-exists? "/root/etc/mtab")
+    (delete-file "/root/etc/mtab"))
+  (symlink "/proc/self/mounts" "/root/etc/mtab"))
 
 (define (switch-root root)
   "Switch to ROOT as the root file system, in a way similar to what