Received: (at 52654) by debbugs.gnu.org; 29 Apr 2023 15:22:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 29 11:22:37 2023
Received: from localhost ([127.0.0.1]:36391 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1psmPF-0002W7-41
for submit <at> debbugs.gnu.org; Sat, 29 Apr 2023 11:22:37 -0400
Received: from mail-qt1-f169.google.com ([209.85.160.169]:46296)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <maxim.cournoyer@HIDDEN>) id 1psmPD-0002Vq-G9
for 52654 <at> debbugs.gnu.org; Sat, 29 Apr 2023 11:22:35 -0400
Received: by mail-qt1-f169.google.com with SMTP id
d75a77b69052e-3ee339e8c2fso4708191cf.0
for <52654 <at> debbugs.gnu.org>; Sat, 29 Apr 2023 08:22:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1682781749; x=1685373749;
h=mime-version:user-agent:message-id:in-reply-to:date:references
:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=AgtEM6karZD0nvM7EfD5Xx+i8+lXwQNIZ4J5L/RIt9w=;
b=Z7Nag6uYt6Ka4OUUZ2Vx5AxkD09ndkxTmJy5qtQmPKIcIA9u8t6Ya4pNXyX+W4Wl8h
Ky2AcvRJ/MTdbJuOBCIHbLN+eJF/Lgub8pjb7j0P+E1G2SRuRbrLtogAk7jEIGKrkyxR
pxjdJyErcWbDIh1dccEOhQzHBf6OoPJZhAYFytnCr9zgTAmX6BeHajmfvQmGPBEAwH4n
ad3P5GMAcH5PFJhP55ChJCsp6ZXhHTTYz+cUUcIkS/tUV9SVjdVVIf6cy7Zg2aeKyCQR
WCynocp2hjaLt9pMFdUidppKKFytVaFf+mJqkEuQZklFF5zpJj3+mhS/0pJqeH3C2hXU
1+wQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1682781749; x=1685373749;
h=mime-version:user-agent:message-id:in-reply-to:date:references
:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=AgtEM6karZD0nvM7EfD5Xx+i8+lXwQNIZ4J5L/RIt9w=;
b=Co5fp7L4nQ/9fcDYpQtbsJm0i/R1VA9a6dMiBiWtVxE2A8nLbxolEY6BqpKnELTp4W
nttOSmSW7AMqSl33ZaWHYGzS53VpuAjSsIY8Twpw/omM7Ba/x3XEWKD4ANRcu5nUygsY
1VhVZ9tlbVnL4+iGADlae10SYjICU54M0ykkAK75m3yHf+q344HJ7FgIOv3nFl20QqY/
XRvNB0i+1TDc1vtvzk737VtMfS2y9eD4NjkYSyzbeLoWqQtkDVUxgZrQOMlPUYwah9Qy
cWmw5lsbLcaX+v/c6eG6nnb6U70JHLCrFzQM4oRu3xofWkH8dHBP2lYhW1dy70imCQT9
L4xw==
X-Gm-Message-State: AC+VfDz1z4kny4vWBF6Rs6nsLhbJpzBPWc9N8e5SQDfaVogkk6SwMphv
hfTqp9NSs3oM8jdpKOAe24DOz5WsaxM=
X-Google-Smtp-Source: ACHHUZ7SyxMPxvrdNpSM6YgsPlhDSV/GE4C4UWVNKAoiWmkf38gH05ozbYltZ7G0UtrqMJHFM9UK9w==
X-Received: by 2002:a05:622a:148e:b0:3ef:415f:191 with SMTP id
t14-20020a05622a148e00b003ef415f0191mr14990493qtx.21.1682781749412;
Sat, 29 Apr 2023 08:22:29 -0700 (PDT)
Received: from hurd (dsl-155-245.b2b2c.ca. [66.158.155.245])
by smtp.gmail.com with ESMTPSA id
z20-20020ac87f94000000b003b635a5d56csm7930893qtj.30.2023.04.29.08.22.28
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 29 Apr 2023 08:22:28 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: raingloom <raingloom@HIDDEN>
Subject: Re: bug#52654: shepherd lacks error reporting
References: <20211219061320.7ef3bb8c@HIDDEN>
<20211219070207.1195510c@HIDDEN>
Date: Sat, 29 Apr 2023 11:22:27 -0400
In-Reply-To: <20211219070207.1195510c@HIDDEN> (raingloom@HIDDEN's
message of "Sun, 19 Dec 2021 07:02:07 +0100")
Message-ID: <87h6syaf2k.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 52654
Cc: 52654 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Hi,
I also encountered that issue, it's really puzzling.
Here's the problematic start slot that got my mpd test to hang the boot,
with the last message being "Please wait while gathering entropy to
generate the key pair;":
--8<---------------cut here---------------start------------->8---
(start
(with-imported-modules (source-module-closure
'((gnu build activation)))
#~(begin
(use-modules (gnu build activation))
(let ((user (getpw #$username)))
(define (init-directory directory)
(unless (file-exists? directory)
(mkdir-p/perms directory user #o755)))
(for-each
init-directory
(cons '#$(map dirname
;; XXX: Delete the potential "syslog"
;; log-file value, which is not a directory.
(delete "syslog"
(filter-map maybe-value
(list db-file
log-file
state-file
sticker-file)))))))
(make-forkexec-constructor
(list #$(file-append package "/bin/mpd") "--no-daemon"
#$config-file)
#:environment-variables '#$environment-variables))))
--8<---------------cut here---------------end--------------->8---
The error was the lonely cons. Taking it out, the test then passed:
--8<---------------cut here---------------start------------->8---
(start
(with-imported-modules (source-module-closure
'((gnu build activation)))
#~(begin
(use-modules (gnu build activation))
(let ((user (getpw #$username)))
(define (init-directory directory)
(unless (file-exists? directory)
(mkdir-p/perms directory user #o755)))
(for-each
init-directory
'#$(map dirname
;; XXX: Delete the potential "syslog"
;; log-file value, which is not a directory.
(delete "syslog"
(filter-map maybe-value
(list db-file
log-file
state-file
sticker-file))))))
(make-forkexec-constructor
(list #$(file-append package "/bin/mpd") "--no-daemon"
#$config-file)
#:environment-variables '#$environment-variables))))
--8<---------------cut here---------------end--------------->8---
Shepherd should report the error, fail that one service and attempt to
keep booting (if the service is not required by other critical ones).
--
Thanks,
Maxim
bug-guix@HIDDEN:bug#52654; Package guix.
Full text available.Maxim Cournoyer <maxim.cournoyer@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Maxim Cournoyer <maxim.cournoyer@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Received: (at 52654) by debbugs.gnu.org; 19 Dec 2021 06:02:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 01:02:19 2021 Received: from localhost ([127.0.0.1]:44722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mypH1-0003vp-A1 for submit <at> debbugs.gnu.org; Sun, 19 Dec 2021 01:02:19 -0500 Received: from mx1.riseup.net ([198.252.153.129]:48388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raingloom@HIDDEN>) id 1mypGy-0003vZ-LG for 52654 <at> debbugs.gnu.org; Sun, 19 Dec 2021 01:02:17 -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 4JGsYt3TyWzDs9P for <52654 <at> debbugs.gnu.org>; Sat, 18 Dec 2021 22:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1639893730; bh=j+fJTLugV7hWnLzDSg+ZynSs26H4z/ZwRfeWkfm0KVs=; h=Date:From:To:Subject:In-Reply-To:References:From; b=iGI+g4sNKdMRhyWZM2SuNj/sEfHFwLPsMsqg3wRE9bU/JduXq69FkDVXozQCkVVPa raBqRD1xeYaucHnEy5TcHs5i55O3kif1QE9qsNtwTjR/NHS4YaZMaXPBDlN6pT7Fmv 6eUYoAkQOgdSp0hW0cruueYVtt8fIP44Ew+Tpcxo= X-Riseup-User-ID: 33AAA7E6E1A49EFB20233E0CD7E1473D8AADBB1304FC5FAED7E73018A95F01D6 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4JGsYs5jV1z5vbN for <52654 <at> debbugs.gnu.org>; Sat, 18 Dec 2021 22:02:09 -0800 (PST) Date: Sun, 19 Dec 2021 07:02:07 +0100 From: raingloom <raingloom@HIDDEN> To: 52654 <at> debbugs.gnu.org Subject: Re: bug#52654: shepherd lacks error reporting Message-ID: <20211219070207.1195510c@HIDDEN> In-Reply-To: <20211219061320.7ef3bb8c@HIDDEN> References: <20211219061320.7ef3bb8c@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 52654 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) On Sun, 19 Dec 2021 06:13:20 +0100 raingloom <raingloom@HIDDEN> wrote: > 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. So the error in my config turned out to be the G-expression not evaluating to a lambda, but the issue with Shepherd still stands.
bug-guix@HIDDEN:bug#52654; Package guix.
Full text available.
Received: (at submit) by debbugs.gnu.org; 19 Dec 2021 05:13:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 00:13:45 2021
Received: from localhost ([127.0.0.1]:44711 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1myoW1-0002e7-5g
for submit <at> 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 <raingloom@HIDDEN>) id 1myoVz-0002dz-IY
for submit <at> 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 <raingloom@HIDDEN>)
id 1myoVy-00059L-Sx
for bug-guix@HIDDEN; 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 <raingloom@HIDDEN>)
id 1myoVw-0007PS-It
for bug-guix@HIDDEN; 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 <bug-guix@HIDDEN>; 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 <bug-guix@HIDDEN>; Sat, 18 Dec 2021 21:13:36 -0800 (PST)
Date: Sun, 19 Dec 2021 06:13:20 +0100
From: raingloom <raingloom@HIDDEN>
To: Guix Bugs <bug-guix@HIDDEN>
Subject: shepherd lacks error reporting
Message-ID: <20211219061320.7ef3bb8c@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MP_//hLSyACD9UjpTbu5+gMnxFf"
Received-SPF: pass client-ip=198.252.153.129;
envelope-from=raingloom@HIDDEN; 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-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)
--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--
raingloom <raingloom@HIDDEN>:bug-guix@HIDDEN.
Full text available.bug-guix@HIDDEN:bug#52654; Package guix.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.