Re: About /var/guix/profiles and guix pull generations

From:

Chris Marusich

Subject:

Re: About /var/guix/profiles and guix pull generations

Date:

Sun, 09 Dec 2018 14:21:48 -0800

User-agent:

Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Pierre,
Awesome, thank you for the patch!
Pierre Neidhardt <address@hidden> writes:
> -generations and collecting garbage, along these lines:
> +generations, deleting old Guix checkouts and collecting garbage, along these
> +lines:
I'm not sure what you mean by "Guix checkouts". Do you mean a Git
checkout of Guix's Git repository? If so, why would deleting it help?
> @example
> -guix package -p ~s --delete-generations=1m
> -guix gc
> address@hidden example\n")
> - profile))
> +guix package --profile=~s --delete-generations=1m
> +guix package --profile=~s --delete-generations=1m
> +guix gc --free-space=5G
> address@hidden example
This part seems reasonable to me. We might also mention that others
users may have default profiles of their own. Something like:
"If there are multiple users of Guix on this system, you might want to
repeat these commands for each user."
> +You might also want to delete old non-default profiles in
> +/var/guix/gcroots/auto.")
This is a little tricky. This might make people think they should
delete the links directly from /var/guix/gcroots/auto. For example, if
you create a profile at /tmp/myprofile via
guix package --profile=/tmp/myprofile -i coreutils
you will get the following symlink structure:
--8<---------------cut here---------------start------------->8---
[0] address@hidden:~/guix
$ ls -al /tmp/myprofile*
lrwxrwxrwx 1 marusich users 16 Dec 9 13:56 /tmp/myprofile -> myprofile-1-link
lrwxrwxrwx 1 marusich users 51 Dec 9 13:56 /tmp/myprofile-1-link ->
/gnu/store/l4vnx2fpi0b090bg7prjbq5hzlb3skpg-profile
[0] address@hidden:~/guix
$ ls -al /var/guix/gcroots/auto | grep myprofile
lrwxrwxrwx 1 root root 21 Dec 9 13:56 f2j55vpd15brhsqdwjzshwcxid1g8q9q ->
/tmp/myprofile-1-link
[0] address@hidden:~/guix
$
--8<---------------cut here---------------end--------------->8---
If you delete /var/guix/gcroots/auto/f2j55vpd15brhsqdwjzshwcxid1g8q9q,
liveness no longer flows through /tmp/myprofile-1-link because you've
removed the GC root, and the guix-daemon won't know about the profile in
/tmp. However, the profile is still there! You can still use coreutils
via /tmp/myprofile-1-link, even though coreutils might get garbage
collected. That isn't good.
In the case of a non-default profile like /tmp/myprofile, it's safe to
remove /tmp/myprofile and /tmp/myprofile-1-link directly (e.g., via "rm
/tmp/myprofile*"). When guix-daemon next runs GC, it will notice that
/var/guix/gcroots/auto/f2j55vpd15brhsqdwjzshwcxid1g8q9q is now broken,
and it will remove the broken symlink.
Maybe we could change
"You might also want to delete old non-default profiles in
/var/guix/gcroots/auto."
to
"You might also want to delete old non-default profiles pointed to by
the symlinks in /var/guix/gcroots/auto (broken symlinks in this
directory will be automatically removed)."
What do you think? I know I tend to write more verbose error messages,
but I just don't want to encourage people to shoot themselves in the
foot. If you can think of a better way to convey the message, that'd be
great. Maybe we should just say "don't delete the symlinks in the auto
directory"?
--
Chris