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

7
  • 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, 2020 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. Dec 16, 2020 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. 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, 2020 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. Dec 16, 2020 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 <package_name>...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, 2020 at 22:33

1 Answer 1

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!

1
  • 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 7 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.