* [bug#73494] [PATCH 0/2] tmpfs /run.
@ 2024-09-26 6:44 Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 1/2] file-systems: %base-file-systems: Add " Hilton Chain via Guix-patches via
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Hilton Chain via Guix-patches via @ 2024-09-26 6:44 UTC (permalink / raw)
To: 73494; +Cc: Hilton Chain
Hi Guix,
This series adds a tmpfs /run to %base-file-systems and symlinks /var/run to
it.
Mount options are taken from Systemd[1], OpenRC also uses the same ones[2].
(Except no-suid since we have /run/privileged/bin.)
Thanks
[1]: https://github.com/systemd/systemd/blob/v256.6/src/shared/mount-setup.c#L102
[2]: https://github.com/OpenRC/openrc/blob/0.55.1/sh/init.sh.Linux.in#L74
Hilton Chain (2):
file-systems: %base-file-systems: Add tmpfs /run.
services: cleanup: Make /var/run a symlink of /run.
doc/guix.texi | 5 +++++
gnu/services.scm | 6 +-----
gnu/services/dbus.scm | 31 -------------------------------
gnu/system/file-systems.scm | 15 ++++++++++++++-
4 files changed, 20 insertions(+), 37 deletions(-)
base-commit: 8576aaf5f90db9b385ea8cf6dc98bf3c062959dc
--
2.46.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 1/2] file-systems: %base-file-systems: Add tmpfs /run.
2024-09-26 6:44 [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
@ 2024-09-26 7:05 ` Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 2/2] services: cleanup: Make /var/run a symlink of /run Hilton Chain via Guix-patches via
2024-09-29 3:18 ` [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2 siblings, 0 replies; 12+ messages in thread
From: Hilton Chain via Guix-patches via @ 2024-09-26 7:05 UTC (permalink / raw)
To: 73494; +Cc: Hilton Chain, Florian Pelz, Ludovic Courtès, Maxim Cournoyer
* 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
---
doc/guix.texi | 5 +++++
gnu/services.scm | 5 +----
gnu/system/file-systems.scm | 15 ++++++++++++++-
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 52e36e4354..54edd14d1b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17988,6 +17988,11 @@ File Systems
read-write in its own ``name space.''
@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
The @code{binfmt_misc} file system, which allows handling of arbitrary
executable file types to be delegated to user space. This requires the
diff --git a/gnu/services.scm b/gnu/services.scm
index 8a4002e072..ea855ad193 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -632,7 +632,7 @@ (define (cleanup-gexp _)
#~(begin
(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
;; has to be here, but this also implicitly assumes that /tmp
@@ -663,15 +663,12 @@ (define (cleanup-gexp _)
(setlocale LC_CTYPE "en_US.utf8")
(delete-file-recursively "/tmp")
(delete-file-recursively "/var/run")
- (delete-file-recursively "/run")
;; Note: The second argument to 'mkdir' is and'ed with umask,
;; hence the 'chmod' calls.
(mkdir "/tmp" #o1777)
(chmod "/tmp" #o1777)
(mkdir "/var/run" #o755)
- (chmod "/var/run" #o755)
- (mkdir "/run" #o755)
(chmod "/var/run" #o755))))))
(define cleanup-service-type
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 4ea8237c70..65704d7681 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -82,6 +82,7 @@ (define-module (gnu system file-systems)
%pseudo-terminal-file-system
%tty-gid
%immutable-store
+ %runtime-variable-data
%control-groups
%elogind-file-systems
@@ -448,6 +449,17 @@ (define %immutable-store
(check? #f)
(flags '(read-only bind-mount no-atime))))
+(define %runtime-variable-data
+ (file-system
+ (type "tmpfs")
+ (mount-point "/run")
+ (device "tmpfs")
+ (flags '(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
;; The cgroup2 file system.
(list (file-system
@@ -497,7 +509,8 @@ (define %base-file-systems
%debug-file-system
%shared-memory-file-system
%efivars-file-system
- %immutable-store))
+ %immutable-store
+ %runtime-variable-data))
(define %base-live-file-systems
;; This is the bare minimum to use live file-systems.
base-commit: 8576aaf5f90db9b385ea8cf6dc98bf3c062959dc
--
2.46.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 2/2] services: cleanup: Make /var/run a symlink of /run.
2024-09-26 6:44 [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 1/2] file-systems: %base-file-systems: Add " Hilton Chain via Guix-patches via
@ 2024-09-26 7:05 ` Hilton Chain via Guix-patches via
2024-09-29 3:18 ` [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2 siblings, 0 replies; 12+ messages in thread
From: Hilton Chain via Guix-patches via @ 2024-09-26 7:05 UTC (permalink / raw)
To: 73494; +Cc: Hilton Chain
* gnu/services.scm (cleanup-gexp): Make /var/run a symlink of /run.
* gnu/services/dbus.scm (dbus-activation): Adjust accordingly.
Change-Id: I7b94d3e2fe1bef66f435e84bc77f32311dddd0ce
---
gnu/services.scm | 3 +--
gnu/services/dbus.scm | 31 -------------------------------
2 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/gnu/services.scm b/gnu/services.scm
index ea855ad193..50af5f56b6 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -668,8 +668,7 @@ (define (cleanup-gexp _)
;; hence the 'chmod' calls.
(mkdir "/tmp" #o1777)
(chmod "/tmp" #o1777)
- (mkdir "/var/run" #o755)
- (chmod "/var/run" #o755))))))
+ (symlink "/run" "/var/run"))))))
(define cleanup-service-type
;; Service that cleans things up in /tmp and similar.
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 76e04bf221..9292172e01 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -190,37 +190,6 @@ (define (dbus-activation config)
;; world-readable.
(mkdir-p/perms "/run/dbus" user #o755))
- (catch 'system-error
- (lambda ()
- (symlink "/run/dbus" "/var/run/dbus"))
- (lambda args
- (let ((errno (system-error-errno args)))
- (cond
- ((= errno EEXIST)
- (let ((existing-name
- (false-if-exception
- (readlink "/var/run/dbus"))))
- (unless (equal? existing-name "/run/dbus")
- ;; Move the content of /var/run/dbus to /run/dbus, and
- ;; retry.
- (let ((dir (opendir "/var/run/dbus")))
- (let loop ((next (readdir dir)))
- (cond
- ((eof-object? next) (closedir dir))
- ((member next '("." "..")) (loop (readdir dir)))
- (else
- (begin
- (rename-file (string-append "/var/run/dbus/" next)
- (string-append "/run/dbus/" next))
- (loop (readdir dir)))))))
- (rmdir "/var/run/dbus")
- (symlink "/run/dbus" "/var/run/dbus"))))
- (else
- (format (current-error-port)
- "Failed to symlink /run/dbus to /var/run/dbus: ~s~%"
- (strerror errno))
- (error "cannot create /var/run/dbus"))))))
-
(unless (file-exists? "/etc/machine-id")
(format #t "creating /etc/machine-id...~%")
(invoke (string-append #$(dbus-configuration-dbus config)
--
2.46.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-09-26 6:44 [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 1/2] file-systems: %base-file-systems: Add " Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 2/2] services: cleanup: Make /var/run a symlink of /run Hilton Chain via Guix-patches via
@ 2024-09-29 3:18 ` Hilton Chain via Guix-patches via
2024-10-30 6:37 ` Maxim Cournoyer
2 siblings, 1 reply; 12+ messages in thread
From: Hilton Chain via Guix-patches via @ 2024-09-29 3:18 UTC (permalink / raw)
To: 73494
On Thu, 26 Sep 2024 14:44:52 +0800,
Hilton Chain wrote:
>
> Hi Guix,
>
> This series adds a tmpfs /run to %base-file-systems and symlinks /var/run to
> it.
>
> Mount options are taken from Systemd[1], OpenRC also uses the same ones[2].
> (Except no-suid since we have /run/privileged/bin.)
>
> Thanks
>
> [1]: https://github.com/systemd/systemd/blob/v256.6/src/shared/mount-setup.c#L102
> [2]: https://github.com/OpenRC/openrc/blob/0.55.1/sh/init.sh.Linux.in#L74
>
> Hilton Chain (2):
> file-systems: %base-file-systems: Add tmpfs /run.
> services: cleanup: Make /var/run a symlink of /run.
>
> doc/guix.texi | 5 +++++
> gnu/services.scm | 6 +-----
> gnu/services/dbus.scm | 31 -------------------------------
> gnu/system/file-systems.scm | 15 ++++++++++++++-
> 4 files changed, 20 insertions(+), 37 deletions(-)
>
>
> base-commit: 8576aaf5f90db9b385ea8cf6dc98bf3c062959dc
> --
> 2.46.0
As adding mount point to /run requires an immediate reboot after reconfiguring
from a system without it, I'll also add a news entry for the change.
Merging /var/run and /run is the easiest part, since they are supposed to be
cleaned upon booting and nothing will break with the change. However there're
many references to both directories in our codebase. I'm not sure if these
references should be unified as well.
I won't hurry on pushing this change, please leave a comment if you want the
change or there's any concern about it.
Thanks
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-09-29 3:18 ` [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
@ 2024-10-30 6:37 ` Maxim Cournoyer
2024-11-03 15:45 ` Hilton Chain via Guix-patches via
0 siblings, 1 reply; 12+ messages in thread
From: Maxim Cournoyer @ 2024-10-30 6:37 UTC (permalink / raw)
To: Hilton Chain; +Cc: 73494
Hi Hilton,
Hilton Chain <hako@ultrarare.space> writes:
> On Thu, 26 Sep 2024 14:44:52 +0800,
> Hilton Chain wrote:
>>
>> Hi Guix,
>>
>> This series adds a tmpfs /run to %base-file-systems and symlinks /var/run to
>> it.
>>
>> Mount options are taken from Systemd[1], OpenRC also uses the same ones[2].
>> (Except no-suid since we have /run/privileged/bin.)
>>
>> Thanks
>>
>> [1]: https://github.com/systemd/systemd/blob/v256.6/src/shared/mount-setup.c#L102
>> [2]: https://github.com/OpenRC/openrc/blob/0.55.1/sh/init.sh.Linux.in#L74
>>
>> Hilton Chain (2):
>> file-systems: %base-file-systems: Add tmpfs /run.
>> services: cleanup: Make /var/run a symlink of /run.
>>
>> doc/guix.texi | 5 +++++
>> gnu/services.scm | 6 +-----
>> gnu/services/dbus.scm | 31 -------------------------------
>> gnu/system/file-systems.scm | 15 ++++++++++++++-
>> 4 files changed, 20 insertions(+), 37 deletions(-)
>>
>>
>> base-commit: 8576aaf5f90db9b385ea8cf6dc98bf3c062959dc
>> --
>> 2.46.0
>
> As adding mount point to /run requires an immediate reboot after reconfiguring
> from a system without it, I'll also add a news entry for the change.
>
> Merging /var/run and /run is the easiest part, since they are supposed to be
> cleaned upon booting and nothing will break with the change. However there're
> many references to both directories in our codebase. I'm not sure if these
> references should be unified as well.
>
> I won't hurry on pushing this change, please leave a comment if you want the
> change or there's any concern about it.
I think it's a worthwhile change. It'd be neat to unify every reference
to /var/run to /run in the doc/code too.
I'll be trying this on the build farm as there's an annoying problem
with anonip that creates FIFOs under /run/anonip, and these currently
become plain files upon reboot, breaking the anonip-service services.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-10-30 6:37 ` Maxim Cournoyer
@ 2024-11-03 15:45 ` Hilton Chain via Guix-patches via
2024-11-04 12:12 ` Maxim Cournoyer
2024-11-04 12:12 ` Maxim Cournoyer
0 siblings, 2 replies; 12+ messages in thread
From: Hilton Chain via Guix-patches via @ 2024-11-03 15:45 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 73494
Hi Maxim,
On Wed, 30 Oct 2024 14:37:39 +0800,
Maxim Cournoyer wrote:
> I think it's a worthwhile change. It'd be neat to unify every reference
> to /var/run to /run in the doc/code too.
Thank you, I'm now thinking of unifying them without the tmpfs change, since the
tmpfs is not strictly necessary.
> I'll be trying this on the build farm as there's an annoying problem
> with anonip that creates FIFOs under /run/anonip, and these currently
> become plain files upon reboot, breaking the anonip-service services.
Won't these files be deleted (c250033aa69f: services: cleanup: Delete /run upon
boot.) at boot?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-11-03 15:45 ` Hilton Chain via Guix-patches via
@ 2024-11-04 12:12 ` Maxim Cournoyer
2024-11-04 12:12 ` Maxim Cournoyer
1 sibling, 0 replies; 12+ messages in thread
From: Maxim Cournoyer @ 2024-11-04 12:12 UTC (permalink / raw)
To: Hilton Chain; +Cc: 73494
Hi Hilton,
Hilton Chain <hako@ultrarare.space> writes:
> Hi Maxim,
>
> On Wed, 30 Oct 2024 14:37:39 +0800,
> Maxim Cournoyer wrote:
>> I think it's a worthwhile change. It'd be neat to unify every reference
>> to /var/run to /run in the doc/code too.
>
> Thank you, I'm now thinking of unifying them without the tmpfs change, since the
> tmpfs is not strictly necessary.
>
>> I'll be trying this on the build farm as there's an annoying problem
>> with anonip that creates FIFOs under /run/anonip, and these currently
>> become plain files upon reboot, breaking the anonip-service services.
>
> Won't these files be deleted (c250033aa69f: services: cleanup: Delete /run upon
> boot.) at boot?
Yes, they should, but I didn't want to take anything for granted. I've
come up with a reproducer (system tests) and a fix (already pushed) for
it in the series https://issues.guix.gnu.org/74151
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-11-03 15:45 ` Hilton Chain via Guix-patches via
2024-11-04 12:12 ` Maxim Cournoyer
@ 2024-11-04 12:12 ` Maxim Cournoyer
2024-12-15 16:35 ` Ludovic Courtès
1 sibling, 1 reply; 12+ messages in thread
From: Maxim Cournoyer @ 2024-11-04 12:12 UTC (permalink / raw)
To: Hilton Chain; +Cc: 73494
Hello,
Hilton Chain <hako@ultrarare.space> writes:
> Hi Maxim,
>
> On Wed, 30 Oct 2024 14:37:39 +0800,
> Maxim Cournoyer wrote:
>> I think it's a worthwhile change. It'd be neat to unify every reference
>> to /var/run to /run in the doc/code too.
>
> Thank you, I'm now thinking of unifying them without the tmpfs change, since the
> tmpfs is not strictly necessary.
>
>> I'll be trying this on the build farm as there's an annoying problem
>> with anonip that creates FIFOs under /run/anonip, and these currently
>> become plain files upon reboot, breaking the anonip-service services.
>
> Won't these files be deleted (c250033aa69f: services: cleanup: Delete /run upon
> boot.) at boot?
Another thought; is tmpfs implemented on the Hurd?
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-11-04 12:12 ` Maxim Cournoyer
@ 2024-12-15 16:35 ` Ludovic Courtès
2024-12-16 9:13 ` Maxim Cournoyer
0 siblings, 1 reply; 12+ messages in thread
From: Ludovic Courtès @ 2024-12-15 16:35 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: Hilton Chain, 73494
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> Another thought; is tmpfs implemented on the Hurd?
Yes, perhaps it’s even older than on Linux, but our file system mounting
code won’t work there (libc does not provide the ‘mount’ function on the
Hurd).
Ludo’.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-12-15 16:35 ` Ludovic Courtès
@ 2024-12-16 9:13 ` Maxim Cournoyer
2024-12-20 15:23 ` Hilton Chain
0 siblings, 1 reply; 12+ messages in thread
From: Maxim Cournoyer @ 2024-12-16 9:13 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: Hilton Chain, 73494
Hi,
Ludovic Courtès <ludo@gnu.org> writes:
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Another thought; is tmpfs implemented on the Hurd?
>
> Yes, perhaps it’s even older than on Linux, but our file system mounting
> code won’t work there (libc does not provide the ‘mount’ function on the
> Hurd).
I see; so it's not any more a blocker than the current situation, since
we already have some issue with our current code on Hurd.
Hilton, I think this series is fine to apply. As you previously
mentioned, a news entry will be necessary to let Guix System users to
reboot after a reconfiguration past this change.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-12-16 9:13 ` Maxim Cournoyer
@ 2024-12-20 15:23 ` Hilton Chain
2024-12-20 15:40 ` Hilton Chain
0 siblings, 1 reply; 12+ messages in thread
From: Hilton Chain @ 2024-12-20 15:23 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: Ludovic Courtès, 73494
On Mon, 16 Dec 2024 17:13:35 +0800,
Maxim Cournoyer wrote:
>
> Hi,
>
> Ludovic Courtès <ludo@gnu.org> writes:
>
> > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> >
> >> Another thought; is tmpfs implemented on the Hurd?
> >
> > Yes, perhaps it’s even older than on Linux, but our file system mounting
> > code won’t work there (libc does not provide the ‘mount’ function on the
> > Hurd).
>
> I see; so it's not any more a blocker than the current situation, since
> we already have some issue with our current code on Hurd.
>
> Hilton, I think this series is fine to apply. As you previously
> mentioned, a news entry will be necessary to let Guix System users to
> reboot after a reconfiguration past this change.
Thanks! I tried this change again and now it seems the newly-added filesystem
won't be automatically mounted.
Another concern I have is, with /run and /var/run unified,
‘guix system roll-back’ and ‘guix system switch-generation’ can't finish the
activation stage because of the error handling in dbus-activation from previous
generations.
--8<---------------cut here---------------start------------->8---
$ guix system describe
Generation 7 Dec 20 2024 23:10:05 (current)
[...]
$ sudo guix system roll-back
[...]
switched from generation 7 to 6
[...]
guix system: error: rmdir: Directory not empty
$ guix system describe
Generation 6 Dec 20 2024 22:57:19 (current)
--8<---------------cut here---------------end--------------->8---
Do we have a way to fix this?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#73494] [PATCH 0/2] tmpfs /run.
2024-12-20 15:23 ` Hilton Chain
@ 2024-12-20 15:40 ` Hilton Chain
0 siblings, 0 replies; 12+ messages in thread
From: Hilton Chain @ 2024-12-20 15:40 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: Ludovic Courtès, 73494
On Fri, 20 Dec 2024 23:23:29 +0800,
Hilton Chain wrote:
>
> Thanks! I tried this change again and now it seems the newly-added filesystem
> won't be automatically mounted.
won't be automatically mounted so that an immediate reboot is not required*
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-12-20 15:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26 6:44 [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 1/2] file-systems: %base-file-systems: Add " Hilton Chain via Guix-patches via
2024-09-26 7:05 ` [bug#73494] [PATCH 2/2] services: cleanup: Make /var/run a symlink of /run Hilton Chain via Guix-patches via
2024-09-29 3:18 ` [bug#73494] [PATCH 0/2] tmpfs /run Hilton Chain via Guix-patches via
2024-10-30 6:37 ` Maxim Cournoyer
2024-11-03 15:45 ` Hilton Chain via Guix-patches via
2024-11-04 12:12 ` Maxim Cournoyer
2024-11-04 12:12 ` Maxim Cournoyer
2024-12-15 16:35 ` Ludovic Courtès
2024-12-16 9:13 ` Maxim Cournoyer
2024-12-20 15:23 ` Hilton Chain
2024-12-20 15:40 ` Hilton Chain
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.