From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SFBlOam/vmE0RAAAgWs5BA (envelope-from ) for ; Sun, 19 Dec 2021 06:14:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id uK0eNam/vmHDZgAA1q6Kng (envelope-from ) for ; Sun, 19 Dec 2021 05:14:17 +0000 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 9483031064 for ; Sun, 19 Dec 2021 06:14:17 +0100 (CET) Received: from localhost ([::1]:47992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myoWW-0005A1-96 for larch@yhetil.org; Sun, 19 Dec 2021 00:14:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myoWJ-00059d-A4 for bug-guix@gnu.org; Sun, 19 Dec 2021 00:14:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1myoWJ-0007QM-0u for bug-guix@gnu.org; Sun, 19 Dec 2021 00:14:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1myoWI-0002en-LK for bug-guix@gnu.org; Sun, 19 Dec 2021 00:14:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#52654: shepherd lacks error reporting Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 19 Dec 2021 05:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52654 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 52654@debbugs.gnu.org X-Debbugs-Original-To: Guix Bugs Received: via spool by submit@debbugs.gnu.org id=B.163989082510180 (code B ref -1); Sun, 19 Dec 2021 05:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Dec 2021 05:13:45 +0000 Received: from localhost ([127.0.0.1]:44711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myoW1-0002e7-5g for submit@debbugs.gnu.org; Sun, 19 Dec 2021 00:13:45 -0500 Received: from lists.gnu.org ([209.51.188.17]:49650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myoVz-0002dz-IY for submit@debbugs.gnu.org; Sun, 19 Dec 2021 00:13:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myoVy-00059L-Sx for bug-guix@gnu.org; Sun, 19 Dec 2021 00:13:43 -0500 Received: from mx1.riseup.net ([198.252.153.129]:53494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myoVw-0007PS-It for bug-guix@gnu.org; Sun, 19 Dec 2021 00:13:42 -0500 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4JGrTs0S4QzDySr for ; Sat, 18 Dec 2021 21:13:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1639890817; bh=SWerfvOdfzhiq6bdCuVO/WlmQh/0MeCnuh9u8l1sy40=; h=Date:From:To:Subject:From; b=V7eeCTlBpDyBp42LqjyFfy2gTy6JMJ8dNtAatjnRJGKfH+jOdRB3JWwnUEbbMA/+f m1oY60NPcG7+YnnXDsLSoFMkLvRYyb0Q/NEqYcCg4z83eve6X6XoiqJNRAZB32OcHc rpcfkNyQzplHrgUmQcKDOT6Kbup2Dt/1H5QdkQY8= X-Riseup-User-ID: B3354CF9BE3F50FDF3BC033179EBAA2655D433A5A5F5A9CD04BB1A9747F2AA64 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4JGrTr2X39z5vkT for ; Sat, 18 Dec 2021 21:13:36 -0800 (PST) Date: Sun, 19 Dec 2021 06:13:20 +0100 From: raingloom Message-ID: <20211219061320.7ef3bb8c@riseup.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_//hLSyACD9UjpTbu5+gMnxFf" Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" 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=1639890857; 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:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=gvQ6epwDo+CWEuScD5avBuMW++0zoohe3iVGet3HVU4=; b=k71/q9XB6LqiCtmXkfEpwJBIC4BzvLD6D/p8Lw8+vySkeAJoE46whgqVRqEdE4+IlgRf9F tBk8wh+XKj7jXaxEB78La19LVUinydOFrJ4yGHc4B35MnNNmtyUd0RSS5ClC/a2CxBY2bn WibHBIEYHYWdTe0/Tm6SA5mqklwj2EazPECzrbLoMfL4pwWjG+PebA+powY8ootMLGK5Mt nOfoSnj9KVxVZL7MamLqp64zVBAyn6/TS5srGrmER4tF/4uENgvrFcu3bLP7ESD8zsQElg oz5e7tEl7B/94utAUrODBXyhIpW/vm5tavbeGpy/TX5/DnVH5Dh21AUEbZmn5w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1639890857; a=rsa-sha256; cv=none; b=GjeAmr53CJu7f/BBdaItHPp5aLLhUGfQ3zk7bLnaycQdDTtbexTsN+JE3TYdBEA/9zdwyr /j7exmdjD7CFDN3GfALCRRlgoyeDZI5/KZ04ELEaq+WHkTNVLtK0u5O6KksRVUup6bw8SP PfnhxVlH/qcXUXn1sitw5Sv+xgJLjebhLUtFXBAgH88TRpiyn6MBRuq26Cl87Nc9ymMYz+ /yFQGBaZQDvYbg2PogXNpHvXXP0ljKrB07R+tfLRL0dJuf4k0MK5X/01PaAwD2bnw0ZB7U D2YbP7UBOFdWV7Vp7oYa/LwzRejMo1Gh36AOxFGmA+tEuAPzg+SrEy+lNBJUkw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=V7eeCTlB; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); 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: -2.71 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=riseup.net header.s=squak header.b=V7eeCTlB; dmarc=fail reason="SPF not aligned (relaxed)" header.from=riseup.net (policy=none); 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: 9483031064 X-Spam-Score: -2.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6krNsx66tM3d --MP_//hLSyACD9UjpTbu5+gMnxFf Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm writing a single-shot shepherd-service that expands the (ext4) root file system on first boot, using the hostname service as a template, just passing the script as a G-expression, instead of using the forkexec constructor. Of course there is a bug in it. Trouble is, I have no idea what it is, because Shepherd won't tell me. :) The VM boots and completes the ssh initialization phase and then apparently just gets stuck. Doesn't even show a login prompt. It's... not a great debugging experience. I'm going to attempt to at the very least add some error reporting. It would also be really nice if the failure modes for Shepherd services were better documented, like what happens when the procedure passed in the `start` field fails, or is not even a procedure, etc. Since I never touched Shepherd internals, help would be greatly appreciated. ps.: I'm attaching the system definition for completeness's sake and so that someone might point out where the error is, but honestly the exact bug in my code does not matter for the feature. All that matters is there is an error and it should be logged but isn't. --MP_//hLSyACD9UjpTbu5+gMnxFf Content-Type: text/x-scheme Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=cloud-deploy-bootstrap.scm (define-module (raingloom machines cloud-deploy-bootstrap)) (use-modules (gnu) (gnu system nss) (guix channels) (guix modules)) (use-service-modules admin networking shepherd ssh) (use-package-modules admin bootloaders certs gnome linux networking ssh tmux tls version-control) (define disk "/dev/vda") (define partition "2") (define ext-autoexpand-service-type (let ((name 'ext-autoexpand) (desc "Automatically expand ext2 root") (modules '((ice-9 popen)))) (shepherd-service-type name (lambda (config) (shepherd-service (documentation desc) (provision (list name)) (requirement '(file-systems)) (one-shot? #t) (start (with-imported-modules (source-module-closure modules) #~(begin (use-modules #$@modules) (let ((port (open-pipe* OPEN_WRITE #$(file-append util-linux "/sbin/sfdisk") ;; don't check if the block is in use ;; it is, and we don't care. "--no-reread" disk "-N" partition))) (display ",+" port) (close-port port)) (system* $#(file-append util-linux "/sbin/partx") "--update" disk) (system* #$(file-append e2fsprogs "/sbin/resize2fs") (string-append disk partition))))))) (description desc)))) (define-public %system (operating-system (host-name "cloud-deploy-bootstrap") (timezone "Europe/Budapest") (locale "en_US.utf8") (keyboard-layout (keyboard-layout "us")) (bootloader (bootloader-configuration (bootloader grub-bootloader) (targets '("/dev/vda")) (keyboard-layout keyboard-layout))) (file-systems (append (list (file-system (device (file-system-label "cloudimg-rootfs")) (mount-point "/") (type "btrfs"))) %base-file-systems)) ;; This is where we specify system-wide packages. (packages (append (list nss-certs tmux) %base-packages)) (services (append (list (service ext-autoexpand-service-type #f) (service dhcp-client-service-type) (service openssh-service-type (openssh-configuration (openssh openssh-sans-x) (permit-root-login #t) (authorized-keys `(("root" ,(local-file (string-append (getenv "HOME") "/.ssh/id_ed25519.pub")))))))) %base-services)) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss))) %system --MP_//hLSyACD9UjpTbu5+gMnxFf--