在 ubuntu 20.04 上执行 Sudo apt-get update 时出现 *错误*

在 ubuntu 20.04 上执行 Sudo apt-get update 时出现 *错误*

我最近刚刚在电脑上安装了 Ubuntu 20.04。当我尝试在新终端中执行 sudo apt-get update 时,出现了以下错误:

Hit:1 http://ppa.launchpad.net/git-core/ppa/ubuntu trusty InRelease            
Err:2 http://my.old-releases.ubuntu.com/ubuntu focal InRelease                 
  Could not resolve 'my.old-releases.ubuntu.com'
Ign:3 http://old-releases.ubuntu.com/ubuntu focal-security InRelease
Err:4 http://old-releases.ubuntu.com/ubuntu focal-security Release
  404  Not Found [IP: 91.189.91.123 80]
Err:5 http://my.old-releases.ubuntu.com/ubuntu focal-updates InRelease
  Could not resolve 'my.old-releases.ubuntu.com'
Err:6 http://my.old-releases.ubuntu.com/ubuntu focal-backports InRelease
  Could not resolve 'my.old-releases.ubuntu.com'
Reading package lists... Done
E: The repository 'http://old-releases.ubuntu.com/ubuntu focal-security Release' does not 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.

我该如何纠正这个错误?谢谢,期待您的答复。

答案1

Ubuntu 20.04 LTS (focal) 是实际版本,因此其软件包位于档案, 不是旧版本。您可以使用以下命令修复此问题:

sudo sed -i "s/my.old-releases/archive/g" /etc/apt/sources.list /etc/apt/sources.list.d/*.list
sudo sed -i "s/old-releases/archive/g" /etc/apt/sources.list /etc/apt/sources.list.d/*.list

然后通过以下方式更新包列表

sudo apt-get update

相关内容