In order for Apt to know about available packages, it needs a valid configuration in
/etc/apt/sources.list (usually this is initialized correctly when you install your distro) and it needs to successfully download the
Packages files from the configured network locations. Common error scenarios include
- Obsolete configuration. If you are attempting to use a distro which is no longer supported, the once-correct URLs in
/etc/apt/sources.list no longer work. The symptom is "File not found" errors or "No route to host" if the entire server has gone away.
- Firewall issues which prevent Apt from downloading the
Packages files, with similar symptoms. If you are able to connect to the Apt-configured locations from elsewhere, perhaps you need to use a proxy?
- Transient server errors which usually go away by themselves after a few minutes or hours.
- Failure to run
apt-get update. If the local copies of the
Packages files are too old, they will point to package versions which no longer exist in the archive on the server.
Less common but thinkable problem causes would be zapping the configuration files by mistake (restore from backup? Include enough information in your question so we can tell you the common defaults for your distro?), physical connectivity problems (the interface is up and you are able to connect to e.g. Google with
curl or similar?) and local disk problems (corrupted
Packages files? Disk mounted read-only?). If you installed from a DVD, it's also possible that only the DVD is configured in Apt as a package source.
For troubleshooting in more detail, any error message or other symptom would be useful for identifying the error, but understanding the system at this level is often sufficient for diagnosing it yourself.
A minor annoyance is that the configuration URLs are not plainly visible from the regular Apt output; the cofiguration looks like
deb http://example.net/path distribution section another
and Apt itself fills in some parts to construct a full URL path to one or more
Packages files on the server. With the
--print-uris option, you can see what exactly it's trying to fetch.