Subject: bug#68874: executing `/gnu/store/...-guile-3.0.9/bin/guile': Exec format error

From: Simon Tournier <[email-masked]>
Date: Fri, 02 Feb 2024 01:37:38 +0100

Hi,

On Thu, 01 Feb 2024 at 22:16, Josselin Poiret <[email-masked]> wrote:

>> --8<---------------cut here---------------start------------->8---
>> $ /tmp/new/bin/guix describe
>> /gnu/store/vqkjfl6ds3vdvig2x5pkvvzkc3wivrp0-guile-wrapper/bin/guile: error while loading shared libraries: /gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/lib/libguile-3.0.so.1: file too short
>> --8<---------------cut here---------------end--------------->8---
>
> File too short sounds like store corruption, can you check whether that
> file is empty?  Maybe try gc'ing it and retrying?

Indeed, empty:

--8<---------------cut here---------------start------------->8---
$ file $(readlink -f /gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/lib/libguile-3.0.so.1)
/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9/lib/libguile-3.0.so.1.6.0: empty
--8<---------------cut here---------------end--------------->8---

However, I am not able to remove the item.  I mean: I have tried many
operations as “guix gc”, “guix gc --verify” with ’repair’ and
’contents’, remove some part of ~/.cache/guix and then “guix gc”, remove
the complete ~/.cache/guix and then “guix gc”, rebuild the derivation
with --check, etc.

And the file is still empty.  Arf, I spent some time to find which was
retained it.

Well, I did nothing special for that corruption.  And once I had it, the
process for recovering is not straightforward.  Somehow, it misses
helpers that maps item to profile.

For instance, in order to find the culprit retaining the item, I did

--8<---------------cut here---------------start------------->8---
$ guix gc --referrers /gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9
/gnu/store/1gd9nsy4cps8fnrd1avkc9l01l7ywiai-guile-3.0.9
/gnu/store/50vkm2fkk3aij8jc92phb3ahapn776m8-guix-command
/gnu/store/fd744pmbhzq1avpjjsmfiasp7yqdmiwy-guix-daemon
/gnu/store/vqkjfl6ds3vdvig2x5pkvvzkc3wivrp0-guile-wrapper

$ guix gc --referrers /gnu/store/50vkm2fkk3aij8jc92phb3ahapn776m8-guix-command
/gnu/store/fd744pmbhzq1avpjjsmfiasp7yqdmiwy-guix-daemon
/gnu/store/icp4z3cxp0fibsm4j887nz8k56jc1jgi-guix-7bf8b7c33
--8<---------------cut here---------------end--------------->8---

then ’grep’ the term ’7bf8b7c33’ inside /var/guix/profiles/per-user.

Well, it was retained because I did switch-generation.  Anyway.

Hum, it could be nice if instead:

    guix gc: error: cannot delete path `/gnu/store/…' since it is still alive

it would also point the “profile“ (or profiles) that makes it alive.

Cheers,
simon