嘗試將 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.修復錯誤的最簡單方法可能是找到該行並透過添加主題標籤將其註解掉('#') 到行的開頭。如果您出於某種原因有理由保持該儲存庫處於活動狀態,您可以在升級後透過刪除主題標籤來撤銷此步驟。 “deb”或“deb-src”行。

儲存後,您需要運行:

sudo apt-get update

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

如果這不起作用,我建議添加一個'#'到還沒有的每一行的開頭,然後在其下方,將上面的庫存內容複製並貼上到其正下方。

這會將您的 ppa 恢復到庫存配置並修復您的升級命令。注意

相關內容