summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-22 23:13:53 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-23 02:02:07 +0200
commit7f239fd33ff7bf2f1ec48de37f14479699d4096f (patch)
treeab1a5a5689a5053cf45493e9f0f3393fbdafc9e5 /gnu
parent4e469051a77d02435eafb1df93224a2ce1bb3146 (diff)
downloadguix-7f239fd33ff7bf2f1ec48de37f14479699d4096f.tar.gz
system: Add 'file-system' decl. for /dev/pts, and use the right options.
Fixes <http://bugs.gnu.org/18081>.

* gnu/system/file-systems.scm (%devtmpfs-file-system): Add
  'needed-for-boot?' field.
  (%tty-gid, %pseudo-terminal-file-system): New variables.
  (%base-file-systems): Add %PSEUDO-TERMINAL-FILE-SYSTEM.
* gnu/services/base.scm (udev-service): Remove dependency on
  'file-system-/dev'.
* gnu/system/shadow.scm (%base-groups): Add 'id' field for group 'tty'.
* guix/build/linux-initrd.scm (boot-system): Remove 'mount' call for
  /dev/pts.
* doc/guix.texi (File Systems): Add %pseudo-terminal-file-system.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm2
-rw-r--r--gnu/system/file-systems.scm26
-rw-r--r--gnu/system/shadow.scm4
3 files changed, 28 insertions, 4 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 9a67109db0..2c9054af48 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -482,7 +482,7 @@ passed to @command{guix-daemon}."
              ;; Udev needs /dev to be a 'devtmpfs' mount so that new device
              ;; nodes can be added: see
              ;; <http://www.linuxfromscratch.org/lfs/view/development/chapter07/udev.html>.
-             (requirement '(root-file-system file-system-/dev))
+             (requirement '(root-file-system))
 
              (documentation "Populate the /dev directory, dynamically.")
              (start #~(lambda ()
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index ea8d961317..76460d95af 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -85,11 +85,33 @@
     (device "none")
     (mount-point "/dev")
     (type "devtmpfs")
-    (check? #f)))
+    (check? #f)
+
+    ;; Mount it from the initrd so /dev/pts & co. can then be mounted over it.
+    (needed-for-boot? #t)))
+
+(define %tty-gid
+  ;; ID of the 'tty' group.  Allocate it statically to make it easy to refer
+  ;; to it from here and from the 'tty' group definitions.
+  1004)
+
+(define %pseudo-terminal-file-system
+  ;; The pseudo-terminal file system.  It needs to be mounted so that
+  ;; statfs(2) returns DEVPTS_SUPER_MAGIC like libc's getpt(3) expects (and
+  ;; thus openpty(3) and its users, such as xterm.)
+  (file-system
+    (device "none")
+    (mount-point "/dev/pts")
+    (type "devpts")
+    (check? #f)
+    (needed-for-boot? #f)
+    (create-mount-point? #t)
+    (options (string-append "gid=" (number->string %tty-gid) ",mode=620"))))
 
 (define %base-file-systems
   ;; List of basic file systems to be mounted.  Note that /proc and /sys are
   ;; currently mounted by the initrd.
-  (list %devtmpfs-file-system))
+  (list %devtmpfs-file-system
+        %pseudo-terminal-file-system))
 
 ;;; file-systems.scm ends here
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index ae6eac9a5b..e29dbb8c3e 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -20,6 +20,8 @@
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (guix monads)
+  #:use-module ((gnu system file-systems)
+                #:select (%tty-gid))
   #:use-module ((gnu packages admin)
                 #:select (shadow))
   #:use-module (gnu packages bash)
@@ -84,7 +86,7 @@
 
         ;; The following groups are conventionally used by things like udev to
         ;; control access to hardware devices.
-        (user-group (name "tty"))
+        (user-group (name "tty") (id %tty-gid))
         (user-group (name "dialout"))
         (user-group (name "kmem"))
         (user-group (name "video"))