I find a lot of old, mostly dpkg, files in /var/backups. Some over a year old. I see in a cron file where dpkg creates the files as backup, but don't see anywhere that they're ever removed. Shouldn't there be one?
12 Answers
I think you are referring to the files created by /etc/. It should only create 7 versions of each file. These 7 files can go back years because new files are only created if something changes.
The cron script show that the number of backups is hardcoded (therefore not configurable) and includes the comment
# Backup the 7 last versions of dpkg databases containing user data.
If you see more than 7 versions of the files then there is a bug in the script.
13.3 Installed Packages
There are two lists of installed packages available on Debian. The original file these lists are created from is
/var/lib/dpkg/status. This file must not be corrupted, or otherwise your system is hosed. This is the main database for the package managerdpkg.The Debian package system keeps an older copy from the last but one
dpkgrun in/var/lib/dpkg/status-old. In order to preserve the system for greater damage upon a crash or filesystem corrupting a daily backup of this file is created into/var/backupswhen the file differs from the last copy. The backup code is in/etc/.The informal list is created by the command
dpkg -lor by startingdselectand using the Select item. Or by using any of the other package manager front ends. This list consists of the name of the package (stripped down to some 40 characters), the installed version of each package and a short description. This is intended to be human readable.For technical purpose you can make
dpkgto generate a list of packages and their selection status (i.e.install,holdanddeinstall). This is created bydpkg --get-selections. This output is intended to be parsed by a program again, such asdpkg --set-selectionswhich will change the status of packages in its internal database. Thedselect-upgradeaction fromapt-get willinstall all new packages afterwards.
Shouldn't there be one?
It is better to have backups and not need then then not having backups and needing them. It is better left to the user then to automate it but that is just my opinion.