apt cache chroot problem and fix
| url: | http://codehunk.wordpress.com/2009/06/25/apt_cache_problem_and_fix/ |
|---|
While creating a chroot jail on my machine(using debootstrap), i came across this weird problem with apt-get/aptitude cache, where apt-cache search was yielding an abnormally small subset of packages and apt-get/aptitude install was failing to find packages which i knew for sure existed in Debian package repositories.
Problem:
Snapshot of my /etc/apt/sources.list: deb http://ftp.us.debian.org/debian/ lenny main contrib non-free deb-src http://ftp.us.debian.org/debian/ lenny main contrib non-free deb http://security.debian.org/ lenny/updates main contrib non-free deb-src http://security.debian.org/ lenny/updates main contrib non-free deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free deb-src http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
I unsuccessfully tried apt-get/aptitude update/clean several times, and apt-cache search emacs still failed to yield any more than 7 packages. Actually it should have summed up to around 300 packages with main contrib and non-free repositories as sources.
Apparently, my debootstrap source being a locally mounted netinstall iso image had something to do with apt building bad caches, which subsequent apt-get updates failed to clear.
Solution:
The solution is to follow this procedure as root: # rm -rf /var/lib/apt # mkdir -p /var/lib/apt/lists/partial # touch /var/lib/apt/lists/lock # apt-get update
After this, apt-cache search emacs should yield around 300 packages. Try apt-cache search emacs | wc -l to confirm.
