Subject: bug#73181: guix-daemon fails when invoking ‘guix authenticate’ on the Hurd

From: <[email-masked]>
Date: Mon, 18 Nov 2024 09:41:04 +0100

Ludovic Courtès writes:

Hello,

> <[email-masked]> skribis:
>
>> Anyway, using this patch 0001 it seems that suppressing the warnings
>> works, I no longer get
>>
>> "GC Warning: Repeated allocation of very large block (appr. size 112
>> KiB):\n\tMay lead to memory leak and poor performance\n"
>>
>>
>> but still get
>>
>> unexpected build daemon error: stoi
>
> Damnit.  Could you check with rpctrace what the daemon receives?
>
> I wonder if I misunderstood what the root cause is.
>
>> From 3d399e51104171ad328bea66ebdc1d6b0ac99685 Mon Sep 17 00:00:00 2001
>> Message-ID: <[email-masked]>
>> From: Janneke Nieuwenhuizen <[email-masked]>
>> Date: Mon, 4 Nov 2024 14:54:55 +0100
>> Subject: [PATCH 1/3] guile: Silence GC warnings on the Hurd.
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>> Content-Transfer-Encoding: 8bit
>> Content-Type: text/plain; charset=UTF-8
>>
>> This should work around <https://issues.guix.gnu.org/73181>, resurrecting
>> offloading to the Hurd.
>>
>> * gnu/packages/aux-files/guile-launcher.c (no_warnings)[__GNU__]: New
>> function.
>> (main)[__GNU__]: Use it to silence libgc warnings.
>>
>> Co-authored-by: Ludovic Courtès <[email-masked]>.
>> Change-Id: I8f30732d192ce46144da4a1a081813a104a5f376
>
> LGTM.

Okay, pushed to master as b0416b8503e38746717a2d1167f9d1410634981e.

I decided to add some more instrumentation

--8<---------------cut here---------------start------------->8---
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 0883a4bbce..f9f42074eb 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -1182,6 +1182,12 @@ static int readInteger(int fd)
         }
     }
 
+    if (str.empty()) {
+      printMsg(lvlError, format("nondigit: %1%") % str);
+      str = readLine(fd);
+      printMsg(lvlError, format("line: %1%") % str);
+      throw EndOfFile("unexpected non-digit reading an integer");
+    }
     return stoi(str);
 }
--8<---------------cut here---------------end--------------->8---

to possibly find out what the non-digit text is that we get, and build
with the above patch.  However, after two initial offload failures and
wrong host key, manual chilhurd..

--8<---------------cut here---------------start------------->8---
08:31:37 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/q8gsjh72lb4h2ga65g1rzj6f8nm9l7lg-export-test'
guix offload: error: unexpected non-digit reading an integer
[1] 08:32:10 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/5hfifv0ngkazyhbn0klbfq28fcxnlz3b-export-test'
guix offload: error: unexpected non-digit reading an integer
[1] 08:32:28 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/90517zpibi4bqsrbmd9ih64l8044ixnx-export-test'
guix offload: 'localhost' successfully imported '/gnu/store/90517zpibi4bqsrbmd9ih64l8044ixnx-export-test'
acquiring global GC lock `/var/guix/gc.lock'
acquiring read lock on `/var/guix/temproots/280'
acquiring write lock on `/var/guix/temproots/280'
downgrading to read lock on `/var/guix/temproots/280'
locking path `/gnu/store/r3d3r3xgf89axzp27krlj07rw6czlmcn-import-test'
lock acquired on `/gnu/store/r3d3r3xgf89axzp27krlj07rw6czlmcn-import-test.lock'
lock released on `/gnu/store/r3d3r3xgf89axzp27krlj07rw6czlmcn-import-test.lock'
retrieving 1 store item from 'localhost'...
guix offload: error: unauthorized public key: (public-key 
 (ecc 
  (curve Ed25519)
  (q #842CFCACDF1E7F764A3E31621DA9AF70C2B3CA37222EC2C56C04228190F2EA48#)
  )
 )

[1] 08:33:34 janneke@dundal:~/src/guix/hurd64-team 
--8<---------------cut here---------------end--------------->8---

...handle authorization..., I realized that the extra debugging is
printed on the host side, so I should also run the patched daemon there.
However, there was no more chance to do so because the offload test
started to work...

--8<---------------cut here---------------start------------->8---
08:34:12 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/bvgz40q5x67iypa02qc7qb610f0vlb5d-export-test'
guix offload: 'localhost' successfully imported '/gnu/store/bvgz40q5x67iypa02qc7qb610f0vlb5d-export-test'
acquiring global GC lock `/var/guix/gc.lock'
acquiring read lock on `/var/guix/temproots/318'
acquiring write lock on `/var/guix/temproots/318'
downgrading to read lock on `/var/guix/temproots/318'
locking path `/gnu/store/zrqdfjvyyvyfz27678ia7jqidhf8557y-import-test'
lock acquired on `/gnu/store/zrqdfjvyyvyfz27678ia7jqidhf8557y-import-test.lock'
lock released on `/gnu/store/zrqdfjvyyvyfz27678ia7jqidhf8557y-import-test.lock'
retrieving 1 store item from 'localhost'...
guix offload: successfully imported '/gnu/store/zrqdfjvyyvyfz27678ia7jqidhf8557y-import-test' from 'localhost'
08:34:27 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/vcfgm1crwm5hfwmq2f04d67w5gix76yc-export-test'
guix offload: 'localhost' successfully imported '/gnu/store/vcfgm1crwm5hfwmq2f04d67w5gix76yc-export-test'
acquiring global GC lock `/var/guix/gc.lock'
acquiring read lock on `/var/guix/temproots/335'
acquiring write lock on `/var/guix/temproots/335'
downgrading to read lock on `/var/guix/temproots/335'
locking path `/gnu/store/g2gpgcqbaaj3gylrvskr7pdnq7w88b48-import-test'
lock acquired on `/gnu/store/g2gpgcqbaaj3gylrvskr7pdnq7w88b48-import-test.lock'
lock released on `/gnu/store/g2gpgcqbaaj3gylrvskr7pdnq7w88b48-import-test.lock'
retrieving 1 store item from 'localhost'...
guix offload: successfully imported '/gnu/store/g2gpgcqbaaj3gylrvskr7pdnq7w88b48-import-test' from 'localhost'
08:34:36 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/30np8abkfw4q70zkp779m2h0mhygzzkv-export-test'
guix offload: 'localhost' successfully imported '/gnu/store/30np8abkfw4q70zkp779m2h0mhygzzkv-export-test'
acquiring global GC lock `/var/guix/gc.lock'
acquiring read lock on `/var/guix/temproots/352'
acquiring write lock on `/var/guix/temproots/352'
downgrading to read lock on `/var/guix/temproots/352'
locking path `/gnu/store/381dqixhyg6dkm65cvp21qd19g49gp5h-import-test'
lock acquired on `/gnu/store/381dqixhyg6dkm65cvp21qd19g49gp5h-import-test.lock'
lock released on `/gnu/store/381dqixhyg6dkm65cvp21qd19g49gp5h-import-test.lock'
retrieving 1 store item from 'localhost'...
guix offload: successfully imported '/gnu/store/381dqixhyg6dkm65cvp21qd19g49gp5h-import-test' from 'localhost'
08:34:45 janneke@dundal:~/src/guix/hurd64-team 
$ guix offload test
guix offload: testing 1 build machines defined in '/etc/guix/machines.scm'...
guix offload: Guix is usable on 'localhost' (test returned "/gnu/store/883yjkl46dxw9mzykykmbs0yzwyxm17z-test")
guix offload: 'localhost' is running GNU Guile 3.0.9
guix offload: sending 1 store item (0 MiB) to 'localhost'...
exporting path `/gnu/store/imb70z94d8050dl8nvwbxznfq4aq9jzh-export-test'
guix offload: 'localhost' successfully imported '/gnu/store/imb70z94d8050dl8nvwbxznfq4aq9jzh-export-test'
acquiring global GC lock `/var/guix/gc.lock'
acquiring read lock on `/var/guix/temproots/369'
acquiring write lock on `/var/guix/temproots/369'
downgrading to read lock on `/var/guix/temproots/369'
locking path `/gnu/store/prmbb24jl7shiqg56f9fips5izlai1l2-import-test'
lock acquired on `/gnu/store/prmbb24jl7shiqg56f9fips5izlai1l2-import-test.lock'
lock released on `/gnu/store/prmbb24jl7shiqg56f9fips5izlai1l2-import-test.lock'
retrieving 1 store item from 'localhost'...
guix offload: successfully imported '/gnu/store/prmbb24jl7shiqg56f9fips5izlai1l2-import-test' from 'localhost'
--8<---------------cut here---------------end--------------->8---

so, that's why I pushed the commit.  When I tested, and later
re-asserted this patch didn't work, I only tried once or twice...
Guess I'm counting too strongly on deterministic behaviour. :)

Guix copy also works (two ways), yay!

--8<---------------cut here---------------start------------->8---
$ guix copy --to=root@childhurd1 hello
guix copy: sending 0 store items (0 MiB) to 'localhost'...
08:38:55 janneke@dundal:~/src/guix/hurd64-team 
$ guix copy --to=root@childhurd1 tar
guix copy: sending 1 store item (3 MiB) to 'localhost'...
/gnu/store/1w05qnl350b88g5wj1z5k2jywhhcxkyn-tar-1.34
08:58:54 janneke@dundal:~/src/guix/hurd-team 
$ guix copy --from=root@childhurd1   /gnu/store/liwlc0500w5lq37p3skr8llqx436bbjr-profile.drv
retrieving 1 store item from 'localhost'...
/gnu/store/0mxnx8l4fgigvd7gakwdk6hc6im4wnai-disarchive-mirrors
/gnu/store/ajgpfirfcga0k48qvbf359b0ldgl2bic-mirrors
/gnu/store/wg1yp2vx8gb7qmcgyibqnwblahpp4bjg-content-addressed-mirrors
...
09:01:46 janneke@dundal:~/src/guix/hurd-team 
--8<---------------cut here---------------end--------------->8---

Actually offloading shows the same behaviour as I observed using my
LC_ALL=C hack (with the 64bit childhurd):

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --system=i586-gnu --expression='(@@ (gnu packages commencement) gnu-make-boot0)'
substitute: updating substitutes from 'http://192.168.178.20:8080'... 100.0%
substitute: updating substitutes from 'http://kluit.dezyne.org:8181'... 100.0%
substitute: updating substitutes from 'http://janneke.lilypond.org:8080'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
The following derivations will be built:
  /gnu/store/9zznz8v0pbr7q4ix7syqhl6njrhw6xgf-glibc-stripped-2.39-i586-pc-gnu.tar.xz.drv
  /gnu/store/zb9f8hnc1iyabi072251lc67d2syh8f9-glibc-bootstrap-0.drv
  /gnu/store/xf4cnmaxkda92v9493lr43afq577nnx0-gcc-bootstrap-0.drv
  /gnu/store/2469p0sxmw0m7d0g5xvdwgdzw95w947j-make-boot0-4.4.1.drv
process 11767 acquired build slot '/var/guix/offload/localhost:11022/0'
normalized load on machine 'localhost' is 1.00
waiting for locks or build slots...
process 11767 acquired build slot '/var/guix/offload/localhost:11022/0'
normalized load on machine 'localhost' is 1.00
process 11767 acquired build slot '/var/guix/offload/localhost:11022/0'
normalized load on machine 'localhost' is 1.00
process 11767 acquired build slot '/var/guix/offload/localhost:11022/0'
normalized load on machine 'localhost' is 1.00
...ad infinitum
--8<---------------cut here---------------end--------------->8---

...nothing happens.  (Tried several times, let it run for 5min.)  Maybe
that's another issue?

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen <[email-masked]>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com