尝试将 Ubuntu 从 16.04 更新到 18.02

尝试将 Ubuntu 从 16.04 更新到 18.02

每次运行命令sudo apt-get update或 时sudo apt upgrade,我都会收到以下错误消息:

W: The repository 'https://download.sublimetext.com apt/stable/ Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch https://download.sublimetext.com/apt/stable/Packages  server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
E: Some index files failed to download. They have been ignored, or old ones used instead.

我正在虚拟机(virtualbox)上工作

答案1

您的文件可能sources.list丢失,或者已被编辑。 Apt 和相关程序使用此文件来确定从何处下载软件包。默认情况下,该文件位于 /etc/apt/sources.list.

下面,我包含了该文件的默认内容sources.list,因为它是在版本 16.04 中,我发现这里

以 开头的每一行都deb指向 apt 使用的 ppa/repository 来检索二进制包。在库存文件中,每一行后面都应该紧接着其下方的另一行,看起来几乎相同,但以deb-src.这是所使用的源代码包的apt source存储位置。这些行共同提供了 的内容apt-cache。当您运行时sudo apt update,这些是 Apt 缓存更新的端点。当您使用 apt 下载内容时,这就是内容的来源。

#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

我猜测,如果您将其保存到文件中并diff与当前的文件进行比较sources.list,则会出现差异。从您提供的信息来看,您的副本似乎有一行引用https://download.sublimetext.com/apt/stable/Packages.修复错误的最简单方法可能是找到该行并通过添加主题标签将其注释掉('#') 到行的开头。如果您出于某种原因有理由保持该存储库处于活动状态,您可以在升级后通过删除主题标签来撤消此步骤。(假设在升级 apt 时升级不会重写文件。)对于文件中的任何“deb”或“deb-src”行。

保存后,您需要运行:

sudo apt-get update

以便容易注意到变化。您在此文件中所做的任何更改也是如此。

如果这不起作用,我建议添加一个'#'到还没有的每一行的开头,然后在其下方,将上面的库存内容复制并粘贴到其正下方。

这会将您的 ppa 恢复到库存配置并修复您的升级命令。注意

相关内容