Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

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

DPkg::Post-Invoke { "apt-get clean"; };

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.

share|improve this answer

Keep the pkgcache.bin and srcpkgcache.bin, you can safely delete the others. Don't touch the directories!

share|improve this answer
    
OK, thanks. I temporarily moved the *bin.* files to a backup folder. However, why does apt-get manages the cache inside the cache? A cache directory should be a temporary storage by nature. –  ysap Nov 28 '12 at 16:22
    
This issue is bugreported already. :) See here –  Frantique Nov 28 '12 at 16:23

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).

share|improve this answer
    
This should technically work, except you don't have full control of when apt runs. If you use something like this you need to make sure that you disable the "automated" tasks like cron jobs that run apt-get update. –  coteyr Nov 29 '12 at 15:22

I used

sudo apt-get autoclean

And I can recover my space a lot !

HTH Tawatchai S.

share|improve this answer
    
This answer did not actually address the question. The questioner has stated that they have started trying to use the apt-get clean process, but not removed as much from their directory as they feel is needed. –  Charles Green Jun 27 at 4:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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