Ubuntu Deleting Cache Packages

Lately I noticed with my Ubuntu MATE 16.04 systems that after downloading and installing updates, the packages were deleted. This was a hit-and-miss observation. For a while I could not determine the cause.

I would benefit from running a centralized Ubuntu proxy package cache to maintain multiple Ubuntu systems. Some day I’ll do that. For now I have been content with a script I wrote to create a local repo, which I use to update remaining Ubuntu systems.

Having packages being deleted immediately after downloading and installing foiled the plan. Often I had to perform a --reinstall --download-only to recover the deleted packages so I could sync with my local repo.

The root cause turned out to be using apt rather than apt-get. Apparently apt defaults to Keep-Downloaded-Packages = false.

The solution for apt is:

echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/01keep-debs

Other solutions include using apt-get rather than apt or the GUI Ubuntu Software Updater.

I saw a similar developer decision with Fedora. I am guessing if these developers faced bandwidth usage caps they would not be so quick to delete files.

Posted: Category: Usability Tagged: General, Ubuntu

Next: Broken notify-send

Previous: Ubuntu Quirks