From mboxrd@z Thu Jan  1 00:00:00 1970
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Subject: bug#39925: `guix pull` failure in multi-machine setup
Date: Thu, 05 Mar 2020 18:20:58 +0100
Message-ID: <87ftem7m6d.fsf@gnu.org>
References: <20200305133318.GB2909@zpidnp36>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Return-path: <bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org>
Received: from eggs.gnu.org ([2001:470:142:3::10]:40411)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1j9uCB-0004ci-HZ
 for bug-guix@gnu.org; Thu, 05 Mar 2020 12:22:04 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1j9uCA-0004LE-BY
 for bug-guix@gnu.org; Thu, 05 Mar 2020 12:22:03 -0500
Received: from debbugs.gnu.org ([209.51.188.43]:37696)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1j9uCA-0004L1-7j
 for bug-guix@gnu.org; Thu, 05 Mar 2020 12:22:02 -0500
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1j9uCA-0000yB-4y
 for bug-guix@gnu.org; Thu, 05 Mar 2020 12:22:02 -0500
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-Message-ID: <handler.39925.B39925.15834288763673@debbugs.gnu.org>
In-Reply-To: <20200305133318.GB2909@zpidnp36> (Lars-Dominik Braun's message of
 "Thu, 5 Mar 2020 14:33:18 +0100")
List-Id: Bug reports for GNU Guix <bug-guix.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-guix>,
 <mailto:bug-guix-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-guix>
List-Post: <mailto:bug-guix@gnu.org>
List-Help: <mailto:bug-guix-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-guix>,
 <mailto:bug-guix-request@gnu.org?subject=subscribe>
Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org
Sender: "bug-Guix" <bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org>
To: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Cc: 39925@debbugs.gnu.org

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis:

> I=E2=80=99m using guix on a multi-machine setup with a single remote guix=
-daemon that
> can be reached via SSH. Thus GUIX_DAEMON_SOCKET=3Dssh://master.<domain> o=
n the
> compute nodes. Running `guix pull` on master works fine (the variable is =
not
> set here), but it does not on a compute node. Instead it fails with this =
error:
>
> ---snip---
> Backtrace:
>            1 (primitive-load "/gnu/store/n5wgvz287dwm62474mr42x34wl5j5wh7=
-compute-guix-derivation")
> In ice-9/eval.scm:
>    293:34  0 (_ #(#(#(#(#(#(#(#(#(#(#(#(#<directory (guile-user) 7f19dd21=
3140> (?)) #) # ?) ?) ?) ?) ?) ?) ?) ?) ?) ?))
>
> ice-9/eval.scm:293:34: Throw to key `srfi-34' with args `(#<condition &st=
ore-connection-error [file: "/var/guix/daemon-socket/socket" errno: 111] 7f=
19dba3a090>)'.
> guix pull: error: You found a bug: the program '/gnu/store/n5wgvz287dwm62=
474mr42x34wl5j5wh7-compute-guix-derivation'
> failed to compute the derivation for Guix (version: "aac148a87b9a79b9992b=
8b1a9d76c217175d4a88"; system: "x86_64-linux";
> host version: "aac148a87b9a79b9992b8b1a9d76c217175d4a88"; pull-version: 1=
).
> Please report it by email to <bug-guix@gnu.org>.
> ---snap---
>
> Obviously the socket on that compute machine is not working, because it=
=E2=80=99s on an
> NFS share /var/guix belonging to master. But why is the socket considered=
 in
> the first place?

This is a limitation in =E2=80=98build-aux/build-self.scm=E2=80=99:

      ;; Use the port beneath the current store as the stdin of BUILD.  This
      ;; way, we know 'open-pipe*' will not close it on 'exec'.  If PORT is
      ;; not a file port (e.g., it's an SSH channel), then the subprocess's
      ;; stdin will actually be /dev/null.
      (let* ((pipe   (with-input-from-port port
                       (lambda ()
                          ;; =E2=80=A6
                                      (if (file-port? port)  ;<- here
                                          (number->string
                                           (logior major minor))
                                          "none"))))))

We could work around it by letting the =E2=80=98GUIX_DAEMON_SOCKET=E2=80=99=
 environment
variable through, along these lines:


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index f2e785b7f1..18a78b5f41 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -400,6 +400,7 @@ files."
                                              #:pull-version pull-version))
                       (system (if system (return system) (current-system)))
                       (home -> (getenv "HOME"))
+                      (daemon-socket -> (getenv "GUIX_DAEMON_SOCKET"))
 
                       ;; Note: Use the deprecated names here because the
                       ;; caller might be Guix <= 0.16.0.
@@ -424,6 +425,8 @@ files."
                           (when home
                             ;; Inherit HOME so that 'xdg-directory' works.
                             (setenv "HOME" home))
+                          (when (and (not (file-port? port) daemon-socket))
+                            (setenv "GUIX_DAEMON_SOCKET" daemon-socket))
                           (open-pipe* OPEN_READ
                                       (derivation->output-path build)
                                       source system version

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


It=E2=80=99s a bit hacky though, and won=E2=80=99t work with old Guix revis=
ions anyway.

However, for your use case, you could perhaps simply pull on one machine
and use =E2=80=98guix copy=E2=80=99 to send Guix elsewhere?  Or even explic=
itly run
=E2=80=98guix pull=E2=80=99 on each node?

Thanks,
Ludo=E2=80=99.

--=-=-=--