Subject: Re: bug#58640: Garbage collector ('gc') deletes valid user roots when $HOME is inaccessible

From: Ludovic Courtès <[email-masked]>
Date: Fri, 21 Oct 2022 09:30:25 +0200

Hi Felix,

Felix Lechner <[email-masked]> skribis:

> The Guix garbage collector ('gc') deletes valid user roots when those
> links are not resolvable via the user's home folder in places such as
>
>     ~/.cache/guix/profiles/
>
> which potentially leaves the user without a working profile.
>
> Home folders are not always accessible to the root user, and may
> therefore also not be accessible to the Guix daemon.  In some
> networked setups, for example, home folders can be automounted.
>
> In my particular case, the home folder was inaccessible due to my
> encrypted filesystem's security policies, which are enforced by FUSE
> when using gocryptfs. [1]

To complement what Liliana wrote, there are two kinds of GC root:
“regular roots” (the symlinks under /var/guix/profiles and
/var/guix/gcroots), and “indirect roots” (symlinks created when you run
‘guix shell’ or when you run ‘guix package -p ~/my-root’).

Indirect roots are invisible to the GC if the file system where they
live is inaccessible.  That’s what you observed.

There’s no good solution I can think of, except not storing indirect
roots on a file system not visible to the GC.

I hope that makes sense!

Thanks,
Ludo’.