Ubuntu – “apt-get source” cannot find package but “apt-get install” and “apt-get cache” can find it

aptdebsquidUbuntu

I'm trying to download the source of a package but when I run

root@proxy:~# apt-get source squid3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Can not find version '3.3.8-1.1' of package 'squid3'
E: Unable to find a source package for squid3

It cannot be found. But when I run apt-cache search squid3 it finds it.

root@proxy:~# apt-cache search squid3
squid-cgi - Full featured Web Proxy cache (HTTP proxy) - control CGI
squid3 - Full featured Web Proxy cache (HTTP proxy)
squid3-common - Full featured Web Proxy cache (HTTP proxy) - common files
squid3-dbg - Full featured Web Proxy cache (HTTP proxy) - Debug symbols
squidclient - Full featured Web Proxy cache (HTTP proxy) - control utility

It works fine with apt-get install squid3 as well. I am using Ubuntu 11.04 server and this is my /etc/apt/sources.list

deb http://old-releases.ubuntu.com/ubuntu natty main restricted universe
deb http://old-releases.ubuntu.com/ubuntu natty-updates main restricted universe
deb http://old-releases.ubuntu.com/ubuntu natty-security main restricted universe
deb http://archive.canonical.com/ubuntu natty partner
deb http://ftp.us.debian.org/debian sid main
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all
deb http://archive.ubuntu.com/ubuntu natty universe
deb-src http://archive.ubuntu.com/ubuntu natty universe

I've apt-get updated many times. I have tried many different debs and have not found this error any where else.

Best Answer

The issue here is that your binary packages (deb) is not consistent with your source packages (deb-src). Since squid3 is from sid, add this line:

deb-src http://ftp.us.debian.org/debian sid main

This should fix it