From patchwork Thu Mar 6 06:22:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39720 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B184227BBEA; Thu, 6 Mar 2025 06:24:37 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2616527BBE2 for ; Thu, 6 Mar 2025 06:24:37 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tq4eN-0000fR-PS; Thu, 06 Mar 2025 01:24:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tq4eL-0000Xp-Dr for guix-patches@gnu.org; Thu, 06 Mar 2025 01:24:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tq4eK-0004JB-4c; Thu, 06 Mar 2025 01:24:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=+hYgIql8O1QiQx7epT66Kt9Jlij3iQazqc+pwblRp6c=; b=AMqUYti6ehZwDcm9n2WCXWeHEqj0vaeUGxsYimYIzixeCMEuIc4sVynrgbydatnva9Y3bCW4r61NwfrCJBsdNdS2vrjiB229e2GUoSMaB9w5bbiE8sH8gAgKJpRglb2EsilvJIp5RFq/aUZ77Ma1Xw6mqj88T4srzCi6cD9Sp8fDudAP99JZMmStR4Fsr14CcGUXEd5nxrgyflMSwcpX7Qj/nPgiCBM9BHBJKydFK4qm5akg6dmlJKkd9MuPhH9K6epaL21R/d4CnLCk1eGyUnD0L1DvHHX+S/+fDw/T6JE767w9NG/hPcnklfueUnKG8TW2v2aXQkZsQutqPtRzXA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tq4eI-0002d7-NE; Thu, 06 Mar 2025 01:24:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v3 1/3] file-systems: %base-file-systems: Add tmpfs /run. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Mar 2025 06:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73494@debbugs.gnu.org Cc: Hilton Chain , Maxim Cournoyer , Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.174124220410011 (code B ref 73494); Thu, 06 Mar 2025 06:24:02 +0000 Received: (at 73494) by debbugs.gnu.org; 6 Mar 2025 06:23:24 +0000 Received: from localhost ([127.0.0.1]:41008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tq4df-0002bO-IX for submit@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:24 -0500 Received: from mx.boiledscript.com ([2a01:4f8:10b:392::42]:59382) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tq4dd-0002b5-KB for 73494@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:22 -0500 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1741242199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+hYgIql8O1QiQx7epT66Kt9Jlij3iQazqc+pwblRp6c=; b=iKmj5SQ8dgbEnoJV0kEcYd62HeBq9mjLQb8IvH8ub+92VRiQ2mCbGmp8/D2+Oaeuc+/XBn buX9AXL1CP0FBc8OXuoe78iVBF3nigrYaHQ9ZrCc88mJwvtNyPbfQUXlWSqjZCSRAjVtbZ k3R/MjBKKTepLSq6zGUGC2DhV4uYMqjl9pXUZ+eZauuIG7ZrPWXYfYlvQKlfeY7k0vG8i3 xvur2zT2s4EUn3PyR/H9R4sXUgWbCTayJwEIe8qJ5yxR6sndglkRq6rD8BKd55vQT8XukY aqqiyOEj6bL9baO0nusu+GGe6K5/kYggiAjM7M1R6INdb+opPCGhUgzS5RMGfA== Date: Thu, 6 Mar 2025 14:22:42 +0800 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 --- doc/guix.texi | 5 +++++ gnu/services.scm | 5 +---- gnu/system/file-systems.scm | 17 ++++++++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6844470ce2..70e5db4156 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18228,6 +18228,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..b2766707a3 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,19 @@ (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") + ;; Don't use no-suid here as /run/privileged/bin may contain SUID + ;; executables. + (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 +511,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. From patchwork Thu Mar 6 06:22:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39722 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3C66927BBE9; Thu, 6 Mar 2025 06:24:48 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1499F27BBE2 for ; Thu, 6 Mar 2025 06:24:47 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tq4eQ-0000kQ-Jy; Thu, 06 Mar 2025 01:24:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tq4eM-0000co-S1 for guix-patches@gnu.org; Thu, 06 Mar 2025 01:24:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tq4eM-0004JT-FL; Thu, 06 Mar 2025 01:24:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=wM8I+shtBwD47dxcxMU2gngWqYsqlrGUfiNhO6FIccQ=; b=C6gV5BsvePHtydRT+TDpEap68GfJQtxUdBZ5F4DUIu9ylZF3zYpV8xHGPo4ym6BhluXvtKuwLrgdczH3NVmrD9gWO71ylTs494ieBKlgLxKMWZVpXgE+IEPIDM6x7yh+Nl2U++AYn21ZVKetSPY7x/HduX5VoJ/kIldvC9JA+QGgxdKI71+/+EiltcdXNoz5UMzqqmocrW5Gy3lDe32uTPatCB0xKwgiWWPGDdKxJLo6BnQoZibfSRkAsTOX+VZdfnONvkO/tpjnTwXDg+QQPrN4Q31brIgfL3MqaGnOnWdJUBj4t9W+/R9AIfkH0pNE3MMxjrxtPYeZdg/+p9Zptw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tq4eJ-0002dF-5i; Thu, 06 Mar 2025 01:24:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v3 2/3] services: cleanup: Make /var/run a symlink of /run. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Mar 2025 06:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73494@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.174124220710028 (code B ref 73494); Thu, 06 Mar 2025 06:24:03 +0000 Received: (at 73494) by debbugs.gnu.org; 6 Mar 2025 06:23:27 +0000 Received: from localhost ([127.0.0.1]:41011 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tq4dj-0002bf-6Z for submit@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:27 -0500 Received: from mx.boiledscript.com ([88.99.243.112]:37248) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tq4df-0002bM-Qh for 73494@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:24 -0500 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1741242202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wM8I+shtBwD47dxcxMU2gngWqYsqlrGUfiNhO6FIccQ=; b=Q+TbHfb980gIg/Vh0N+Qvb9gJmLKTNtOaZLrsiN6ZY/GRvQ/OHGgsFWddrczyKNPM/c9Gy YRdMsNUzNqagL2zWEpzDp6Y7PUrhL2G7muh1AAX1XRxkKtxsP+VtS5xMEGqQiLeMmb1UFA nxjR9m2CFGbVZCEK6AXi2q3Bj2fir/+dNTqhcJGoGRVx8Ipgcci/imnvM5hlJLdUzDL7CU e7uYALbPjl9Owi28YTC/UdnBiteH1b5sd5/Hghl46qj4ghmNifWLuxc/tD04Zu7VLkmuCV xZWy2BNp3fbqgIZYLQt+jEpqnyC7BNGkkfWHU/rbua0DY5scLymIXkaVmbFHpg== Date: Thu, 6 Mar 2025 14:22:43 +0800 Message-ID: <830b6fd522e9fc0e5c0008560dd9877c44d18d35.1741241800.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services.scm (cleanup-gexp): Make /var/run a symlink of /run. * doc/guix.texi (File Systems): Document it. * gnu/system/file-systems.scm (file-system-mapping->bind-mount): Replace /var/run in source path with /run. * gnu/services/dbus.scm (dbus-activation): Adjust accordingly. Change-Id: I7b94d3e2fe1bef66f435e84bc77f32311dddd0ce --- doc/guix.texi | 3 +++ gnu/services.scm | 5 +++-- gnu/services/dbus.scm | 31 ------------------------------- gnu/system/file-systems.scm | 7 ++++++- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 70e5db4156..3cec887591 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18231,6 +18231,9 @@ File Systems @defvar %runtime-variable-data This file system is mounted as @file{/run} and contains system information data describing the system since it was booted. + +Additionally, another directory with same role, @file{/var/run}, is +implemented as a symlink to @file{/run}. @end defvar @defvar %binary-format-file-system diff --git a/gnu/services.scm b/gnu/services.scm index ea855ad193..7805cae971 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -668,8 +668,9 @@ (define (cleanup-gexp _) ;; hence the 'chmod' calls. (mkdir "/tmp" #o1777) (chmod "/tmp" #o1777) - (mkdir "/var/run" #o755) - (chmod "/var/run" #o755)))))) + ;; /run is implemented as tmpfs mounted at early boot. + (mkdir-p "/var") + (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) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index b2766707a3..697fcf4f82 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -594,7 +594,12 @@ (define (file-system-mapping->bind-mount mapping) (($ source target writable?) (file-system (mount-point target) - (device source) + (device + ;; /var/run is implemented as a symlink to /run. + (if (and (string? source) + (string-prefix? "/var/run" source)) + (string-drop source 4) + source)) (type "none") (flags (if writable? '(bind-mount) From patchwork Thu Mar 6 06:22:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39721 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 978BF27BBEA; Thu, 6 Mar 2025 06:24:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2142227BBE2 for ; Thu, 6 Mar 2025 06:24:46 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tq4eO-0000iW-Dm; Thu, 06 Mar 2025 01:24:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tq4eL-0000Z9-J9 for guix-patches@gnu.org; Thu, 06 Mar 2025 01:24:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tq4eJ-0004J8-Vm; Thu, 06 Mar 2025 01:24:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=P3mvAwJunBrnjKMclNXpGdabxdtITDWXuNcI0K+g+OU=; b=q9/3w7RR+KMMd6mw1MAlbBRN24xUnbYYkObU0MJv5gn5MUv8x0LKpQtHd42GfNzpJWRc98qaxzNb9MVz42GLQBITNWNNGTJHkU9jRaBATjigBuWTxBkqUo2RfZ08id8U5GtBCjxaF4JtgV+ZLPS4SEDyR4rT9SF6GyUVVz9Y4y7vooAnCik54B7bbMyW8hC0mzX7SQPy1ZEFEbsSKKY0Nc2tFPyCKXm83DVsF8qi1eHInW/gOTODupprv2+EdGmCp6qClolXfBFDk+6tM/TgloZVx5Rm2DxhMRMyVahXo2HXyAHe9UhI1wZAD44ZphCXAB2Tu1GpK5FCVDJlIOoZ9A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tq4eJ-0002dQ-OV; Thu, 06 Mar 2025 01:24:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v3 3/3] services: activation: Continue on exceptions. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Mar 2025 06:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73494@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.174124221010044 (code B ref 73494); Thu, 06 Mar 2025 06:24:03 +0000 Received: (at 73494) by debbugs.gnu.org; 6 Mar 2025 06:23:30 +0000 Received: from localhost ([127.0.0.1]:41014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tq4dl-0002bt-PJ for submit@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:30 -0500 Received: from mx.boiledscript.com ([88.99.243.112]:37260) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tq4dj-0002be-Ek for 73494@debbugs.gnu.org; Thu, 06 Mar 2025 01:23:27 -0500 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1741242206; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P3mvAwJunBrnjKMclNXpGdabxdtITDWXuNcI0K+g+OU=; b=BThbFg9yZy7AcZzQA1sYsEl1g5zZo1xJ5sLa5UnK2jCPK8KTmvKchWbz6o7pklQhK99iAF NsMdV4dnZbMdsa6PTApWrs+9iUc8a3F+qwo7BBpqqmUaAi+pSMes47G/paIS4Nk27DT5W5 0I6y2BwDGzZJRzG6ij2CE3/rdZn77klOOQWrqfW/GkfQH7bYgu/SFzPDERD2194gpUtZZg vetrmjBwOdmWjOLENpOL4wIA8lORrqH0JNHlmFruk/9thYSLl/ohfQ8nTrdFUq+22uDCTW hW1mihqbytj//2+nvw5NkzqDICC6WfNirVQD8W5uqgUieTYy8jWg8cVVCuZ+SA== Date: Thu, 6 Mar 2025 14:22:44 +0800 Message-ID: <18ba6d18420c9ac93dcdab6b349e1050d6ca3a6a.1741241800.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-MS-Reactions: disallow X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Use ‘invoke’ for backtraces and avoid changing environment. * gnu/services.scm (activation-script): Execute activation scripts in ‘invoke’. Warn about failed activation scripts. Change-Id: I89be31433fbb46d0c4a9dc6115ab167910840b6f --- gnu/services.scm | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 7805cae971..3a511a42e5 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -690,15 +690,28 @@ (define* (activation-service->script service) (define (activation-script gexps) "Return the system's activation script, which evaluates GEXPS." (define actions - (map (cut program-file "activate-service.scm" <>) gexps)) + (map (lambda (action) + (program-file "activate-service.scm" + (with-imported-modules (source-module-closure + '((gnu build activation) + (guix build utils))) + #~(begin + (use-modules (gnu build activation) + (guix build utils)) + #$action)))) + gexps)) (program-file "activate.scm" (with-imported-modules (source-module-closure '((gnu build activation) - (guix build utils))) + (guix build utils) + (guix diagnostics) + (guix i18n))) #~(begin (use-modules (gnu build activation) - (guix build utils)) + (guix build utils) + (guix diagnostics) + (guix i18n)) (mkdir-p "/var/run") ;; Make sure the user accounting database exists. If it @@ -717,8 +730,17 @@ (define (activation-script gexps) (activate-current-system) ;; Run the services' activation snippets. - ;; TODO: Use 'load-compiled'. - (for-each primitive-load '#$actions))))) + (for-each (lambda (action) + ;; Don't block activation process when one + ;; action fails. + (catch #t + (lambda () + (invoke action)) + (lambda _ + (warning + (G_ "failed to activate '~a'.~%") + action)))) + '#$actions))))) (define (gexps->activation-gexp gexps) "Return a gexp that runs the activation script containing GEXPS."