file-systems: %base-file-systems: Add tmpfs /run.

* gnu/system/file-systems (%runtime-variable-data): New variable.
(%base-file-systems): Add it.
* doc/guix.texi (File Systems): Document it.
* gnu/services.scm (cleanup-gexp): Adjust accordingly.

Change-Id: I3a95e49d396fbb2577026aefc247cfe996c5f267
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Hilton Chain 2024-09-26 15:05:28 +08:00 committed by Maxim Cournoyer
parent c695de0d04
commit e88018be70
No known key found for this signature in database
GPG key ID: 1260E46482E63562
3 changed files with 20 additions and 5 deletions

View file

@ -18228,6 +18228,11 @@ The daemon itself is still able to write to the store: it remounts it
read-write in its own ``name space.'' read-write in its own ``name space.''
@end defvar @end defvar
@defvar %runtime-variable-data
This file system is mounted as @file{/run} and contains system
information data describing the system since it was booted.
@end defvar
@defvar %binary-format-file-system @defvar %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

View file

@ -632,7 +632,7 @@ information is missing, return the empty list (for channels) and possibly
#~(begin #~(begin
(use-modules (guix build utils)) (use-modules (guix build utils))
;; Clean out /tmp, /var/run, and /run. ;; Clean out /tmp and /var/run.
;; ;;
;; XXX This needs to happen before service activations, so it ;; XXX This needs to happen before service activations, so it
;; has to be here, but this also implicitly assumes that /tmp ;; has to be here, but this also implicitly assumes that /tmp
@ -663,15 +663,12 @@ information is missing, return the empty list (for channels) and possibly
(setlocale LC_CTYPE "en_US.utf8") (setlocale LC_CTYPE "en_US.utf8")
(delete-file-recursively "/tmp") (delete-file-recursively "/tmp")
(delete-file-recursively "/var/run") (delete-file-recursively "/var/run")
(delete-file-recursively "/run")
;; Note: The second argument to 'mkdir' is and'ed with umask, ;; Note: The second argument to 'mkdir' is and'ed with umask,
;; hence the 'chmod' calls. ;; hence the 'chmod' calls.
(mkdir "/tmp" #o1777) (mkdir "/tmp" #o1777)
(chmod "/tmp" #o1777) (chmod "/tmp" #o1777)
(mkdir "/var/run" #o755) (mkdir "/var/run" #o755)
(chmod "/var/run" #o755)
(mkdir "/run" #o755)
(chmod "/var/run" #o755)))))) (chmod "/var/run" #o755))))))
(define cleanup-service-type (define cleanup-service-type

View file

@ -82,6 +82,7 @@
%pseudo-terminal-file-system %pseudo-terminal-file-system
%tty-gid %tty-gid
%immutable-store %immutable-store
%runtime-variable-data
%control-groups %control-groups
%elogind-file-systems %elogind-file-systems
@ -448,6 +449,17 @@ TARGET in the other system."
(check? #f) (check? #f)
(flags '(read-only bind-mount no-atime)))) (flags '(read-only bind-mount no-atime))))
(define %runtime-variable-data
(file-system
(type "tmpfs")
(mount-point "/run")
(device "tmpfs")
(flags '(no-suid no-dev strict-atime))
(options "mode=0755,nr_inodes=800k,size=20%")
(needed-for-boot? #t)
(check? #f)
(create-mount-point? #t)))
(define %control-groups (define %control-groups
;; The cgroup2 file system. ;; The cgroup2 file system.
(list (file-system (list (file-system
@ -497,7 +509,8 @@ TARGET in the other system."
%debug-file-system %debug-file-system
%shared-memory-file-system %shared-memory-file-system
%efivars-file-system %efivars-file-system
%immutable-store)) %immutable-store
%runtime-variable-data))
(define %base-live-file-systems (define %base-live-file-systems
;; This is the bare minimum to use live file-systems. ;; This is the bare minimum to use live file-systems.