下载 mongoDB 时出现错误“E:无法更正问题,您持有损坏的包。”

下载 mongoDB 时出现错误“E:无法更正问题,您持有损坏的包。”

我正在下载 mongoDBLinux Ubuntu 版本 22.04.1 LTS,面临下载错误

我尝试了 Stack Overflow 讨论中的 3 个解决方案https://stackoverflow.com/questions/51417708/unable-to-install-mongodb-properly-on-ubuntu-18-04-lts,但仍然不起作用,继续面对

E:无法纠正问题,您持有破损的包裹。

以下是我尝试过的 3 种方法:

(base) joy@joy-System-Product-Name:~$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

我不确定什么解决方案可以完美解决我的问题,我需要帮助

更多详细信息请见开头:

- 1.) 我卸载了 MongoDB,确保没有文件或任何残留

https://www.mongodb.com/basics/uninstall-mongodb

sudo 服务 mongod 停止
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb /var/lib/mongodb
服务 mongod 状态

结果:

(base) joy@joy-System-Product-Name:~$ sudo rm -r /var/log/mongodb /var/lib/mongodb
rm: cannot remove '/var/log/mongodb': No such file or directory
rm: cannot remove '/var/lib/mongodb': No such file or directory
(base) joy@joy-System-Product-Name:~$ service mongod status
Unit mongod.service could not be found.

- 2.) 我尝试了讨论中的解决方案,第一个解决方案不起作用,仍然面临E: Package 'mongodb' has no installation candidate
(图片)我按照第一个解决方案操作,但失败了

(base) joy@joy-System-Product-Name:~$ sudo apt-get purge mongodb-org*
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
...                         ...
... I skip a lot(Done) here ...
...                         ...
0 upgraded, 0 newly installed, 0 to remove and 96 not upgraded.     
   
(base) joy@joy-System-Product-Name:~$ sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package mongodb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'mongodb' has no installation candidate

- 3.) 尝试了第二种解决方案,但不起作用,仍然面临E: Unable to correct problems, you have held broken packages.

第二种安装方式 - 在 Ubuntu 上安装 MongoDB 社区版 https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

我检查了最后一步
E: Unable to correct problems, you have held broken packages. ,发现没有留下任何文件

(base) joy@joy-System-Product-Name:~$ sudo apt-get install -y mongodb-org
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-org-mongos : Depends: libssl1.1 (>= 1.1.1) but it is not installable
 mongodb-org-server : Depends: libssl1.1 (>= 1.1.1) but it is not installable
E: Unable to correct problems, you have held broken packages.

我列出了 Linux cmd 中所有我拥有的文件:
(图片). listls所有文件

所以我要么面临
E: Package 'mongodb' has no installation candidate
或者
E: Unable to correct problems, you have held broken packages.(我假设我在运行之前检查并删除了 mongo 文件)
当我尝试了大约 10 个来自讨论的解决方案时

尝试使用jammy而不是focal
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
(图)结果 01
(图)结果 02 仍然面临:

E:无法纠正问题,您持有破损的包裹。

相关内容