Subject: bug#25775: Can't install packages after guix pull

From: Ricardo Wurmus <[email-masked]>
Date: Mon, 20 Feb 2017 17:06:48 +0100

This problem was exposed by commit 50b8a527e, which adds a graft for
bash and along with it a download method for bash patches.  What happens
is that for a reason I haven’t yet understood the download method
procedure is called with “#f” instead of a package object for guile.

This is no problem when the built-in downloader is used, because by
design it doesn’t need Guile or GnuTLS.  Older daemons do not have a
built-in downloader and fall back to the “in-band-download”, which needs
to be passed a Guile package.  Because this doesn’t happen in this case,
Guix at this commit or later abort when an old daemon is used.

Since I lack an understanding of why the “guile” argument could ever
purposefully be set to “#f” I cannot come up with a nice fix.  Instead
of a nice fix I have found a really gross fix:

--8<---------------cut here---------------start------------->8---
diff --git a/guix/download.scm b/guix/download.scm
index 813f51f48..86f859881 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -418,7 +418,10 @@ GnuTLS itself and its dependencies.  See <http://bugs.gnu.org/22774>."
                        ;; hash of the expected result.
                        #:verify-certificate? #f)))))

-  (mlet %store-monad ((guile (package->derivation guile system)))
+  (mlet %store-monad ((guile (package->derivation
+                              (or guile
+                                  (@@ (gnu packages bootstrap) %bootstrap-guile))
+                              system)))
     (gexp->derivation file-name builder
                       #:guile-for-build guile
                       #:system system
--8<---------------cut here---------------end--------------->8---

With this patch installed I can use the latest Guix with an ancient
guix-daemon (I tested with 0.10.0).

For those of you who are using Guix on top of a foreign distribution:
you may find the following steps helpful in upgrading the daemon to
a compatible version.

--8<---------------cut here---------------start------------->8---
# become root
su -

# update to the last version of guix that works
# with older daemons
guix pull --url=http://git.savannah.gnu.org/cgit/guix.git/snapshot/afd532337.tar.gz

# update root's profile to get a new "guix" package
# including a new daemon
guix package -u

# edit the systemd unit to use the new daemon
sed -i "s|ExecStart=.*|ExecStart=/root/.guix-profile/bin/guix-daemon --build-users-group=guixbuild" /etc/systemd/system/guix-daemon.service

# reload the unit file
systemctl daemon-reload

# restart the daemon
systemctl restart guix-daemon

# now become a regular user and run "guix pull"
exit
guix pull
--8<---------------cut here---------------end--------------->8---

Ideally, this wouldn’t be necessary, but I cannot install this ugly
patch (or a prettier variant thereof) before someone who is more
familiar with the code has looked over it.

I hope this helps!

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net