When I want to install a new package, I'm usually greeted with a response like:
oliver@cloud:~$ sudo apt-get install unison
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package unison
Already knowing this pattern, I continue:
oliver@cloud:~$ sudo apt-get update
Hit http://downloads-distro.mongodb.org dist Release.gpg
Ign http://downloads-distro.mongodb.org/repo/debian-sysvinit/ dist/10gen Translation-en
Ign http://downloads-distro.mongodb.org/repo/debian-sysvinit/ dist/10gen Translation-en_US
Hit http://downloads-distro.mongodb.org dist Release
Ign http://downloads-distro.mongodb.org dist/10gen amd64 Packages
Ign http://downloads-distro.mongodb.org dist/10gen amd64 Packages
Ign http://http.debian.net/debian/ squeeze/contrib Translation-en_US
Ign http://http.debian.net/debian/ squeeze/main Translation-en_US
Ign http://http.debian.net/debian/ squeeze/non-free Translation-en_US
...
oliver@cloud:~$ sudo apt-get install unison
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
unison
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 693 kB of archives.
If I want to install a new package tomorrow, the server will not know about it until I update again. I've only noticed this on Debian servers and I'm not aware of any adjustments that would cause this.
I understand the need for the local cache, my problem is that it seems to be reset whenever I want to install something new. I would expect the cache to stay populated for longer periods of time. Usually, when I would want to install something new the next day, apt-get will tell me it's unable to locate the package.
On this server, cron-apt is installed. I must assume it's installed by default. cron-apt is set to run nightly at 4:00. It seems to be responsible for my lost cache:
oliver@cloud:/var/lib/apt/lists$ sudo apt-get update
...
Fetched 12.1 MB in 11s (1,023 kB/s)
Reading package lists... Done
oliver@cloud:/var/lib/apt/lists$ ls /var/lib/apt/lists/ | wc -l
24
oliver@cloud:/var/lib/apt/lists$ sudo /usr/sbin/cron-apt
oliver@cloud:/var/lib/apt/lists$ ls /var/lib/apt/lists/ | wc -l
8
I'm not really sure why this is happening, because, from what I can tell, one of the jobs of cron-apt is to actually invoke apt-get update:
oliver@cloud:/var/lib/apt/lists$ cat /etc/cron-apt/action.d/0-update
update -o quiet=2

apt-get updatefrequently to update the list of available versions, but the list of available package names doesn't change often. Could you give an example of apt forgetting the name of a package? – Gilles Feb 14 at 23:50APT::Periodic::Enableset to 1? There's a nightly cron job (/etc/cron.daily/apt) that runsapt-get update. Have you tweaked your apt configuration? Has cron sent you emails from that job? Do files in/var/lib/apt/listsdisappear overnight? – Gilles Feb 14 at 23:56/etc/cron.daily/aptlists the defaults for all settings. The default forUpdate-Package-Lists(which controls ifapt-get updateis called) is0. On this server, there is only minimal config in/etc/apt/apt.conf.dand the setting is untouched. On my other systems, there's a10periodicor similar which setsUpdate-Package-Liststo1. – Oliver Salzburg Feb 15 at 0:14