Subject: bug#58988: How Can I restore a file inside /gnu/store/ ?

From: [email-masked]
Date: Fri, 04 Nov 2022 17:19:05 +0100

On 2022-11-04 10:18, Tobias Geerinckx-Rice wrote:
> Heyo,
> 
> Adding some notable info that user_ shared on IRC:
> 
>> user2@host ~$ sudo guix build --repair 
>> /gnu/store/yjllxib1fm3zqkwmr5j4lpxhz3zqsjjz-guix-e3280ae
>> Senha: substitute: atualizando substitutos de 
>> "https://ci.guix.gnu.org"... 100.0%
>> substituindo 
>> /gnu/store/yjllxib1fm3zqkwmr5j4lpxhz3zqsjjz-guix-e3280ae...
>> baixando de 
>> https://ci.guix.gnu.org/nar/lzip/yjllxib1fm3zqkwmr5j4lpxhz3zqsjjz-guix-e3280ae 
>> ...
>> 
>> guix-e3280ae               792KiB/s 00:21 | 16.1MiB transferred
> 
> [email-masked] 写道：
>> I need to fix this file but
>> /gnu/store/ is read only, How can I restore this file?
> 
> Well, ‘sudo guix gc --verify=contents,repair’, or ‘guix build 
> --repair’.
> 
> Since neither worked: if you've ‘guix pull’ed before, you should have
> some previous profiles as
> 
>  /var/guix/profiles/per-user/$USER/current-guix-*
> 
> If so: see if pulling any of those works, e.g.,
> 
>  $ /var/guix/profiles/per-user/$USER/current-guix-1-link/bin/guix  pull
> 
> Kind regards,
> 
> T G-R

After trying "guix pull" with all "guix-<N>-link/bin/guix" files, I 
suspected that all 'build-self.scm' in my /gnu/store/ are corrupted, to 
confirm this I performed a find taking md5sum, and got the following 
output which confirm the corruption, Now I need to know if there is a 
way to manually fix this file, I know that touching /gnu/store/ is a bad 
idea, but since all those files are corrupted I cant see other way to 
fix my problem.

output:

$ find /gnu/store/ -name build-self.scm -exec md5sum {} \;
578dfd3e0a9384241db46b8e62340334  
/gnu/store/4m5pyspndkxzbq4vdyvidj9w0sckww8n-guix-c6d9492/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/59ff5s88yi480gi4rhws6lwk9gbxpz59-guix-314b436/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/65dcad1dnr354szvszg8y1hywclrml1b-guix-67a2049/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/vg5b37za8np63s03g98b8rw60h3vv2am-guix-04f8295/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/cd1858l8nawifai86wkj6df7rffw5c16-guix-34e6c5d/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/cpc4zc2cn4sslr043lxf5virg7pamj1n-guix-e26b529/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/iqmi836vjlyjdqqxyxax3z1yll4fh7pr-guix-86ec52f/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/ghmkh782rccb6l72k36f0qyayxlmaih7-guix-759d365/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/wc5i3nqg0z0rzkfab4swsyqpvj6fzb0f-guix-16d4ded/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/vqcnr5xx5m1g3wz9l2hvqmmxsf68fgyf-guix-3a84b4e/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/84vryc461kzcqk3ziyi8w800rndwz291-guix-1682aba/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/08h2958kbz7v2y9s4a97zgpd02avg6h6-guix-08f2a06/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/6ikw4m2hmwnp56iwlhhlai665qv78cn1-guix-4dfaddf/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/pakkv44927w98d965rhpdig6vk21hrn8-guix-d85c254/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/k1x5m8dhwwz5qiycgc96xwsw09r70jyw-guix-973dc45/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/r6j6whnjxvbay4r8yw54gcslwpzzq9bg-guix-754f260/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/541vb5bj1vichpwz24vba2bj8hgxclpm-guix-72a41c4/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/i6k6mx1s72vfqx27bybcpb1cf6cs8fvw-guix-7ecd85e/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/s9hjqjgwh9wmrx13vz542mnw66dl8ngx-guix-e0b414f/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/nxw9fhqjbwr9rdjza80d2r4aknb0qprw-guix-49e1a3a/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/yjllxib1fm3zqkwmr5j4lpxhz3zqsjjz-guix-e3280ae/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/1my1nch1kpymk85yf1469hf55d84k7q3-guix-3d8c243/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/y6j8bxwn9wi1c8lp41qs6d1xr5ps75di-guix-cd0d27f/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/v7z0c5c15k737i4041gp7q4ppd3fny7z-guix-270eb27/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/rxz8byngcmsq095f6j79n5wyw917f0nd-guix-1ea1fa9/build-aux/build-self.scm
578dfd3e0a9384241db46b8e62340334  
/gnu/store/m0g57k94wslg5zlz4b1apzl34mzk4dkp-guix-bebbf35/build-aux/build-self.scm