Debian

如何通過 VPN 連接執行 apt update?

  • September 14, 2021

使用預設的 sources.list

deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main

deb http://deb.debian.org/debian-security/ bullseye-security main
deb-src http://deb.debian.org/debian-security/ bullseye-security main

deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

apt update未連接到 VPN 時工作正常,但連接到 VPN 後,和組件apt update超時:bullseye``bullseye-security

$ apt update
Get:1 http://deb.debian.org/debian bullseye InRelease [113 kB]
Err:1 http://deb.debian.org/debian bullseye InRelease
 Connection timed out [IP: 151.101.54.132 80]
Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Err:2 http://deb.debian.org/debian-security bullseye-security InRelease
 Connection timed out [IP: 151.101.54.132 80]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [36.8 kB]
Fetched 36.8 kB in 1min 1s (601 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease  Connection timed out [IP: 151.101.54.132 80]
W: Failed to fetch http://deb.debian.org/debian-security/dists/bullseye-security/InRelease  Connection timed out [IP: 151.101.54.132 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

如何apt update通過 VPN 連接執行?

似乎deb.debian.org比某些鏡像更嚴格的 VPN 阻止。更新您的 sources.list 以使用組件的本地鏡像bullseye組件的security子域security,可能會允許apt update繼續。例如,當連接到 VPN 時,以下 sources.list 在美國適用於我:

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

deb http://security.debian.org/debian-security/ bullseye-security main
deb-src http://security.debian.org/debian-security/ bullseye-security main

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

引用自:https://unix.stackexchange.com/questions/668951