1

I use synaptic to download first and install later.
Usually I install everything but core system files, that I leave to install later.
Synaptic button "delete cached package files" ignores the fact of many files not being installed yet.
By deprecated I mean older version of downloaded packages.
I have already tried apt-get autoclean and it is not what I need (it cleaned nothing actually...). clean option is also useless, it cleaned everything!

Can it be done with some simple command or I have to use some script to compare installed VS downloaded/old versions?

var/cache/apt/archives occupying huge space didn't help

I need to do it that way because of: https://unix.stackexchange.com/questions/624845/how-to-disable-and-re-enable-the-same-lvm-mirror-leg-only-to-update-system-core

Btw, now, for installed ones I am using: apt list --installed |sed -r 's"(.*)/.* (.*) (.*) .*"\1_\2_\3.deb"' |while read strFile;do strFile="echo "$strFile" |sed -r 's":"%3a"'";if [[ -f "$strFile" ]];then sudo rm -v $strFile;fi;done

Aquarius Power
  • 3,921
  • 6
  • 39
  • 67
  • Look at apt's `autoclean`. See `man apt-get`. Alternately, make a very minor change to your workflow: Clean your cache right after you finish installing all those core system updates. – user535733 Dec 16 '20 at 20:50
  • oh sorry, I have already tried `apt-get autoclean` and it is not what I need (it cleaned nothing actually...). clean option is also useless, it cleaned everything! Yep I enabled synaptic option but it will only work for new files not old ones. – Aquarius Power Dec 16 '20 at 20:58
  • If autoclean "cleaned nothing", then you don't seem to have any obsolete packages in your cache. That implies that you might be down the mistaken path of an [XY Problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Edit your question to clearly explain the actual problem you encounter that leads you to believe cleaning out the apt cache is a desirable solution. – user535733 Dec 16 '20 at 21:11
  • @user535733 I do have already installed for ex.: fluid-soundfont-gm_3.1-5.1_all.deb but autoclean did NOT clean it... My question is also about installed packages, not only old ones. – Aquarius Power Dec 16 '20 at 22:01
  • Correct: `fluid-soundfont-gm_3.1-5.1_all.deb` is ineligible for autoclean. It's the latest version; not obsolete, not "deprecated". You can `clean` it: `sudo apt clean ...but that leads you down the path of scripting a custom solution. Are you saying that your apt cache is simply too large? (how large is it?) – user535733 Dec 16 '20 at 22:33
  • it has 1GB and 1123 files, the only way I would have patience dealing with it would be thru a script :). My root has only 15GB and I need every 0.1GB I can recover and that cache is in the way... :/ – Aquarius Power Dec 19 '20 at 01:54
  • for installed I am using this: `apt list --installed |sed -r 's"(.*)/.* (.*) (.*) .*"\1_\2_\3.deb"' |while read strFile;do if [[ -f "$strFile" ]];then sudo rm -v "$strFile";fi;done` – Aquarius Power Dec 24 '20 at 02:16

1 Answers1

1

I wrote a tool (apt-deepclean) to manage this for us. It's available on github.

I run it once a day out of a cronjob. Our archives were over 20GB at one point!

  • Requires Perl module AptPkg, which is not present on Linux system by default and must be installed using `sudo apt-get install libapt-pkg-perl`. – Andrew P. Jun 07 '22 at 16:01