Subject: Re: bug#25089: Can't build source derivations with Guix 0.11.0-4.1f41

From: [email-masked] (Ludovic Courtès)
Date: Sun, 04 Dec 2016 22:05:48 +0100

Leo Famulari <[email-masked]> skribis:

> I'm having trouble building source code derivations using the latest
> guix development snapshot, 0.11.0-4.1f41. I don't seem to have any
> trouble building packages themselves.
>
> I'm using Guix on a foreign distro (Debian).
>
> I think the problem is in the daemon because it doesn't manifest just
> because I've switched to a profile with the 0.11.0-4.1f41 snapshot; I
> have to use that version of the daemon to see the problem.

The main difference is that downloads are performed by the daemon itself
(via the ‘guix perform-download’ internal command), which was not the
case before (see <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22774#13>.)

> It fails like this:
>
> ------
> $ guix build hello --source --check
> @ build-started /gnu/store/xv9vdk2dijx6nnl8hsawffwfnfmm5vny-hello-2.10.tar.gz.drv - x86_64-linux /var/log/guix/drvs/xv//9vdk2dijx6nnl8hsawffwfnfmm5vny-hello-2.10.tar.gz.drv.bz2
> warning: failed to install locale: Invalid argument

Aaaah, locales!  :-)

> Starting download of /gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz
> From http://ftpmirror.gnu.org/hello/hello-2.10.tar.gz...
> following redirection to `http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu/hello/hello-2.10.tar.gz'...
> following redirection to `http://mirrors.ibiblio.org/gnu/ftp/gnu/hello/hello-2.10.tar.gz'...
> ERROR: In procedure open-file: Permission denied: "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz"

It should definitely have write permission on the output file.

Could you ‘strace -f’ guix-daemon or something like that to see under
what UID ‘guix perform-download’ executes?  It’s expected to be running
as a build user, but not in a chroot.

I can’t reproduce this on GuixSD.

> @ build-failed /gnu/store/xv9vdk2dijx6nnl8hsawffwfnfmm5vny-hello-2.10.tar.gz.drv - 1 builder for `/gnu/store/xv9vdk2dijx6nnl8hsawffwfnfmm5vny-hello-2.10.tar.gz.drv' failed to produce output path `/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz'
> guix build: error: build failed: build of `/gnu/store/xv9vdk2dijx6nnl8hsawffwfnfmm5vny-hello-2.10.tar.gz.drv' failed
> ------
>
> This file /gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz
> already exists in my store.

You mean it’s building it despite the fact that it’s already there?
Sounds fishy!

Could it be that the sqlite.db being used doesn’t correspond to the
store (wrong localstatedir mistake)?

> If I set $TMPDIR to something besides the default, it fails like this:
>
> ------
> $ guix build hello --source --check
> guix build: error: build failed: while setting up the build environment: changing into `/home/leo/tmp/guix-build/guix-build-hello-2.10.tar.gz.drv-0': No such file or directory
> ------

That seems to come from build.cc:2204 (probably unrelated to the problem
above.)

Again, could you ‘strace -f’ guix-daemon to see what directory it
creates?

My suspicion is that it creates /tmp/guix-build-hello… but then tries to
chdir to /home/leo/tmp/….

TIA!

Ludo’.