4

How can I fix these APT repository errors? I'm using Debian GNU/Linux 9.13 (stretch). I'm looking to fix this update error and import the Docker GPG key.

root@test:~# apt-get update
Ign:1 http://security.debian.org stretch/updates InRelease
Err:2 http://security.debian.org stretch/updates Release
  404  Not Found [IP: 111.73.1113.145 90]
Get:3 https://download.docker.com/linux/debian stretch InRelease [44.8 kB]
Ign:4 http://ftp.de.debian.org/debian stretch InRelease
Err:5 http://ftp.de.debian.org/debian stretch Release
  404  Not Found
Err:3 https://download.docker.com/linux/debian stretch InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7PB0A8C2F192FFDM
Reading package lists... Done
E: The repository 'http://security.debian.org stretch/updates Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ftp.de.debian.org/debian stretch Release' does no longer have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://download.docker.com/linux/debian stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7PB0A8C2F192FFDM

root@test:~# apt-get install tree
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.1 kB of archives.
After this operation, 106 kB of additional disk space will be used.
Err:1 http://ftp.de.debian.org/debian stretch/main amd64 tree amd64 1.7.0-5
  404  Not Found
E: Failed to fetch http://ftp.de.debian.org/debian/pool/main/t/tree/tree_1.7.0-5_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I have this sources.list:

root@test:~# cat /etc/apt/sources.list
# deb http://ftp.de.debian.org/debian stretch main

deb http://ftp.de.debian.org/debian stretch main contrib non-free
deb-src http://ftp.de.debian.org/debian stretch main contrib non-free

deb http://security.debian.org/ stretch/updates main
deb-src http://security.debian.org/ stretch/updates main

# deb http://packages.dotdeb.org stretch all
# deb-src http://packages.dotdeb.org stretch all

As Docker is running on my VM is it safe to import the Docker GPG key?

3 Answers 3

10

The problem is because Debian 9/stretch moved to archive.debian.org.

See the post Debian stretch repositories 404 Not Found for solutions.

The answer by Luis Herrera recommends these commands :

replace deb.debian.org with archive.debian.org:

sudo sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list

replace security.debian.org with archive.debian.org/debian-security/:

sudo sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list 

remove line that contains source stretch-updates:

sudo sed -i '/stretch-updates/d' /etc/apt/sources.list

You may also do these changes using a text editor.

3
  • ok ,what should be the replacement from sources.list
    – sam23
    Commented May 3, 2023 at 18:46
  • 1
    In /etc/apt/sources.list, you need to : replace deb.debian.org with archive.debian.org and replace security.debian.org with archive.debian.org/debian-security/ and delete the line with stretch-updates.
    – harrymc
    Commented May 3, 2023 at 18:53
  • This finally work for me : deb [trusted=yes] archive.debian.org/debian stretch main non-free contrib deb-src [trusted=yes] archive.debian.org/debian stretch main non-free contrib deb [trusted=yes] archive.debian.org/debian-security stretch/updates main non-free contrib
    – sam23
    Commented May 4, 2023 at 16:25
0

This worked for me(as root):

echo "deb [trusted=yes] http://archive.debian.org/debian stretch main non-free contrib" > /etc/apt/sources.list
echo "deb-src [trusted=yes] http://archive.debian.org/debian stretch main non-free contrib" >> /etc/apt/sources.list
echo "deb [trusted=yes] http://archive.debian.org/debian-security stretch/updates main non-free contrib" >> /etc/apt/sources.list

You can just copy paste it. It will work even without a text editor installed. Obviously it will overwrite what is in your /etc/apt/sources.list so make sure to save what you had in case you need it.

Now you will be able to:

# apt update
# apt install vim
-2

It worked this way for me.

Edit /etc/apt/sources.list to match following:

deb http://archive.debian.org/debian stretch main
deb http://archive.debian.org/debian-security  stretch/updates main
1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 9 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .