Discussion:
Out of space, or how to clean /var/cache/apt/archives/ and get 150 GB space back?
(too old to reply)
miz
2017-12-31 04:46:22 UTC
Permalink
After unzip one large file get message out of space.
Looking around I find /var/cache/apt/archives/ with 150GB of files, even
files from 2008????

I did not have linux in 2008!!!

Also can't delete any of those files.

How to clean /var/cache/apt/archives/ folder and get 150 GB space back?
Wildman
2017-12-31 05:18:29 UTC
Permalink
Post by miz
After unzip one large file get message out of space.
Looking around I find /var/cache/apt/archives/ with 150GB of files, even
files from 2008????
I did not have linux in 2008!!!
Also can't delete any of those files.
How to clean /var/cache/apt/archives/ folder and get 150 GB space back?
Open a terminal and enter...

sudo apt-cache clean
--
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!
student
2017-12-31 05:50:41 UTC
Permalink
Post by Wildman
Post by miz
After unzip one large file get message out of space.
Looking around I find /var/cache/apt/archives/ with 150GB of files,
even files from 2008????
I did not have linux in 2008!!!
Also can't delete any of those files.
How to clean /var/cache/apt/archives/ folder and get 150 GB space back?
Open a terminal and enter...
sudo apt-cache clean
i need that too

but got

E: Invalid operation clean
Marcel Mueller
2017-12-31 09:41:24 UTC
Permalink
Post by student
Post by Wildman
sudo apt-cache clean
i need that too
but got
E: Invalid operation clean
Typo:

sudo apt-get clean
^^^

Marcel
Wildman
2017-12-31 16:34:28 UTC
Permalink
Post by Paul
Post by student
Post by Wildman
sudo apt-cache clean
i need that too
but got
E: Invalid operation clean
sudo apt-get clean
^^^
Marcel
Yep, my mistake. Should have been apt-get.
--
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!
Paul
2017-12-31 05:48:11 UTC
Permalink
Post by miz
After unzip one large file get message out of space.
Looking around I find /var/cache/apt/archives/ with 150GB of files, even
files from 2008????
I did not have linux in 2008!!!
Also can't delete any of those files.
How to clean /var/cache/apt/archives/ folder and get 150 GB space back?
There are examples of commands here.

https://askubuntu.com/questions/65549/var-cache-apt-archives-occupying-huge-space

"Seems like

sudo apt-get autoclean

is a better choice than

sudo apt-get clean

autoclean will only remove "useless" archives

From the man page:

Like clean, autoclean clears out the local repository of retrieved
package files. The difference is that it only removes package files
that can no longer be downloaded, and are largely useless. This allows
a cache to be maintained over a long period without it growing out
of control. The configuration option APT::Clean-Installed will prevent
installed packages from being erased if it is set to off.
"

Like you, I would be curious where the 2008 dates had come from.

And the size of your cache is astronomical.

*******

I recommend a backup before any dangerous operation, in
case you have second thoughts later. Yes, you're backing
up "150GB of useless files", but it's better to be safe
than sorry. This is why I have a (relatively small) 4TB
drive for backups.

Paul
Marcel Mueller
2017-12-31 09:39:00 UTC
Permalink
Post by Paul
https://askubuntu.com/questions/65549/var-cache-apt-archives-occupying-huge-space
"Seems like
sudo apt-get autoclean
AFAIK Ubuntu and probably the derived Mint also does this automatically
from time to time. So it is likely to be a no-op.

Just tested with Mint 17:
It removed only 4 files and I /never/ executed this command before.
Post by Paul
is a better choice than
sudo apt-get clean
So in the OPs case I would recommend to clear the entire cache.
No idea what's messing up the cache but when it is still not empty (or
small) after that it is time to erase the files manually:
sudo rm -rf /var/cache/apt/archives/*
Post by Paul
autoclean will only remove "useless" archives
True, but most of the other files are useless too. They only get reused
if you *install the same package twice* or force a reconfiguration of a
package. When do you do that at daily business?
Post by Paul
I recommend a backup before any dangerous operation, in
case you have second thoughts later. Yes, you're backing
up "150GB of useless files", but it's better to be safe
than sorry. This is why I have a (relatively small) 4TB
drive for backups.
Well, 4TB are not *that* small.


Marcel
Soviet_Mario
2017-12-31 14:47:39 UTC
Permalink
Post by Marcel Mueller
Post by Paul
https://askubuntu.com/questions/65549/var-cache-apt-archives-occupying-huge-space
    "Seems like
        sudo apt-get autoclean
AFAIK Ubuntu and probably the derived Mint also does this
automatically from time to time. So it is likely to be a no-op.
It removed only 4 files and I /never/ executed this command
before.
tried now, just for curiosity (I recently upgraded from
Sonya to Sylvia, if relevant).

Shrinked from 4,8 GB to 2,6 GB (1286 files removed from the
cache).

I hope dramatically not to have damaged sth ...

I used autoclean, not clean, though (which was said to be safer)
Post by Marcel Mueller
Post by Paul
     is a better choice than
        sudo apt-get clean
So in the OPs case I would recommend to clear the entire cache.
No idea what's messing up the cache but when it is still not
empty (or small) after that it is time to erase the files
  sudo rm -rf /var/cache/apt/archives/*
Post by Paul
     autoclean will only remove "useless" archives
True, but most of the other files are useless too. They only
get reused if you *install the same package twice* or force
a reconfiguration of a package. When do you do that at daily
business?
Post by Paul
I recommend a backup before any dangerous operation, in
case you have second thoughts later. Yes, you're backing
up "150GB of useless files", but it's better to be safe
than sorry. This is why I have a (relatively small) 4TB
drive for backups.
Well, 4TB are not *that* small.
I agree :)
Post by Marcel Mueller
Marcel
--
1) Resistere, resistere, resistere.
2) Se tutti pagano le tasse, le tasse le pagano tutti
Soviet_Mario - (aka Gatto_Vizzato)
Wildman
2017-12-31 16:44:55 UTC
Permalink
Post by Soviet_Mario
I hope dramatically not to have damaged sth ...
I used autoclean, not clean, though (which was said to be safer)
Clean and autoclean are equally safe. The only difference
is that clean removes all downloaded package files and
autoclean only removes the ones that can no longer be
downloaded (no longer in the repository). Either way,
the only reason package files are kept is they don't have
to be downloaded again if they need to be reinstalled.
Otherwise they just sit there taking up space.
--
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!
Marcel Mueller
2018-01-01 12:20:34 UTC
Permalink
Post by Marcel Mueller
AFAIK Ubuntu and probably the derived Mint also does this
automatically from time to time. So it is likely to be a no-op.
It removed only 4 files and I /never/ executed this command before.
tried now, just for curiosity (I recently upgraded from Sonya to Sylvia,
if relevant).
Shrinked from 4,8 GB to 2,6 GB (1286 files removed from the cache).
I just tested with Mint 18.3. In fact quite many files were deleted (in
contrast to Mint 17 Rosa). Now it takes 2,8 GB (didn't check before).

No idea where the difference come from. I also updated to 18.3 quite
recently.
I hope dramatically not to have damaged sth ...
No fear, the apt cache is quite useless in times of fast internet
connections. Even if you delete it completely nothing strange will happen.


Marcel

Dan Purgert
2017-12-31 12:29:39 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Paul
[...]
Like you, I would be curious where the 2008 dates had come from.
I have seen instances of files maintaining their *original* creation
time (rather than local creation time) when using stuff like rsync /
scp / etc.

I would imagine this is the same, with rather old packages that don't
get updated often (ever), because they're "good enough" -- stuff like
core GNU packages, or other "old but ubiquitous" type software.
Post by Paul
I recommend a backup before any dangerous operation, in
case you have second thoughts later. Yes, you're backing
up "150GB of useless files", but it's better to be safe
than sorry. This is why I have a (relatively small) 4TB
drive for backups.
Arguably, since it's the apt-cache, they're backed up on the internet
already. /var/cache/apt/archive is just where apt dumps everything it
downloads before installation (and it acts as a repository in case you
want to re-install something - don't have to re-download it).


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJaSNgKAAoJEI4R3fMSeaKBZN8H/A0yUB/NZIK0UCIzqeLn+dGV
oLO3MlfMFw83fw99MJHlf1VlS60sy9185tgNyZ0BLiRWqfcWsOWyJhTWuguVDga1
+4aYnL1XX02M2QDMAY8LIOKUyWabVCWi0n3Pdul3wwEzvqjZ+cwSmzUOt1h9KC3v
0bQ5I5DI7cETiJJTqrp7Lqayp//WZUGtVpIKfO0omfIxap9IkNcgZcwIkAQ7qojP
G5NMLXlCRhgTbvE9ICyrTPTWBJBMxvm23G9DEI73maI6H1CIlulgLdx1rUY2ydP5
vUJUrgQE8WqkzWaOWh/4gjNkwIUYzNb/WoP8S2m8LecpyeMJAr7d1Pu9oEJiVhU=
=HQCf
-----END PGP SIGNATURE-----
--
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
Caver1
2017-12-31 17:15:14 UTC
Permalink
Post by Dan Purgert
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Paul
[...]
Like you, I would be curious where the 2008 dates had come from.
I have seen instances of files maintaining their *original* creation
time (rather than local creation time) when using stuff like rsync /
scp / etc.
I would imagine this is the same, with rather old packages that don't
get updated often (ever), because they're "good enough" -- stuff like
core GNU packages, or other "old but ubiquitous" type software.
Post by Paul
I recommend a backup before any dangerous operation, in
case you have second thoughts later. Yes, you're backing
up "150GB of useless files", but it's better to be safe
than sorry. This is why I have a (relatively small) 4TB
drive for backups.
Arguably, since it's the apt-cache, they're backed up on the internet
already. /var/cache/apt/archive is just where apt dumps everything it
downloads before installation (and it acts as a repository in case you
want to re-install something - don't have to re-download it).
If you want the cache from getting so big;
In synaptic> Settings>Preferences>Files>Temporary Files
then you can choose delete downloaded packages after installation there
is also a button> Delete Cached Package Files.
--
Caver1
Loading...