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

  • Open
  • quality assurance status badge
Details
4 participants
  • Ludovic Courtès
  • Pierre Neidhardt
  • Marius Bakke
  • zimoun
Owner
unassigned
Submitted by
Pierre Neidhardt
Severity
normal
P
P
Pierre Neidhardt wrote on 26 May 2020 15:22
(address . guix-patches@gnu.org)
20200526132219.27748-1-mail@ambrevar.xyz
* 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(-)

Toggle diff (34 lines)
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
--
2.26.2
L
L
Ludovic Courtès wrote on 28 May 2020 23:27
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 41538@debbugs.gnu.org)
874krzagy6.fsf@gnu.org
Pierre Neidhardt <mail@ambrevar.xyz> skribis:

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

[...]

Toggle quote (16 lines)
> - (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.

Toggle quote (4 lines)
> +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’.
P
P
Pierre Neidhardt wrote on 29 May 2020 11:29
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 41538@debbugs.gnu.org)
87wo4vf5sy.fsf@ambrevar.xyz
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (4 lines)
> ‘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! :)

Toggle quote (3 lines)
> 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"?

Toggle quote (8 lines)
>> +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?

Toggle snippet (4 lines)
You might also want to delete old non-default profiles returned by `guix
package --list-profiles`.

Cheers!

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7Q1d0ACgkQm9z0l6S7
zH+Dtgf+KqSCKWuxkCR9WZHwcDSkKgDCsvakKLivabmcjTiyF96LYKutr3GQGNbX
/9dgAOk2stc80HWmJUAirRXRu8sB5jvBsujFzwDPgZHmPM44+5Hi0RZPJBK/vLaj
94jON0/JgyD4nlyICX2PIlFVjuO5kfCLcdVQdeuv7csOukg8Kdny4pP7CyYdQ70z
r2WiYyua5zPx1XRFcjz7A6At6KSyttpp0oBkEDxDGHBU2T2R9J50GEEPiquS9thQ
yNBjv4qHcDGjg153PJpVbQm9xYJszO9JCee+uDfzgVYSXHNdfZXw4fCxSCzga/UC
CAgkIy9+zk24x3QNaMIB0oiJOFcyBQ==
=/ZAI
-----END PGP SIGNATURE-----

Z
Z
zimoun wrote on 29 May 2020 12:14
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 41538@debbugs.gnu.org)
CAJ3okZ2gQNpqi+cS8FX2Fk_wtvsndXhp8B9Yno+1Xa1g2jepeA@mail.gmail.com
Hi Pierre,

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

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

[...]

Toggle quote (2 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
L
L
Ludovic Courtès wrote on 29 May 2020 13:56
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)(address . 41538@debbugs.gnu.org)
87imgf3qfw.fsf@gnu.org
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

Toggle quote (16 lines)
> 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.

Toggle quote (13 lines)
>>> +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’.
P
P
Pierre Neidhardt wrote on 29 May 2020 18:38
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 41538@debbugs.gnu.org)
87367ig0i2.fsf@ambrevar.xyz
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (5 lines)
>> 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?

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7ROnUACgkQm9z0l6S7
zH90ZAf8CbJnjC3+jV12oXj2ZBlVJJBZRcqvODx8UzcHmKdtJOx0ZxKjhlrp3OBo
3D1LWSAPVO3LNhmsecenyMHPSKpCBvHnXXP7D15e4V7T0jz7FTXe3f2axfVxg0I5
Isxq/SGo5ssgCVE/5yMOyqkRS7UU7fwcicNcZqu0vYWg0KzBYYnwTzemSBLUYDLo
P/ddvrvuY2Q7VFrj3vz8edtvKsHB5hWS4jflTPgToCGyUJ8fEr8HE/Pf6AgP7TYD
1lI+OfHKTH+YEp0x73ntdicXdYv85WJsgGUs4vfRd/PBleT41RFXYQZc9CuNOlwo
eVV05YCy1SEggaBjw66rOfwM+UNEgg==
=aT6l
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 29 May 2020 20:48
(address . 41538@debbugs.gnu.org)
877dwu4lwl.fsf@gnu.org
Pierre Neidhardt <mail@ambrevar.xyz> writes:

Toggle quote (9 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl7RWRoACgkQoqBt8qM6
VPohOgf/fgSUrzvQPRQiHBmcKkshqotdVWUy0v7UAwEdWc+a9wVKf5mFg+OKxh0H
7LX0J6OTi8OdyIovxc6tx28aXeslbezBW3A+bh742HcmB9CPkEogltARqqDrif0H
AXKqLlZwzsvxs4fbH5E4GP6PHEt63hcL+LizeLbCcNCRD9iPapXpWhU9YDmzug5y
dFhYw6ExhSRT496s5B0StG0+HOuiJusEa+DGDDPP1cLkfg9z6iTIx09vs/deNsDc
YAJPQ/03fU5hLrUvnIpEtlU/ex+6mGkOE5YtyiQ3NzNSTWk+NHUIkGBbHrICf9T/
Wi4/WAww1XyAfi6JmoNL3QL7/abcXA==
=3uf+
-----END PGP SIGNATURE-----

P
P
Pierre Neidhardt wrote on 30 May 2020 11:03
(address . 41538@debbugs.gnu.org)
87d06ldcbj.fsf@ambrevar.xyz
Marius Bakke <marius@gnu.org> writes:

Toggle quote (5 lines)
> 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.

Toggle quote (4 lines)
> 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!

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7SIWAACgkQm9z0l6S7
zH9RQgf/Y7XPNLZXpCfyYyFAvjy0JVrwV7o0PwFpOUlQjr4iGVrjCI1z3mcs5iEd
89WV5RA87fWkKyTKZqrqh0/L4jwmtovBpvodOkpbd9J9FkkHZWUeD/OP85v5Kl//
7Qlp4YCHn7OmiBvl+5JJS58ajGEoqvytJDduiiUtcw0mCqQEE18BQ2hIXAQtKs5l
2jE+h9jXrFQ4a/n48lW99ftU9MMO3SSfh9FPuvrSVRI4yopAX561ln3xds34sFky
/YcnIsSqfM6pwqsxx1pCnFiDKf/ISC5Q90Z6C7AwpvRvuA4VqCe+B4NWg1UuKwg3
V9MixFsc/a0IGoqxGGDkkXsnnAi7qQ==
=6ABG
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 30 May 2020 16:05
(name . Pierre Neidhardt)(address . mail@ambrevar.xyz)
87y2p9tt51.fsf@gnu.org
Hi,

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

Toggle quote (17 lines)
> 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’.
P
P
Pierre Neidhardt wrote on 30 May 2020 17:55
(name . Ludovic Courtès)(address . ludo@gnu.org)
87tuzxbeno.fsf@ambrevar.xyz
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (4 lines)
> 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.

--
Pierre Neidhardt
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl7SggsACgkQm9z0l6S7
zH+PKQf+JZ4ozO3aV2XdR2R97z1KG3HuzlHYYmveo5uzpCkaeyOuKmgIaMBGG1TT
htVLd2g3HulcmPGzVXeA93vEW0GWdsgnQ1eoWgPK8jKfH94Nn6GlI55TrIdgB6/N
DVIJX/+BOehRRoK2piT0daJSSko0w7jmpkAo+tgY2VcWT1HhG7jVV9LFYCjBE8/4
qLLdqb5ZwIfsDIBNtDeJF6ZaEwraK5hG8rntH2MvtE0hsylr/X5jsZudJm7mEJuH
z7RvvqWamHRDpOZsXcb+x4VTTKTqKXyVphUHh30kZZBIHCzdkxKziTdvQ3LJxcqm
7oii4k1qtku+qSgQdXnJdaeW6Kprrg==
=VZPZ
-----END PGP SIGNATURE-----

?