From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cFExEvoHJWLBeQEAgWs5BA (envelope-from ) for ; Sun, 06 Mar 2022 20:14:02 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qKQDD/oHJWJMmAAAauVa8A (envelope-from ) for ; Sun, 06 Mar 2022 20:14:02 +0100 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 BB33244709 for ; Sun, 6 Mar 2022 20:14:01 +0100 (CET) Received: from localhost ([::1]:49592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nQwKO-0007hi-UX for larch@yhetil.org; Sun, 06 Mar 2022 14:14:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nQvvK-0002TW-Da for guix-devel@gnu.org; Sun, 06 Mar 2022 13:48:06 -0500 Received: from [2a00:1450:4864:20::130] (port=41967 helo=mail-lf1-x130.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nQvvI-0003Ab-IM for guix-devel@gnu.org; Sun, 06 Mar 2022 13:48:05 -0500 Received: by mail-lf1-x130.google.com with SMTP id n19so1667340lfh.8 for ; Sun, 06 Mar 2022 10:48:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=X1Ct1WsACf0FtDOy/F4U7A7BCcqgl5dS1HV6X6knqoQ=; b=cduAFTcaS/KNogA7szztXzz+hU49k1xlrbPMOUGzPT491MfdRzNo1n1IGykxys6vRo /JlfNVRyTJ9Cg1bguRzNTUHYug8Ii7f9Wxm/m7lqCjviY4kFtpsgcGD+4zyNB+ORo3q7 lrBjckq4/bnnBN2NRiYiJIsOCFlu1BCdR8KutjDSlaGtG1f/c8/tEt1I0k/CoaKzc7jL B19ffIgNcyLyX329SzNDchABMOA2how1nfjVkWtswYCX4oiNASaRdoCe8ksu17NLUSbk shlFcv1O4bBNYHFWDDH3K9c0TwsBquJyEvVXb15STb0Nfpj3y+aP2cwfDus4kWc0vKLB X4eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=X1Ct1WsACf0FtDOy/F4U7A7BCcqgl5dS1HV6X6knqoQ=; b=L8Kf5p2lmHyFu0vOIWPX7NGg0sXXP5AzX3zDOAK0ed947Jeio59reTSp80hPMwM3nS eJshVqHY4RPZYcG+2z3EJuUhb4ZNSbZkRnKob9lmj4hbs9Nj+MYJrWYCyBVPD/J9tCJw qpEJybq98If5I4MJh2giDM7R1DVFc6942D7aXc9xPiv5LWBvwYaTXsb/kZZL+BDm+/D4 eck7pLdqOeKuy3HV3JNrG17im9FKYuc2lRXy/ViZpZT3b/zSP+FRRqPWDXFP9JcteOhk D4QTf7RRDg3c7hQyogF1yI8dwRNL6tRV1BIziuXSIPhOnsOx7yZfpTybq2evQ6aCi4ie CLIg== X-Gm-Message-State: AOAM532iCj8qFDOTGHAGyjG4OeWhqk48CVtLQ1MF1wMMh8+Ymee+ERt/ 4Ql8OPAA0CcoYk294plO4Sym0D/NZTkf6BaRir8QbH5zll4= X-Google-Smtp-Source: ABdhPJwdZLMa1bd6GEZ2JKutKS4+Vv8WOohE/f1pTWeKfh1trGUZUsqhvfYw49eI8cjpCXpIlKIZTKxfq0TF0pa+6Lo= X-Received: by 2002:a05:6512:22c4:b0:43a:13a8:7e55 with SMTP id g4-20020a05651222c400b0043a13a87e55mr5563603lfu.296.1646592479750; Sun, 06 Mar 2022 10:47:59 -0800 (PST) MIME-Version: 1.0 From: Kevin Boulain Date: Sun, 6 Mar 2022 19:47:23 +0100 Message-ID: Subject: Should Guix Home daemonize Shepherd? To: guix-devel@gnu.org Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::130 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=kevinboulain@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 06 Mar 2022 14:13:46 -0500 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1646594041; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=X1Ct1WsACf0FtDOy/F4U7A7BCcqgl5dS1HV6X6knqoQ=; b=qGfb2M910hNH+j/4nhiVua2z07VmrMk0E6TZHt5UIbL/JEUGFGN4LV/lSmkcjQqaEktlW/ 76YhDIyuTrH/sS7UZY5uq5krgrGH/PR2otVjubMcgwiW+iKWg0dyM3UPQ4X26A5ZFS+JZL w1gRHnYtL8GTVsKMxPZjUqjKQHY8L14aRyxjo4ZWlToCNfiYWDdUo/Yq4QT2tVlb+ZZl2f rGCg5TV+yGeMvxWxx3pVM1yA0Sa3qCvVvUFgsAhLlLLw8XOCgQfd/JYYPjzhc3QY+ZkDBl tI9iSmX9s+5LFvirTOsmLb83Q9eHVKkvlzspzyKlet8ID6kMANLu2PxhGLysOA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646594041; a=rsa-sha256; cv=none; b=qtxHhX+gCnp+I4TZyb7PDi183E/xdwVUEObg7UOYFpUGKoZKN0/SLJaXe4ctRzMfUU0GQH 3GzzxDAhmYXeSfxxCGsyurSWm+fuGd9y6W4sVpLq4LPsltdzmX5KvmuqHKU0zLQYWKjdPF I+hP75o01HIhBmAt1aKGADNBKMxm/LyH+vk9fxKuZoT48S38O1rAffchTiZAkZFy31plnw kFtJQh8xjUhZgh0TqOfQ6x20jfqEh6eNHF2+5UZjc4w1/yxWiwGDeCoUt0PFhnujuSGdMv aSDWx9ro6j2CZo30m8vReBskTOZOe+jL1lW2LTK78DhubTx52Epo2NC0PxgNaw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cduAFTca; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.23 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cduAFTca; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BB33244709 X-Spam-Score: -3.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: qQVWLNSfNKLF Hello, I did a quick search in the tracker and the mailing list archives but couldn't find a similar topic, apologies if this was already discussed. I was playing with Guix Home and I'm a bit surprised by how user services are managed, especially the Shepherd itself. Let's say I start from a clean state (I ran 'guix home reconfigure' and rebooted the Guix machine) and I login via SSH: $ ssh host [...] Service root has been started. WARNING: Use of `load' in declarative module (#{ g56}#). Add #:declarative? #f to your define-module invocation. Starting services... Service example has been started. $ exit On the first login, the user's Shepherd is started and my 'example' service is run. So far so good. Now I login again: $ ssh host [...] Starting services... Service example has been started. $ exit The service is restarted again, meaning Shepherd and all the services were killed when I logged out the first time. Is that expected? Now, it's even weirder if I open two connections or more: 1$ ssh host [...] Starting services... Service example has been started. 1$ # Don't exit this shell just yet. 2$ ssh host 2$ # Notice how the services weren't started again, I believe $XDG_RUNTIME_DIR/on-first-login-executed is working as expected. 1$ exit # Now I logout from my first session. 2$ ps waux | grep $service # Nothing! The service has been killed because I logged out from the first session. Now, as long as the second session is kept open, the services won't be restarted automatically, even if I open a third session. I need to close all existing sessions and login again for the services to be started. Finally, I'm not sure Shepherd should share the terminal, it leads to unfortunate situations like this (in addition to writing messages to stdout like "Respawning $service", garbling any other process' output): $ ssh host [...] Starting services... Service example has been started. $ ^C # A single ^C will kill Shepherd, so I assume it wasn't properly put in the background. Exiting shepherd... Service example has been stopped. $ # I lost all my services :( So, should the Shephered be daemonized when $XDG_RUNTIME_DIR/on-first-login-executed is set? I believe it would be a lot less surprising to users, unless the goal was to prevent any lingering session in the first place. --- For the record, I'm reproducing the above examples with this configuration: ;; guix home --dry-run reconfigure example.scm (define-module (example) #:use-module (guix gexp) #:use-module (gnu home) #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu services) #:use-module (gnu packages base)) (define (example-shepherd-service _) (list (shepherd-service (documentation "Example service.") (provision '(example)) (start #~(make-forkexec-constructor (list #$(file-append coreutils "/bin/sleep") "60") #:log-file (string-append (getenv "XDG_LOG_HOME") "/example.log"))) (stop #~(make-kill-destructor))))) (define example-service-type (service-type (name 'example) (extensions (list (service-extension home-shepherd-service-type example-shepherd-service))) (default-value #nil) (description "Example service"))) (home-environment (services (list (service example-service-type))))