Debian apt-get update won't work
I have a Debian machine (Linux debian 2.6.32-5-amd64 #1 SMP Fri Feb 15 15:39:52 UTC 2013 x86_64 GNU/Linux
) running behind a NAT with a couple of ports forwarded for SSH and Web. I can access the web fine and I can also do DNS lookups fine.
The contents of my sources.list
deb http://ftp.br.debian.org/debian squeeze main
deb-src http://ftp.br.debian.org/debian squeeze main
deb http://ftp.br.debian.org/debian squeeze-updates main
deb-src http://ftp.br.debian.org/debian squeeze-updates main
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
When I try apt-get update I get the following
Ign http://security.debian.org squeeze/updates Release.gpg
Ign http://security.debian.org/ squeeze/updates/main Translation-en
Ign http://security.debian.org/ squeeze/updates/main Translation-en_GB
Ign http://security.debian.org squeeze/updates Release
Err http://security.debian.org squeeze/updates/main Sources
404 Not Found [IP: 195.20.242.89 80]
Err http://security.debian.org squeeze/updates/main amd64 Packages
404 Not Found [IP: 195.20.242.89 80]
Ign http://ftp.br.debian.org squeeze Release.gpg
Ign http://ftp.br.debian.org/debian/ squeeze/main Translation-en
Ign http://ftp.br.debian.org/debian/ squeeze/main Translation-en_GB
Ign http://ftp.br.debian.org squeeze-updates Release.gpg
Ign http://ftp.br.debian.org/debian/ squeeze-updates/main Translation-en
Ign http://ftp.br.debian.org/debian/ squeeze-updates/main Translation-en_GB
Ign http://ftp.br.debian.org squeeze Release
I gn http://ftp.br.debian.org squeeze-updates Release
Err http://ftp.br.debian.org squeeze/main Sources
404 Not Found [IP: 200.236.31.3 80]
Err http://ftp.br.debian.org squeeze/main amd64 Packages
404 Not Found [IP: 200.236.31.3 80]
Err http://ftp.br.debian.org squeeze-updates/main Sources
404 Not Found [IP: 200.236.31.3 80]
Err http://ftp.br.debian.org squeeze-updates/main amd64 Packages
404 Not Found [IP: 200.236.31.3 80]
W: Failed to fetch http://security.debian.org/dists/squeeze/updates/main/source/Sources.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://security.debian.org/dists/squeeze/updates/main/binary-amd64/Packages.gz 404 Not Found [IP: 195.20.242.89 80]
W: Failed to fetch http://ftp.br.debian.org/debian/dists/squeeze/main/source/Sources.gz 404 Not Found [IP: 200.236.31.3 80]
W: Failed to fetch http://ftp.br.debian.org/debian/dists/squeeze/main/binary-amd64/Packages.gz 404 Not Found [IP: 200.236.31.3 80]
W: Failed to fetch http://ftp.br.debian.org/debian/dists/squeeze-updates/main/source/Sources.gz 404 Not Found [IP: 200.236.31.3 80]
W: Failed to fetch http://ftp.br.debian.org/debian/dists/squeeze-updates/main/binary-amd64/Packages.gz 404 Not Found [IP: 200.236.31.3 80]
E: Some index files failed to download, they have been ignored, or old ones used instead.
Solution 1:
It looks like there are some issues either with the mirror server or with the network connection between the mirror server and your box. Please, have a look on the following Debian Sources Generator to get the default sources suitable for your release, repository and country.
Solution 2:
Now that Debian 6 (squeeze) has been put out to EOL (end of life) as of 2016, users have the additional complication of chasing down where the proper archival links are. The httpredir domain does not help to find this. I did a bit of digging and finally came up with a pattern that helps me to get a Debian 6 docker container updated.
# debian 6 - squeeze now relegated to old archive repos
RUN echo 'Acquire::Check-Valid-Until "false";' >/etc/apt/apt.conf.d/90ignore-release-date
RUN echo "deb http://archive.debian.org/debian-archive/debian squeeze main" > /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian-archive/debian squeeze-proposed-updates main" >> /etc/apt/sources.list
RUN echo "deb http://security.debian.org squeeze/updates main" >> /etc/apt/sources.list
RUN echo "deb http://archive.debian.org/debian-archive/debian squeeze-lts main contrib non-free" >> /etc/apt/sources.list
(remove the RUN part if you are entering this on the shell)
The Check-Valid-Until flag must be set to false because the archival squeeze-lts distro now exceeds the default max age and otherwise won't be loaded. (credit: Heisenberg - https://stackoverflow.com/questions/36080756/archive-repository-for-debian-squeeze)