Subject: Re: bug#44735: gilbc of the running system got wiped while building a package, system broken

From: Stefan <[email-masked]>
Date: Fri, 20 Nov 2020 15:35:26 +0100

Hi Ludo’!

> Your store database may no longer be in sync with your actual store so
> you may have to reinstall.  You can try ‘guix gc --verify’ to get an
> idea of how bad the situation is.

stefan@guix ~/development/guix$ guix gc --verify
reading the store...
checking path existence...
path `/gnu/store/1kh1p8ypgn1yn826cc0mizw7gjjn5yfb-usbutils-012-guile-builder' disappeared, removing from database...
path `/gnu/store/da76qwnqrfravn2qd92b6vk5inp7273v-vala-0.44.5.drv' disappeared, removing from database...
path `/gnu/store/iq987sfc1bwyaijckagv59b0z2z3c4nb-vala-0.44.5.drv' disappeared, removing from database...
path `/gnu/store/m7l8381hqz4dgp12v9fbnf0k9n1ij5ja-module-import-compiled-guile-builder' disappeared, removing from database...
path `/gnu/store/mnhh9m6v88zk9k7lc6hj15db40qv5cnh-guix-packages-base-modules-builder' disappeared, removing from database...
path `/gnu/store/nal2ssav0z0qk523w5v6xp2vfqqfpc13-guix-module-union-builder' disappeared, removing from database...
path `/gnu/store/x5gczh79g5aarws1xgkcp2gc1av4fzas-vala-0.44.5.tar.xz.drv' disappeared, removing from database…

stefan@guix ~/development/guix$ guix gc --verify
reading the store...
checking path existence…

stefan@guix ~/development/guix$

That doesn’t seem to be so bad. :-)

> ./configure warns or errors out and the manual warns in a couple of
> places too, but evidently it remains too easy to shoot oneself in the
> foot.

It warns in the chapter “2 Requirements”. It doesn’t warn in chapter ”14.1 Building from Git”.

Anyway, it was just a typo. Even if I would have known about that warning, this would have happened. 

> Could you check ‘config.log’ to see what ‘configure’ said?  You can see
> the source of this check at the bottom of ‘m4/guix.m4’.

I retried:

stefan@guix ~/development/guix [env]$ ./configure --localstatedir=/vaar
checking for a BSD-compatible install... /gnu/store/5hj9mdr79nqfcqg9hb45dpfrrs5qqrnr-profile/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /gnu/store/5hj9mdr79nqfcqg9hb45dpfrrs5qqrnr-profile/bin/mkdir -p
checking for gawk… gawk

[pages of checking]

checking the current installation's localstatedir... /var
configure: WARNING: chosen localstatedir '/vaar' does not match that of the existing installation '/var'
configure: WARNING: installing may corrupt /gnu/store!
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating po/guix/Makefile.in
config.status: creating po/packages/Makefile.in
config.status: creating etc/guix-daemon.cil
config.status: creating guix/config.scm
config.status: creating etc/committer.scm
config.status: creating test-env
config.status: creating pre-inst-env
config.status: creating nix/config.h
config.status: nix/config.h is unchanged
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/guix/POTFILES
config.status: creating po/guix/Makefile
config.status: creating po/packages/POTFILES
config.status: creating po/packages/Makefile
stefan@guix ~/development/guix [env]$ 

Indeed, there in all that pages of output, luckily on the last page, there is a warning. I could have noticed it. But I did’t. Red colour could have helped. :-)

The same warning is hidden inside the very middle of the config.log. At least the mistake with localstatedir is visible right at its beginning. 

Would it be possible to do that check right at the beginning of configure and ask the user for confirmation?

> Also, why did you run guix-daemon from your checkout?  This is only
> necessary if you’re actually hacking on the daemon, but perhaps the
> manual is misleading.  (Hadn’t you run guix-daemon from the checkout,
> the problem would not have occurred, even with a wrong
> ‘--localstatedir’.)

I was trying to add a build side module into guix/build. This failed all the time with an error “no code for module”. As neither #:modules nor #:imported-modules are documented (see also http://debbugs.gnu.org/cgi/bugreport.cgi?bug=44758), I was a bit clueless. Then I found out, that I have to add the module into Makefile.am and have to run configure. And there the typo happened. But still this was’t working and I thought that I may need to start the daemon with pre-inst-env to have the GUILE_LOAD_PATH properly point to guix/build. Well, and so the disaster happened.

Bye

Stefan