Subject: Re: Corrupt, un-repairable store after power cut during upgrade

From: Liliana Marie Prikler <[email-masked]>
Date: Sat, 23 Oct 2021 09:49:16 +0200

Hi Guix,

Am Sonntag, den 16.05.2021, 17:59 +0900 schrieb [email-masked]:
> Hey Guix,
> 
> Recently, during in the middle of a `guix package -m
> .guix/manifest.scm`, my
> machine had power failure. After rebotting, I simply reran the above
> and it completed without error.
> 
> However, it appears that some of files in the store items are
> corrupt:
> 
> [...]
> As an extra bit of annoyance, the handy verify and repair tools fail
> to see a problem:
> 
> [...]
> 
> Some questions:
> 
>   1) Am I just missing something obvious?
>   2) How could grafting end up producing empty files in the output?
>   3) Is the store supposed to be robust against power failures?
After dealing with some softer issues related to power outage during
`guix package', I think I'm now able to say that Guix does not process
grafts correctly during repair.

What happened for me, was that certain store files were empty and when
they were later grafted, those empty files were carried over.  Guix,
upon repairing the store, did then not regraft those, but rather kept
them as-is.  I have since fixed said issue by manually deleting the
graft and rebuilding (this was possible, because nothing referred to it
– I'm not sure why `guix gc' didn't pick it up as dead earlier,
though).  Stuff in my profiles seem to also have been rebuilt after
roll-back+gc.

So I think content repair needs to have at least two steps:
1. checking and repairing all "normal" derivations.
2. fixing grafts of packages that were repaired in step 1.

WDYT?