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.
This commit is contained in:
		
							parent
							
								
									4e469051a7
								
							
						
					
					
						commit
						7f239fd33f
					
				
					 5 changed files with 36 additions and 9 deletions
				
			
		|  | @ -3074,6 +3074,14 @@ The @code{devtmpfs} file system to be mounted on @file{/dev}.  This is a | ||||||
| requirement for udev (@pxref{Base Services, @code{udev-service}}). | requirement for udev (@pxref{Base Services, @code{udev-service}}). | ||||||
| @end defvr | @end defvr | ||||||
| 
 | 
 | ||||||
|  | @defvr {Scheme Variable} %pseudo-terminal-file-system | ||||||
|  | This is the file system to be mounted as @file{/dev/pts}.  It supports | ||||||
|  | @dfn{pseudo-terminals} created @i{via} @code{openpty} and similar | ||||||
|  | functions (@pxref{Pseudo-Terminals,,, libc, The GNU C Library Reference | ||||||
|  | Manual}).  Pseudo-terminals are used by terminal emulators such as | ||||||
|  | @command{xterm}. | ||||||
|  | @end defvr | ||||||
|  | 
 | ||||||
| @defvr {Scheme Variable} %binary-format-file-system | @defvr {Scheme Variable} %binary-format-file-system | ||||||
| The @code{binfmt_misc} file system, which allows handling of arbitrary | The @code{binfmt_misc} file system, which allows handling of arbitrary | ||||||
| executable file types to be delegated to user space.  This requires the | executable file types to be delegated to user space.  This requires the | ||||||
|  |  | ||||||
|  | @ -482,7 +482,7 @@ passed to @command{guix-daemon}." | ||||||
|              ;; Udev needs /dev to be a 'devtmpfs' mount so that new device |              ;; Udev needs /dev to be a 'devtmpfs' mount so that new device | ||||||
|              ;; nodes can be added: see |              ;; nodes can be added: see | ||||||
|              ;; <http://www.linuxfromscratch.org/lfs/view/development/chapter07/udev.html>. |              ;; <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.") |              (documentation "Populate the /dev directory, dynamically.") | ||||||
|              (start #~(lambda () |              (start #~(lambda () | ||||||
|  |  | ||||||
|  | @ -85,11 +85,33 @@ | ||||||
|     (device "none") |     (device "none") | ||||||
|     (mount-point "/dev") |     (mount-point "/dev") | ||||||
|     (type "devtmpfs") |     (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 | (define %base-file-systems | ||||||
|   ;; List of basic file systems to be mounted.  Note that /proc and /sys are |   ;; List of basic file systems to be mounted.  Note that /proc and /sys are | ||||||
|   ;; currently mounted by the initrd. |   ;; currently mounted by the initrd. | ||||||
|   (list %devtmpfs-file-system)) |   (list %devtmpfs-file-system | ||||||
|  |         %pseudo-terminal-file-system)) | ||||||
| 
 | 
 | ||||||
| ;;; file-systems.scm ends here | ;;; file-systems.scm ends here | ||||||
|  |  | ||||||
|  | @ -20,6 +20,8 @@ | ||||||
|   #:use-module (guix records) |   #:use-module (guix records) | ||||||
|   #:use-module (guix gexp) |   #:use-module (guix gexp) | ||||||
|   #:use-module (guix monads) |   #:use-module (guix monads) | ||||||
|  |   #:use-module ((gnu system file-systems) | ||||||
|  |                 #:select (%tty-gid)) | ||||||
|   #:use-module ((gnu packages admin) |   #:use-module ((gnu packages admin) | ||||||
|                 #:select (shadow)) |                 #:select (shadow)) | ||||||
|   #:use-module (gnu packages bash) |   #:use-module (gnu packages bash) | ||||||
|  | @ -84,7 +86,7 @@ | ||||||
| 
 | 
 | ||||||
|         ;; The following groups are conventionally used by things like udev to |         ;; The following groups are conventionally used by things like udev to | ||||||
|         ;; control access to hardware devices. |         ;; control access to hardware devices. | ||||||
|         (user-group (name "tty")) |         (user-group (name "tty") (id %tty-gid)) | ||||||
|         (user-group (name "dialout")) |         (user-group (name "dialout")) | ||||||
|         (user-group (name "kmem")) |         (user-group (name "kmem")) | ||||||
|         (user-group (name "video")) |         (user-group (name "video")) | ||||||
|  |  | ||||||
|  | @ -670,11 +670,6 @@ to it are lost." | ||||||
|              (switch-root "/root") |              (switch-root "/root") | ||||||
|              (format #t "loading '~a'...\n" to-load) |              (format #t "loading '~a'...\n" to-load) | ||||||
| 
 | 
 | ||||||
|              ;; Obviously this has to be done each time we boot.  Do it from here |  | ||||||
|              ;; so that statfs(2) returns DEVPTS_SUPER_MAGIC like libc's getpt(3) |  | ||||||
|              ;; expects (and thus openpty(3) and its users, such as xterm.) |  | ||||||
|              (mount "none" "/dev/pts" "devpts") |  | ||||||
| 
 |  | ||||||
|              ;; TODO: Remove /lib, /share, and /loader.go. |              ;; TODO: Remove /lib, /share, and /loader.go. | ||||||
|              (primitive-load to-load) |              (primitive-load to-load) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue