當您想要在基於 Debian 的主機中安裝軟件包時,您可能會遇到“404 Not Found”錯誤。原因很明顯,下載軟件包的 URL 不再有效,因此出現 404。 例如,我在全新安裝 Debian 11 時嘗試安裝openssh-server. # sudo apt install openssh-server 錯誤如下所示: Err:1 http://deb.debian.org/debian bullseye/main amd64 openssh-sftp-server amd64 1:8.4p1-5 404 Not Found [IP: 199.232.150.132 80] Err:2 http://deb.debian.org/debian bullseye/main amd64 openssh-server amd64 1:8.4p1-5 404 Not Found [IP: 199.232.150.132 80] E: Failed to fetch http://deb.debian.org/debian/pool/main/o/openssh/openssh-sftp-server_8.4p1-5_amd64.deb 404 Not Found [IP: 199.232.150.132 80] E: Failed to fetch http://deb.debian.org/debian/pool/main/o/openssh/openssh-server_8.4p1-5_amd64.deb 404 Not Found [IP: 199.232.150.132 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-miss 解決方式: 1. 備份 repository 存儲庫來源清單 # cp /etc/apt/sources.list /etc/apt/sources.list.bak 2. 把內文的 https://deb.debian.org 改成 https://ftp.debian.org # sed -i 's/deb.debian.org/ftp.debian.org/g' /etc/apt/