:: Re: [DNG] Advice to migrate from Be…
Forside
Slet denne besked
Besvar denne besked
Skribent: Olaf Meeuwissen
Dato:  
Til: Florian Zieboll
CC: dng
Emne: Re: [DNG] Advice to migrate from Beowulf to Chimaera
Hi Florian, Alessandro,

Florian Zieboll via Dng writes:

> On Mon, 19 Apr 2021 13:10:49 +0200
> Alessandro Vesely via Dng <dng@???> wrote:
>
>> Isn't there a way to remove
>> packages not used for more than one year?
>
> Definitely not an approach for automated package removal, but perhaps a
> valid starting point for decluttering manually:
>
> $ find /usr/bin -atime +360 | xargs -l1 apt-file find | sort


I hadn't thought of that approach but rather than look at use (for some
definition of use), I like to use apt-mark and a judicious set of APT
options to keep my systems free of stuff I don't need.

That goes a bit like this

sudo apt-mark auto $(apt-mark showmanual)

followed by looking at what

sudo apt auto-remove

would like to get rid of. Make sure to say 'n'!
Based on the list of potential removals, I

sudo apt-mark manual <list packages I want to keep>

After iterating a couple of times until I'm happy with the list of stuff
that will be removed I finally say 'y' so apt zaps the stuff I don't
want/need.

The first time around, there will be quite a long list of packages that
are candidates for removal. Even without a desktop environment
installed the list can be several tens of packages. Look for the
"top-level" kind of packages to `apt-mark manual`, things like
task-xfce-desktop, so you don't have to add a long list of packages.
You can `apt-mark auto` them later and fine-tune your list of manually
installed packages.

# This is how I whittle down the list of xserver-xorg-video-* packages
# that I really need :-)

Doing this in phases also gives you a bit of an opportunity to recover
from mistakes when you remove a package you actually need without
realizing it. Check the /var/log/apt/history.log* files to see what you
removed recently if stuff breaks.

Options that you might want to pass to that apt auto-remove invocation

-o APT::AutoRemove::SuggestsImportant=false
-o APT::AutoRemove::RecommendsImportant=false
-o APT::Get::Purge=true

# Add them to /etc/apt/apt.conf if you want to use these by default.

The first is pretty benign. It just removes those packages that are
only kept installed because some package has a Suggests: dependency on
it. Of course, you might want to keep it. In that case, just say

sudo apt-mark manual <package you want to keep>

The second option is similar but ups the ante a bit and tries to get rid
of packages that are only installed because they are recommended. As
for the Suggests:, use apt-mark manual to keep stuff you want/need and
get rid of the rest.

The third and final option makes sure any configuration files are
removed as well. I keep mine version controlled with etckeeper so
zapping config files is typically not an issue for me. The git repo has
a copy that I can resurrect as needed. If you do not have backups of
configuration files that might be removed, you're probably better of not
using this option.

Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join