背景
安裝的ubuntu20.04.4,最小化安裝之后,執行update的時候顯示如下錯誤;
1 jo@jo-Lenovo-B41-80:sudo apt update 2 忽略:1 http://security.ubuntu.com/ubuntu focal-security InRelease 3 忽略:2 http://archive.canonical.com/ubuntu focal InRelease 4 忽略:3 http://cn.archive.ubuntu.com/ubuntu focal InRelease 5 錯誤:4 http://archive.canonical.com/ubuntu focal Release 6 SECURITY: URL redirect target contains control characters, rejecting. [IP: 91.189.91.15 80] 7 忽略:5 http://cn.archive.ubuntu.com/ubuntu focal-updates InRelease 8 錯誤:6 http://security.ubuntu.com/ubuntu focal-security Release 9 SECURITY: URL redirect target contains control characters, rejecting. [IP: 91.189.91.38 80] 10 忽略:7 http://cn.archive.ubuntu.com/ubuntu focal-backports InRelease 11 錯誤:8 http://cn.archive.ubuntu.com/ubuntu focal Release 12 SECURITY: URL redirect target contains control characters, rejecting. [IP: 91.189.91.38 80] 13 錯誤:9 http://cn.archive.ubuntu.com/ubuntu focal-updates Release 14 SECURITY: URL redirect target contains control characters, rejecting. [IP: 91.189.91.38 80] 15 錯誤:10 http://cn.archive.ubuntu.com/ubuntu focal-backports Release 16 SECURITY: URL redirect target contains control characters, rejecting. [IP: 91.189.91.38 80] 17 正在讀取軟件包列表... 完成 18 E: 倉庫 “http://archive.canonical.com/ubuntu focal Release” 沒有 Release 文件。 19 N: 無法安全地用該源進行更新,所以默認禁用該源。 20 N: 參見 apt-secure(8) 手冊以了解倉庫創建和用戶配置方面的細節。 21 E: 倉庫 “http://security.ubuntu.com/ubuntu focal-security Release” 不再含有 Release 文件。 22 N: 無法安全地用該源進行更新,所以默認禁用該源。 23 N: 參見 apt-secure(8) 手冊以了解倉庫創建和用戶配置方面的細節。 24 E: 倉庫 “http://cn.archive.ubuntu.com/ubuntu focal Release” 沒有 Release 文件。 25 N: 無法安全地用該源進行更新,所以默認禁用該源。 26 N: 參見 apt-secure(8) 手冊以了解倉庫創建和用戶配置方面的細節。 27 E: 倉庫 “http://cn.archive.ubuntu.com/ubuntu focal-updates Release” 沒有 Release 文件。 28 N: 無法安全地用該源進行更新,所以默認禁用該源。 29 N: 參見 apt-secure(8) 手冊以了解倉庫創建和用戶配置方面的細節。 30 E: 倉庫 “http://cn.archive.ubuntu.com/ubuntu focal-backports Release” 沒有 Release 文件。 31 N: 無法安全地用該源進行更新,所以默認禁用該源。 32 N: 參見 apt-secure(8) 手冊以了解倉庫創建和用戶配置方面的細節。
解決辦法
登陸https://mirrors.ustc.edu.cn/repogen/
根據系統找到對應的版本

cd到“sources.list”文件所在的目錄,將下載到的sources.list文件,復制到/etc/apt目錄下
jo@jo-Lenovo-B41-80:~/下載$ sudo cp sources.list /etc/apt
再次執行:sudo apt-get update
jo@jo-Lenovo-B41-80:~/下載$ sudo apt-get update 獲取:1 https://mirrors.ustc.edu.cn/ubuntu focal InRelease [265 kB] 獲取:2 https://mirrors.ustc.edu.cn/ubuntu focal-security InRelease [114 kB] 獲取:3 https://mirrors.ustc.edu.cn/ubuntu focal-updates InRelease [114 kB] 獲取:4 https://mirrors.ustc.edu.cn/ubuntu focal-backports InRelease [108 kB] 獲取:5 https://mirrors.ustc.edu.cn/ubuntu focal/main Sources [847 kB] ..... 獲取:124 https://mirrors.ustc.edu.cn/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B] 已下載 61.7 MB,耗時 1分 4秒 (961 kB/s) 正在讀取軟件包列表... 完成 jo@jo-Lenovo-B41-80:~/下載$
更新完成
