From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Kv8LAVrFVWKrHQAAgWs5BA (envelope-from ) for ; Tue, 12 Apr 2022 20:30:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EKJpNFnFVWJC3gAAG6o9tA (envelope-from ) for ; Tue, 12 Apr 2022 20:30:49 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4BAC82F60F for ; Tue, 12 Apr 2022 20:30:49 +0200 (CEST) Received: from localhost ([::1]:49084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1neLHq-0003o2-D9 for larch@yhetil.org; Tue, 12 Apr 2022 14:30:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1neLGA-0002vH-DB for bug-guix@gnu.org; Tue, 12 Apr 2022 14:29:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1neLGA-00018N-3L for bug-guix@gnu.org; Tue, 12 Apr 2022 14:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1neLGA-0006MZ-0e for bug-guix@gnu.org; Tue, 12 Apr 2022 14:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54545: [Guix Home] =?UTF-8?Q?=E2=80=98shepherd=E2=80=99?= started twice? Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 12 Apr 2022 18:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54545 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Andrew Tropin Received: via spool by 54545-submit@debbugs.gnu.org id=B54545.164978809324370 (code B ref 54545); Tue, 12 Apr 2022 18:29:01 +0000 Received: (at 54545) by debbugs.gnu.org; 12 Apr 2022 18:28:13 +0000 Received: from localhost ([127.0.0.1]:49766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1neLFM-0006Kz-Go for submit@debbugs.gnu.org; Tue, 12 Apr 2022 14:28:12 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1neLFK-0006Km-Pk for 54545@debbugs.gnu.org; Tue, 12 Apr 2022 14:28:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1neLFF-000101-5m; Tue, 12 Apr 2022 14:28:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=jxxUC3Ic9kZ1OwNMaj/fjOJJEqosClsBFN60phXUhZ0=; b=fMkz3y7vF9XQXcHHGp+v fophxCQNO80mgJ4VYj1MgOJlRQM+xGGwhFqgi0wJUHO5dUAQcMlT+xUseGACgs+Q5b2YOfBJEbXbS jwT/wSFwtMCk2Y9iEm6G/SLtSaOJZvWGlgxX8YLzSxbfaFwVENn9PhsiozoRVAXAuB9YRrp6v3fJJ gfqyMkk8aMcN7Xzc9ZHMb2jnllbGpqbD2cats68BONFLL82y3074YDcAENvdbrcNeuoOt5wvNVF+H PxMvdMFd4eoqpNbFOEbvUlc07UUdeIJ3+mnJeJSoQSRu0vslCHxHVUr9EpRbqPD7R2TI3CN7kKe0l tk9wY6tykTpcZA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:60544 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1neLFD-0000Rs-Uu; Tue, 12 Apr 2022 14:28:04 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87a6dfbfdl.fsf@inria.fr> <87sfqt2vwd.fsf@trop.in> <871qyctxhk.fsf@gnu.org> <871qy2irc4.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 23 Germinal an 230 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 12 Apr 2022 20:28:01 +0200 In-Reply-To: <871qy2irc4.fsf@trop.in> (Andrew Tropin's message of "Tue, 12 Apr 2022 12:27:55 +0300") Message-ID: <87czhmcg26.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 54545@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649788249; h=from:from:sender:sender: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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jxxUC3Ic9kZ1OwNMaj/fjOJJEqosClsBFN60phXUhZ0=; b=IfVyNGjtCw3lwJ8ZBb1Rp/59Bi8RJmLNC3bSSfQ60SdyQBQ3k+wIeu3n9Nykzq1S1UAdMM k2TA/C1gB5D5pTWdk98wWcqyIvyDfQiGLxwlOGhh6L377QuT8gWArnUjfGdILtr2Pq2qMb A6C9kqsZszzopz/jDojOO/ZIk7PW/KpgVitCVbqbTwQWn1XA9zbDtjw9Td+lkGy44YiZsJ wvPBiKsSFo6SFvkUYQxzNCEdsSXgOiqyLTvuRFJXFRV4OgfXixs1dpyEN0Reop00JxuxVL E+S8zFcLn0b2k2+8N8Hy2bsl6yWjvFsuhY6D+fvvlNw5aX/DeDYvMS9/iRE/Fg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649788249; a=rsa-sha256; cv=none; b=QrKwJ0HKzIZTXTvr0X1k4Sdk6F/z9lZYDvJX6HeXtoZxwIfUMeMnQvfyVBSgjK+kcAWbpd SxSJfWxAOh7JOWfr0oZaa7fqSuFaz+8gLnXW5GbXxuhvDj9p9UAnX2TapKNwj35KjqZ13O WVV5lo2LX5l6sei0ecPBVu0Hf2Mfvk7NtX5+tKYUzZxRklOyy+EZh+SvEVq/IdU1icITZD mCyBihkODZ8rgPVzbuX/Rbqc+xn/KN3NTSpQkWNHZ3IHLG+7EhJ7zhKD1sPlvDFghrXV4z rCdjp/TKDgds0C43P1GO3eSSWUvoED8u0Fq8J66VjKxiFeI56NHc599evD5thg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=fMkz3y7v; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.06 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=fMkz3y7v; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4BAC82F60F X-Spam-Score: -4.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: lq3wzcVYM/RL Hi, Andrew Tropin skribis: > Prepared a patch series, which fixes the issues and sligthly adjusts the > way home shepherd reload configuration logic works, now it happens only > if configuration is changed and also it doesn't try to be smart and > start a shepherd if it's not started yet. > > From d2578f8924217451ca20f0b61fd6f9b9d31c930d Mon Sep 17 00:00:00 2001 > From: Andrew Tropin > Date: Tue, 12 Apr 2022 11:30:58 +0300 > Subject: [PATCH 1/3] home: shepherd: Prevent launching the second instanc= e. > > * gnu/home/services/shepherd.scm: Prevent launching the second instance. I applied this one with a convention commit log, including a =E2=80=9CFixes= =E2=80=9D line, which is important for traceability. (Please check the ChangeLog convention for future patches.) > From 56d16b4cd511f6837329b888dade0c6d6da4d89d Mon Sep 17 00:00:00 2001 > From: Andrew Tropin > Date: Tue, 12 Apr 2022 12:19:50 +0300 > Subject: [PATCH 2/3] home: shepherd: Use run-on-change to reload shepherd > config. > > * gnu/home/services/shepherd.scm: Add shepherd configuration to > XDG_CONFIG_HOME and use it instead of full path to the store. It's necess= ary > to use run-on-change service. [...] > +++ b/gnu/home/services/shepherd.scm > @@ -105,27 +105,30 @@ (define (launch-shepherd-gexp config) > (system* > #$(file-append shepherd "/bin/shepherd") > "--logfile" > - (string-append log-dir "/shepherd.log") > - "--config" > - #$(home-shepherd-configuration-file services shepherd))= ))) > + (string-append log-dir "/shepherd.log"))))) > #~""))) >=20=20 > (define (reload-configuration-gexp config) > (let* ((shepherd (home-shepherd-configuration-shepherd config)) > (services (home-shepherd-configuration-services config))) > - #~(system* > - #$(file-append shepherd "/bin/herd") > - "load" "root" > - #$(home-shepherd-configuration-file services shepherd)))) > + #~(when (file-exists? > + (string-append > + (or (getenv "XDG_RUNTIME_DIR") > + (format #f "/run/user/~a" (getuid))) > + "/shepherd/socket")) > + (system* > + #$(file-append shepherd "/bin/herd") > + "load" "root" > + #$(home-shepherd-configuration-file services shepherd))))) >=20=20 > -(define (ensure-shepherd-gexp config) > - #~(if (file-exists? > - (string-append > - (or (getenv "XDG_RUNTIME_DIR") > - (format #f "/run/user/~a" (getuid))) > - "/shepherd/socket")) > - #$(reload-configuration-gexp config) > - #$(launch-shepherd-gexp config))) > +(define (add-shepherd-configuration config) > + (let* ((shepherd (home-shepherd-configuration-shepherd config)) > + (services (home-shepherd-configuration-services config))) > + `(("shepherd/init.scm" > + ,(home-shepherd-configuration-file services shepherd))))) > + > +(define (home-shepherd-run-on-change config) > + `(("files/.config/shepherd/init.scm" ,(reload-configuration-gexp confi= g)))) How does this relate to the bug at hand? https://issues.guix.gnu.org/54545 As discussed elsewhere, I find it less ambiguous to pass store file names for configuration files. That can be a drawback in some cases, for daemons that won=E2=80=99t be abl= e to load a new config from a different location, but shepherd is not in that category: it can load a config file via =E2=80=98herd load root=E2=80=99 fr= om any place. Last, it would be nice if we could use the (guix scripts system reconfigure) machinery like =E2=80=98guix system reconfigure=E2=80=99 and = =E2=80=98guix deploy=E2=80=99 to upgrade services. An idea for future work. :-) > From e80e9fae6f6bcd478fa904aad8eb426da3f42f10 Mon Sep 17 00:00:00 2001 > From: Andrew Tropin > Date: Tue, 12 Apr 2022 12:23:26 +0300 > Subject: [PATCH 3/3] home: run-on-first-login: Add a startup message to t= he > script. > > gnu/home/services.scm: Add a startup message to the script to make it cle= ar > when it begins. > --- > gnu/home/services.scm | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gnu/home/services.scm b/gnu/home/services.scm > index 49bd6e3555..e2c51910a8 100644 > --- a/gnu/home/services.scm > +++ b/gnu/home/services.scm > @@ -344,6 +344,7 @@ (define (compute-on-first-login-script _ gexps) > #~(begin > (use-modules (guix i18n)) > #$%initialize-gettext > + (display (G_ "Starting run-on-first-login script.\n\n")) I=E2=80=99m not fond of unconditional low-level logging. In Guix there=E2= =80=99s relatively little logging and whatever logging there is is controlled by =E2=80=98-v=E2=80=99; I think we should follow that approach as much as pos= sible. Thank you! Ludo=E2=80=99.