在 apt-get update/get update 之後,我如何升級 ubuntu 20.04.6:請在升級之前安裝您的版本的所有可用更新?

在 apt-get update/get update 之後,我如何升級 ubuntu 20.04.6:請在升級之前安裝您的版本的所有可用更新?

我無法升級目前版本的 ubuntu 20.04.6,我想升級到最新版本,不確定這是否也是一個問題,但當我列出可升級時,我收到以下訊息:

sudo apt list –upgradable
Listing... Error!
E: input:0-13: error: Expected pattern
   –upgradable
   ^^^^^^^^^^^^^

然後我繼續執行這些命令:

**sudo apt-get update**
Hit:1 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease
Hit:2 http://gb.archive.ubuntu.com/ubuntu focal InRelease                      
Hit:3 http://gb.archive.ubuntu.com/ubuntu focal-updates InRelease              
Hit:4 http://gb.archive.ubuntu.com/ubuntu focal-backports InRelease            
Hit:5 http://security.ubuntu.com/ubuntu focal-security InRelease               
Get:6 http://packages.microsoft.com/repos/code stable InRelease [3,569 B]      
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease      
Hit:8 https://dl.google.com/linux/chrome/deb stable InRelease                  
Ign:9 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.1 InRelease
Ign:10 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 InRelease
Hit:11 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release
Err:12 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.1 Release
  404  Not Found [IP: 18.165.201.128 443]
Hit:13 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 Release
Reading package lists... Done
E: The repository 'https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.1 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.
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-small (multiverse/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en_GB) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-small (multiverse/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
**sudo apt-get upgrade -y**
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mongodb-mongosh
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
udo apt-get upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mongodb-mongosh
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
**sudo apt-get dist-upgrade**
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  mongodb-mongosh
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
**sudo do-release-upgrade**
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading. 
**sudo reboot.** 
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

我查了之前貼文的其他回覆:

apt-mark showhold
mongodb-mongosh

sudo apt full-upgrade
the only thing that didn't update was that mongodb-mongosh 

請幫忙

答案1

您的來源清單中有一個第三方儲存庫(主機名為 repo.mongodb.org)。此儲存庫無法在期間更新其套件索引apt udpate,並且隨後無法下載套件的更新。

無論如何,第三方儲存庫通常在發行升級期間被停用。我建議您找到該存儲庫(在/etc/apt/sources.list或中/etc/apt/sources.list.d/*)並將其註釋掉。然後重新運行 apt-update,它應該會忘記 mogodb 仍然需要更新。

如果 mongodb 中有重要數據,應該轉儲並備份,因為升級後可能需要從頭開始重新載入。

然後,升級後,要么使用 Ubuntu 附帶的 mongodb,要么從頭開始重新安裝存儲庫(URL 可能已更改),並採取任何必要的操作來恢復 mongodb 服務。

或者,如果您不使用 mongodb,您可以完全刪除該套件並進行更新。這可能會更乾淨,就好像您將其保留在系統上而不進行更新一樣,系統可能會保留對先前作業系統版本的依賴關係。有時這會導致衝突,有時它只會留下apt autoremove最終會出現的痕跡。

答案2

sudo apt list –可升級

你應該使用

apt list --upgradable

在 的輸出中sudo apt update,你得到

Err:12 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.1 Release
  404  Not Found [IP: 18.165.201.128 443]

這表示您新增的 mongodb 6.1 儲存庫在 Ubuntu 20.04 中不存在。

考慮刪除軟體和來源中的儲存庫。

相關內容