From a69576ea858863574252cbefbcef91db98773d60 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 16:57:57 +0200 Subject: system: Add '%devtmpfs-file-system' for udev, and '%base-file-systems'. Suggested by Adam Pribyl . * gnu/services/base.scm (udev-service)[requirement]: Add 'file-system-/dev'. * gnu/system/file-systems.scm (%devtmpfs-file-system, %base-file-systems): New variables. * gnu/system/install.scm (installation-services)[file-systems]: Use %base-file-systems. * build-aux/hydra/demo-os.scm (file-systems): Likewise. * doc/guix.texi (System Installation): Show %BASE-FILE-SYSTEMS in the example. (Using the Configuration System): Likewise. (File Systems): Document %base-file-systems, %devtmpfs-file-system, %binary-format-file-system, and %fuse-control-file-system. --- build-aux/hydra/demo-os.scm | 14 +++++++------- doc/guix.texi | 37 +++++++++++++++++++++++++++++++++---- gnu/services/base.scm | 9 +++++++-- gnu/system/file-systems.scm | 18 +++++++++++++++++- gnu/system/install.scm | 5 +++-- 5 files changed, 67 insertions(+), 16 deletions(-) diff --git a/build-aux/hydra/demo-os.scm b/build-aux/hydra/demo-os.scm index 89b67aabe3..9164500d70 100644 --- a/build-aux/hydra/demo-os.scm +++ b/build-aux/hydra/demo-os.scm @@ -44,13 +44,13 @@ (file-systems ;; We provide a dummy file system for /, but that's OK because the VM build ;; code will automatically declare the / file system for us. - (list (file-system - (mount-point "/") - (device "dummy") - (type "dummy")) - ;; %fuse-control-file-system ; needs fuse.ko - ;; %binary-format-file-system ; needs binfmt.ko - )) + (cons* (file-system + (mount-point "/") + (device "dummy") + (type "dummy")) + ;; %fuse-control-file-system ; needs fuse.ko + ;; %binary-format-file-system ; needs binfmt.ko + %base-file-systems)) (users (list (user-account (name "guest") diff --git a/doc/guix.texi b/doc/guix.texi index fb6f897bb2..2b05a75be4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2826,10 +2826,11 @@ only a root account would look like this: ;; Assuming /dev/sdX is the target hard disk, and /dev/sdX1 the ;; target root file system. (bootloader (grub-configuration (device "/dev/sdX"))) - (file-systems (list (file-system + (file-systems (cons (file-system (device "/dev/sdX1") (mount-point "/") - (type "ext4"))))) + (type "ext4")) + %base-file-systems))) @end example @noindent @@ -2925,10 +2926,11 @@ kernel, initial RAM disk, and boot loader looks like this: (locale "fr_FR.UTF-8") (bootloader (grub-configuration (device "/dev/sda"))) - (file-systems (list (file-system + (file-systems (cons (file-system (device "/dev/sda1") ; or partition label (mount-point "/") - (type "ext3")))) + (type "ext3")) + %base-file-systems)) (users (list (user-account (name "alice") (password "") @@ -3055,6 +3057,32 @@ errors before being mounted. @end table @end deftp +The @code{(gnu system file-systems)} exports the following useful +variables. + +@defvr {Scheme Variable} %base-file-systems +These are essential file systems that are required on normal systems, +such as @var{%devtmpfs-file-system} (see below.) Operating system +declarations should always contain at least these. +@end defvr + +@defvr {Scheme Variable} %devtmpfs-file-system +The @code{devtmpfs} file system to be mounted on @file{/dev}. This is a +requirement for udev (@pxref{Base Services, @code{udev-service}}). +@end defvr + +@defvr {Scheme Variable} %binary-format-file-system +The @code{binfmt_misc} file system, which allows handling of arbitrary +executable file types to be delegated to user space. This requires the +@code{binfmt.ko} kernel module to be loaded. +@end defvr + +@defvr {Scheme Variable} %fuse-control-file-system +The @code{fusectl} file system, which allows unprivileged users to mount +and unmount user-space FUSE file systems. This requires the +@code{fuse.ko} kernel module to be loaded. +@end defvr + @node User Accounts @subsection User Accounts @@ -3245,6 +3273,7 @@ passed to @command{guix-daemon}. Run @var{udev}, which populates the @file{/dev} directory dynamically. @end deffn + @node Networking Services @subsubsection Networking Services diff --git a/gnu/services/base.scm b/gnu/services/base.scm index ae12c8e93d..42e232c9ac 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -473,8 +473,13 @@ (define* (udev-service #:key (udev udev)) (with-monad %store-monad (return (service (provision '(udev)) - (requirement '(root-file-system)) - (documentation "Populate the /dev directory.") + + ;; Udev needs /dev to be a 'devtmpfs' mount so that new device + ;; nodes can be added: see + ;; . + (requirement '(root-file-system file-system-/dev)) + + (documentation "Populate the /dev directory, dynamically.") (start #~(lambda () (define udevd (string-append #$udev "/libexec/udev/udevd")) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 7852a6ab26..0c2021d7b4 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -30,7 +30,10 @@ (define-module (gnu system file-systems) file-system-options %fuse-control-file-system - %binary-format-file-system)) + %binary-format-file-system + %devtmpfs-file-system + + %base-file-systems)) ;;; Commentary: ;;; @@ -72,4 +75,17 @@ (define %binary-format-file-system (type "binfmt_misc") (check? #f))) +(define %devtmpfs-file-system + ;; /dev as a 'devtmpfs' file system, needed for udev. + (file-system + (device "none") + (mount-point "/dev") + (type "devtmpfs") + (check? #f))) + +(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)) + ;;; file-systems.scm ends here diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 18fd587ead..d4a32609ba 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -117,10 +117,11 @@ (define installation-os (file-systems ;; Note: the disk image build code overrides this root file system with ;; the appropriate one. - (list (file-system + (cons (file-system (mount-point "/") (device "gnu-disk-image") - (type "ext4")))) + (type "ext4")) + %base-file-systems)) (users (list (user-account (name "guest") -- cgit v1.2.3