Discussion:
Changing HTTP proxy settings in GuixSD
Konrad Hinsen
2017-10-26 13:21:25 UTC
Permalink
Hi everyone,

I wonder if anyone else has had the problem I describe below and knows a
solution.

I am running GuixSD in a virtual machine on a laptop that I use in
different network environments. One of them requires the use of a HTTP
proxy, direct accesses being blocked. As a consequence, the Guix build
daemon fails when downloading anything.

After reading the manual, I come to the conclusion that the only way to
change the HTTP proxy settings for the build daemon is via
(guix-configuration ...), which requires to do "guix system reconfigure".
Unfortunately that command fails because it tries to download stuff (no
idea why, BTW, I didn't do a "guix pull" since I last used it) and
fails. It looks like I'd have to reconfigure while I am still in a
working network environment, meaning I'd have to anticipate switching
networks, which I can't.

More generally, it would be nice to have to be able to change network
settings without reconfiguring and rebooting. But at first, I'd be happy
if I could get my system to work at all.

Any ideas?

Konrad.
Ludovic Courtès
2017-10-27 00:41:08 UTC
Permalink
Hello!
Post by Konrad Hinsen
I am running GuixSD in a virtual machine on a laptop that I use in
different network environments. One of them requires the use of a HTTP
proxy, direct accesses being blocked. As a consequence, the Guix build
daemon fails when downloading anything.
After reading the manual, I come to the conclusion that the only way
to change the HTTP proxy settings for the build daemon is via
(guix-configuration ...), which requires to do "guix system
reconfigure".
Unfortunately that command fails because it tries to download stuff
(no idea why, BTW, I didn't do a "guix pull" since I last used it) and
fails. It looks like I'd have to reconfigure while I am still in a
working network environment, meaning I'd have to anticipate switching
networks, which I can't.
Not that it helps you much, but there’s an open bug on this topic:
<https://bugs.gnu.org/25569>.
Post by Konrad Hinsen
More generally, it would be nice to have to be able to change network
settings without reconfiguring and rebooting. But at first, I'd be
happy if I could get my system to work at all.
I agree.

A quick workaround would be to do something along these lines:

# herd stop guix-daemon
# http_proxy=… guix-daemon --build-users-group=guixbuild
# guix system reconfigure config.scm

where config.scm has the relevant proxy configuration of in
‘guix-configuration’.

Would that work for you?

HTH,
Ludo’.
Konrad Hinsen
2017-11-06 17:20:23 UTC
Permalink
Hi Ludo,
Post by Ludovic Courtès
# herd stop guix-daemon
# http_proxy=… guix-daemon --build-users-group=guixbuild
# guix system reconfigure config.scm
where config.scm has the relevant proxy configuration of in
‘guix-configuration’.
Would that work for you?
No. Downloads fail with messages of the type

ERROR: Wrong type to apply: "mirror.hydra.gnu.org"

This looks like the proxy returns something that guix-daemon doesn't
expect. Unfortunately, this may well be the fault of my institutions
proxy, which has caused lots of people lots of trouble of various kinds.

Konrad.
Chris Marusich
2017-11-10 05:28:39 UTC
Permalink
Post by Konrad Hinsen
Post by Ludovic Courtès
# herd stop guix-daemon
# http_proxy=
 guix-daemon --build-users-group=guixbuild
# guix system reconfigure config.scm
where config.scm has the relevant proxy configuration of in
‘guix-configuration’.
Would that work for you?
No. Downloads fail with messages of the type
ERROR: Wrong type to apply: "mirror.hydra.gnu.org"
This looks like the proxy returns something that guix-daemon doesn't
expect. Unfortunately, this may well be the fault of my institutions
proxy, which has caused lots of people lots of trouble of various kinds.
That error looks suspicious. Perhaps you already know this, but it
probably means that the string "mirror.hydra.gnu.org" wound up being
used where a procedure should probably have been used instead. For
example, in your Guile REPL, you can reproduce this kind of error like
this:

scheme@(guile-user)> ("this is not a procedure")
ERROR: ERROR: Wrong type to apply: "this is not a procedure"

The workaround that Ludo described, in which you temporarily stop the
guix-daemon, and then start it in an environment where http_proxy is set
appropriately, should work. If it isn't, then can I ask to see the
commands and conigs you're using which fail?
--
Chris
Konrad Hinsen
2017-11-10 09:05:59 UTC
Permalink
Hi Chris,
Post by Chris Marusich
That error looks suspicious. Perhaps you already know this, but it
probably means that the string "mirror.hydra.gnu.org" wound up being
used where a procedure should probably have been used instead. For
example, in your Guile REPL, you can reproduce this kind of error like
ERROR: ERROR: Wrong type to apply: "this is not a procedure"
Suspicious indeed...
Post by Chris Marusich
The workaround that Ludo described, in which you temporarily stop the
guix-daemon, and then start it in an environment where http_proxy is set
appropriately, should work.
That's exactly what I did.
Post by Chris Marusich
If it isn't, then can I ask to see the commands and conigs you're
using which fail?
Here are the commands I typed:

sudo -s
herd stop guix-daemon
http_proxy=http://proxy.synchrotron-soleil.fr:8080/ guix-daemon --build-users-group=guixbuild
guix system reconfigure /etc/config.scm

The config I used in this first test (attached) is exactly the same one
I am currently running, with no reference to the proxy at all. I was
planning to add that in a second step.

Konrad.
Ludovic Courtès
2017-11-10 22:15:41 UTC
Permalink
Hi Konrad,
Post by Konrad Hinsen
Post by Chris Marusich
That error looks suspicious. Perhaps you already know this, but it
probably means that the string "mirror.hydra.gnu.org" wound up being
used where a procedure should probably have been used instead. For
example, in your Guile REPL, you can reproduce this kind of error like
ERROR: ERROR: Wrong type to apply: "this is not a procedure"
Suspicious indeed...
It turned out to come from a typo in Guile 2.2’s web client, now fixed
here:

https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=7d0d9e2c25c1e872cfc7d14ab5139915f1813d56

and I’ve done some monkey-patching here:

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=59da6f04f45b36696a9385babab3080d7d854fba

I’ll update the ‘guix’ package soon so that this change is available to
daemon-side code such as ‘guix substitute’. In the meantime you can run
the daemon from a checkout:

sudo -E ./pre-inst-env guix-daemon …

For reference, I used this command to test proxy support:

http_proxy=http://localhost:8118 \
./pre-inst-env guix download http://www.gnu.org

where Privoxy is listening to localhost:8118.

Thanks for reporting the issue!

Ludo’.
ng0
2017-11-10 22:29:33 UTC
Permalink
Post by Ludovic Courtès
Hi Konrad,
Post by Konrad Hinsen
Post by Chris Marusich
That error looks suspicious. Perhaps you already know this, but it
probably means that the string "mirror.hydra.gnu.org" wound up being
used where a procedure should probably have been used instead. For
example, in your Guile REPL, you can reproduce this kind of error like
ERROR: ERROR: Wrong type to apply: "this is not a procedure"
Suspicious indeed...
It turned out to come from a typo in Guile 2.2’s web client, now fixed
https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=7d0d9e2c25c1e872cfc7d14ab5139915f1813d56
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=59da6f04f45b36696a9385babab3080d7d854fba
I’ll update the ‘guix’ package soon so that this change is available to
daemon-side code such as ‘guix substitute’. In the meantime you can run
sudo -E ./pre-inst-env guix-daemon 

http_proxy=http://localhost:8118 \
./pre-inst-env guix download http://www.gnu.org
where Privoxy is listening to localhost:8118.
Thanks for reporting the issue!
Ludo’.
Oh. I think I encountered a similar (or the same?) problem one
year ago without ever reporting it.
I'll check soon if my usecase is fixed with your latest commits.

Thanks for working on this!
--
GnuPG: A88C8ADD129828D7EAC02E52E22F9BBFEE348588
GnuPG: https://dl.n0.is/dist/keys/
WWW: https://we.make.ritual.n0.is
Mark H Weaver
2017-11-11 10:12:20 UTC
Permalink
Hi,
Post by Ludovic Courtès
It turned out to come from a typo in Guile 2.2’s web client, now fixed
https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=7d0d9e2c25c1e872cfc7d14ab5139915f1813d56
[...]
Post by Ludovic Courtès
diff --git a/module/web/http.scm b/module/web/http.scm
index 993b50e..62f0624 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
[...]
@@ -1158,7 +1158,7 @@ three values: the method, the URI, and the version."
(put-symbol port scheme)
(put-string port "://")
(cond
- ((host string-index #\:)
+ ((string-index host #\:)
(put-char #\[ port)
(put-string port host
(put-char port #\])))
There are 4 typos in the cond clause above, all introduced in this
commit:

https://git.savannah.gnu.org/cgit/guile.git/commit/?id=96b994b6f815747ce2548123cc996d8132bd4781

which includes:

- ((string-index host #\:)
- (display #\[ port)
- (display host port)
- (display #\] port))
+ ((host string-index #\:)
+ (put-char #\[ port)
+ (put-string port host
+ (put-char port #\])))

In addition to the typo you fixed:

* The first call to 'put-char' above has its arguments reversed.
* The following line is missing its ')'.
* The last line has an extra ')'.

Mark
Ludovic Courtès
2017-11-11 14:20:57 UTC
Permalink
Post by Mark H Weaver
Post by Ludovic Courtès
It turned out to come from a typo in Guile 2.2’s web client, now fixed
https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.2&id=7d0d9e2c25c1e872cfc7d14ab5139915f1813d56
[...]
Post by Ludovic Courtès
diff --git a/module/web/http.scm b/module/web/http.scm
index 993b50e..62f0624 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
[...]
@@ -1158,7 +1158,7 @@ three values: the method, the URI, and the version."
(put-symbol port scheme)
(put-string port "://")
(cond
- ((host string-index #\:)
+ ((string-index host #\:)
(put-char #\[ port)
(put-string port host
(put-char port #\])))
There are 4 typos in the cond clause above, all introduced in this
https://git.savannah.gnu.org/cgit/guile.git/commit/?id=96b994b6f815747ce2548123cc996d8132bd4781
- ((string-index host #\:)
- (display #\[ port)
- (display host port)
- (display #\] port))
+ ((host string-index #\:)
+ (put-char #\[ port)
+ (put-string port host
+ (put-char port #\])))
* The first call to 'put-char' above has its arguments reversed.
* The following line is missing its ')'.
* The last line has an extra ')'.
Ouch, good catch. I pushed appropriate fixes.

If you spot more, feel free to fix them directly! :-)

Thanks,
Ludo’.
Konrad Hinsen
2017-11-16 09:21:21 UTC
Permalink
Hi Ludo,
Post by Ludovic Courtès
I’ll update the ‘guix’ package soon so that this change is available to
daemon-side code such as ‘guix substitute’. In the meantime you can run
sudo -E ./pre-inst-env guix-daemon …
That works fine - thanks!

Konrad.

Loading...