diff mbox series

[bug#41538] guix scripts: Mention Guix checkouts + gcroots/auto when warning about disk space.

Message ID 20200526132219.27748-1-mail@ambrevar.xyz
State New
Headers show
Series [bug#41538] guix scripts: Mention Guix checkouts + gcroots/auto when warning about disk space. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Pierre Neidhardt May 26, 2020, 1:22 p.m. UTC
* guix/scripts.scm (warn-about-disk-space): Mention Guix checkouts, system profiles and
gcroots/auto.
---
 guix/scripts.scm | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

Comments

Ludovic Courtès May 28, 2020, 9:27 p.m. UTC | #1
Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> * guix/scripts.scm (warn-about-disk-space): Mention Guix checkouts, system profiles and
> gcroots/auto.

[...]

> -      (display-hint (format #f (G_ "Consider deleting old profile
> -generations and collecting garbage, along these lines:
> +      (if profile
> +          (display-hint (format #f (G_ "Consider deleting old profile
> +generations, deleting old Guix checkouts and collecting garbage, along these
> +lines:
>  
>  @example
> -guix gc --delete-generations=1m
> -@end example\n"))))))
> +guix package --profile=~s --delete-generations=1m
> +guix pull --delete-generations=20d # Guix checkouts
> +guix system delete-generations=2..9 # System generations
> +guix gc --free-space=5G
> +@end example

‘guix gc --delete-generations=1m’ deletes generations of both
~/.guix-profile and ~/.config/guix/current.  (When running as root it
does that for all the users.)

I would not recommend ‘guix system delete-generations’ here because it’s
only accessible to root.

> +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).")

IMO hints should remain concise, and I’m afraid this might be too much.
Also, /var/guix/gcroots/auto is an implementation detail; I’d recommend
running ‘guix package --list-profiles’ instead.

WDYT?

Thanks,
Ludo’.
Pierre Neidhardt May 29, 2020, 9:29 a.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> ‘guix gc --delete-generations=1m’ deletes generations of both
> ~/.guix-profile and ~/.config/guix/current.  (When running as root it
> does that for all the users.)

Today I learned something! :)

> I would not recommend ‘guix system delete-generations’ here because it’s
> only accessible to root.

I still find it a useful tip because system generations may eat up a lot
of space and are easily forgotten.

What about adding "if you have root privileges"?

>> +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).")
>
> IMO hints should remain concise, and I’m afraid this might be too much.
> Also, /var/guix/gcroots/auto is an implementation detail; I’d recommend
> running ‘guix package --list-profiles’ instead.

Good point.  What about this then?

--8<---------------cut here---------------start------------->8---
You might also want to delete old non-default profiles returned by `guix
package --list-profiles`.
--8<---------------cut here---------------end--------------->8---

Cheers!
Simon Tournier May 29, 2020, 10:14 a.m. UTC | #3
Hi Pierre,

On Tue, 26 May 2020 at 15:23, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> +          (display-hint (format #f (G_ "Consider deleting old profile
> +generations, deleting old Guix checkouts and collecting garbage, along these
> +lines:

[...]

> +guix pull --delete-generations=20d # Guix checkouts

What do you mean by "checkouts"?

I understand delete old stuff under "~/.cache/guix/checkouts"; which
is not what you mean, I guess.

You mean "self Guix generations" or something like that, right?


Cheers,
simon
Ludovic Courtès May 29, 2020, 11:56 a.m. UTC | #4
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> ‘guix gc --delete-generations=1m’ deletes generations of both
>> ~/.guix-profile and ~/.config/guix/current.  (When running as root it
>> does that for all the users.)
>
> Today I learned something! :)
>
>> I would not recommend ‘guix system delete-generations’ here because it’s
>> only accessible to root.
>
> I still find it a useful tip because system generations may eat up a lot
> of space and are easily forgotten.
>
> What about adding "if you have root privileges"?

We could do that, but again people on “foreign distros” etc. could be
confused and overwhelmed.  I’d lean towards keeping it concise.

>>> +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).")
>>
>> IMO hints should remain concise, and I’m afraid this might be too much.
>> Also, /var/guix/gcroots/auto is an implementation detail; I’d recommend
>> running ‘guix package --list-profiles’ instead.
>
> Good point.  What about this then?
>
> You might also want to delete old non-default profiles returned by `guix
> package --list-profiles`.

SGTM!  (Use @command markup in the actual hint.)

Thanks,
Ludo’.
Pierre Neidhardt May 29, 2020, 4:38 p.m. UTC | #5
Ludovic Courtès <ludo@gnu.org> writes:

>> What about adding "if you have root privileges"?
>
> We could do that, but again people on “foreign distros” etc. could be
> confused and overwhelmed.  I’d lean towards keeping it concise.

So what about "# if it applies" instead?
Marius Bakke May 29, 2020, 6:48 p.m. UTC | #6
Pierre Neidhardt <mail@ambrevar.xyz> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> What about adding "if you have root privileges"?
>>
>> We could do that, but again people on “foreign distros” etc. could be
>> confused and overwhelmed.  I’d lean towards keeping it concise.
>
> So what about "# if it applies" instead?

I think newbie users might not know whether it applies or not.  Given
that 'guix gc --delete-generations' removes old generations of _all_
user profiles, perhaps we can just keep that instead of listing each of
the various ways to --delete-generations?

It looks a bit overwhelming to have to do all that just to make some
space in the store, especially when there is a single command to do all
of them.
Pierre Neidhardt May 30, 2020, 9:03 a.m. UTC | #7
Marius Bakke <marius@gnu.org> writes:

> I think newbie users might not know whether it applies or not.  Given
> that 'guix gc --delete-generations' removes old generations of _all_
> user profiles, perhaps we can just keep that instead of listing each of
> the various ways to --delete-generations?

I think this is not just about newbie users, but also a reminder of
the full list of what you have to go through to clean up your system
(including system profiles which take up a lot of space).
I've used Guix for a while now and I still frequently forget to clean up
either one of these profiles: Guix, default, non-defaults, system.

I think it's fine if the list has 4 items instead of 1: if the newcomer
does not understand everything, they'll move on.  Once they do
understand, they will be properly reminded to do it.

> It looks a bit overwhelming to have to do all that just to make some
> space in the store, especially when there is a single command to do all
> of them.

Does

  sudo guix gc --delete-duration=DURATION

delete all profiles including system profiles and non-default profiles?
If so, then it's fine but:

1. The user might not want to delete profiles of other users.
2. It requires root privileges.

Thoughts?

Cheers!
Ludovic Courtès May 30, 2020, 2:05 p.m. UTC | #8
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Marius Bakke <marius@gnu.org> writes:
>
>> I think newbie users might not know whether it applies or not.  Given
>> that 'guix gc --delete-generations' removes old generations of _all_
>> user profiles, perhaps we can just keep that instead of listing each of
>> the various ways to --delete-generations?
>
> I think this is not just about newbie users, but also a reminder of
> the full list of what you have to go through to clean up your system
> (including system profiles which take up a lot of space).
> I've used Guix for a while now and I still frequently forget to clean up
> either one of these profiles: Guix, default, non-defaults, system.
>
> I think it's fine if the list has 4 items instead of 1: if the newcomer
> does not understand everything, they'll move on.  Once they do
> understand, they will be properly reminded to do it.

I checked (guix scripts gc).  ‘guix gc -d’ operates on all the profiles
among the roots returned by ‘gc-roots’.  This is the same as what ‘guix
package --list-profiles’ returns so it includes non-standard profiles.
You can check on your machine.

It does not include non-profile GC roots, and in particular it does not
include system generations.

Deleting a system generation involves reinstalling the bootloader (or
its config file), so it cannot be done from ‘guix gc’, at least in its
current state.

In short, ‘guix gc -d’ was introduced precisely so that one doesn’t have
to search for all the profiles, and this hint was added in the same
patch series I think.  (So my earlier advice to mention ‘guix package
--list-profiles’ in the hint was actually misguided.)

The only things not handled are (1) the system, and (2) non-profile GC
roots.  I think it’s OK to not mention them in the hint because these
are kinda “advanced” features.

Thoughts?

Ludo’.
Pierre Neidhardt May 30, 2020, 3:55 p.m. UTC | #9
Ludovic Courtès <ludo@gnu.org> writes:

> The only things not handled are (1) the system, and (2) non-profile GC
> roots.  I think it’s OK to not mention them in the hint because these
> are kinda “advanced” features.

Do we have a place where we recommend how to clean up the store?
I'm not sure we ever explain how to remove non-profile GC roots.
diff mbox series

Patch

diff --git a/guix/scripts.scm b/guix/scripts.scm
index 3e19e38957..c90c3b840c 100644
--- a/guix/scripts.scm
+++ b/guix/scripts.scm
@@ -241,11 +241,23 @@  THRESHOLDS is a pair (ABSOLUTE-THRESHOLD . RELATIVE-THRESHOLD)."
                             absolute-threshold-in-bytes))
       (warning (G_ "only ~,1f GiB of free space available on ~a~%")
                (/ available 1. GiB) (%store-prefix))
-      (display-hint (format #f (G_ "Consider deleting old profile
-generations and collecting garbage, along these lines:
+      (if profile
+          (display-hint (format #f (G_ "Consider deleting old profile
+generations, deleting old Guix checkouts and collecting garbage, along these
+lines:
 
 @example
-guix gc --delete-generations=1m
-@end example\n"))))))
+guix package --profile=~s --delete-generations=1m
+guix pull --delete-generations=20d # Guix checkouts
+guix system delete-generations=2..9 # System generations
+guix gc --free-space=5G
+@end example
+
+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).")
+                                profile))
+          (display-hint (G_ "Consider running @command{guix gc} to free
+space."))))))
 
 ;;; scripts.scm ends here