将 Ubuntu 16.04 更新至 18.04 后,使用“apt update”时出现错误

将 Ubuntu 16.04 更新至 18.04 后,使用“apt update”时出现错误

这些是错误消息:

Err:1 https://esm.ubuntu.com/infra/ubuntu xenial-infra-security InRelease
  Could not resolve host: esm.ubuntu.com
Err:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial InRelease
  Temporary failure resolving 'ppa.launchpad.net'
Err:3 http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu xenial InRelease
  Temporary failure resolving 'ppa.launchpad.net'
Err:4 https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates InRelease
  Could not resolve host: esm.ubuntu.com
Reading package lists... Done
W: Failed to fetch http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Failed to fetch http://ppa.launchpad.net/ubuntu-desktop/ubuntu-make/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'ppa.launchpad.net'
W: Failed to fetch https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-security/InRelease  Could not resolve host: esm.ubuntu.com
W: Failed to fetch https://esm.ubuntu.com/infra/ubuntu/dists/xenial-infra-updates/InRelease  Could not resolve host: esm.ubuntu.com
W: Some index files failed to download. They have been ignored, or old ones used instead.

答案1

步骤 1. 检查您的互联网连接。如果连接不好,请切换到本地镜像。同时检查您的设备是否正确设置以连接到互联网。

步骤2. 删除所有 PPA 并尝试sudo apt update && sudo apt full-upgrade

步骤 3. 尝试手动更改xenialbionic并将/etc/apt/sources.list中的所有文件更改etc/apt/sources.d为 ,然后sudo apt update。我之前没有尝试过这个,因为这是“debian 方式”,但它应该可以工作。不过,作为预防措施,您应该备份您的文件。

相关内容