On an embedded system with a very limited disk space I have the folder /var/cache/apt
full with some 700MB of srcpkgcache.bin.*
and a couple of large *.bin
files.
Performing sudo apt-get clean
did not make a visible difference.
Is it safe to manually delete these *.bin*
files?
Not really. Those files help your system determine what is available and what isn't. Emptying that directory will result in a broken apt-get system. Here are a couple of tips.
First, auto clean
add a
to the end of
/etc/apt/apt.conf
. It will make apt and dpkg processes take longer, but will make it so your cache directory is always clean.Next, Remove archives
Start by removing and disabling all source archives (that your not using). On an embedded system you likely don't need them. Next remove all the archives that are not in use. You can run
apt-cache policy
to figure out what repo a package is coming from if your not sure.More Removal of archives
Some PPAs are horrid about having huge number of packages in them when you only need 1 or 2. Try disabling those PPAs and just installing the deb files manually. You save space in those cases, but you loose auto update. Keep in mind that dpkg will handle dependencies, so you can still install thing-with-tons-of-deps.deb then run
apt-get -f install
to fetch the dependencies.Totally Extreme Answer 1
Because were talking about an embedded system, 90% of the main repos won't do you any good. To handel this you could run your own apt-get repo server See this link. It's not easy, and it's a PIA for just one machine. But if you have several of these machines it's totally worth it. (You apt repo server can host just a subset of packages that you actually use. You don't need to mirror the whole thing)
Totally Extreme Answer 2
If space is really that large of an issue, then you can disable apt all together and revert to manually installing via dpkg. I have had to do this on several embedded systems. It works, but it's an admin nightmare.
You can of course delete
pkgcache.bin
andsrcpkgcache.bin
, nothing happens. Just runapt-get update
to re-create them.Keep the
pkgcache.bin
andsrcpkgcache.bin
, you can safely delete the others. Don't touch the directories!You can of course create a NFS-share (network filesystem) for this. Leave these files on a server and mount the share only when you want to update/install packages. In embedded environments, the installation will usually be relatively static anyway.
sshfs is another good option, is much easier to set up (basically only requires SSH which is standard), but it has more overhead (slower).