1

I'm downloading mongoDB on Linux Ubuntu Version 22.04.1 LTS, facing download error

I tried 3 solution from stack overflow discussion https://stackoverflow.com/questions/51417708/unable-to-install-mongodb-properly-on-ubuntu-18-04-lts, but still not work , keep facing

E: Unable to correct problems, you have held broken packages.

here are the 3 ways I tried:

(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.

I'm not sure what solution can perfectly solve my problem, that I need a hand here

more detail form beginning:

- 1.) I uninstall MongoDB, make sure no file or any stuff left

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

sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r/var/log/mongodb /var/lib/mongodb
service mongod status

result:

(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.) I tried the solution from discussion, first solution not work, still facing E: Package 'mongodb' has no installation candidate
(pic)I followed first solution -> failed

(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.) Tried second solution not work, still facing E: Unable to correct problems, you have held broken packages.

tired second way to install link- Install MongoDB Community Edition on Ubuntu 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

The second way last step I face
E: Unable to correct problems, you have held broken packages. I checked, I did't keep any file left

(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.

I list up all the file for what I have in linux cmd:
(pic) . list , ls for all the files

so is that I'm either facing
E: Package 'mongodb' has no installation candidate
or
E: Unable to correct problems, you have held broken packages.(I assum I checked and deleted mongo file before run this)
when I tried about 10 solutions from discussions

tried use jammy instead of focal in
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
(pic)result 01
(pic)result 02 still facing:

E: Unable to correct problems, you have held broken packages.

j ton
  • 131
  • 2
    Looks like you're trying to install a version of MongoDB that is incompatible with 22.04. Could you update your question to include the sources .list file that includes the MongoDB repository? This will make it easier to verify – matigo Oct 12 '22 at 04:47
  • MongoDB doesn't come with the default Ubuntu repositories. So, what instructions did you initially follow? – Terrance Oct 12 '22 at 05:23
  • hi @Terrance, I just update more details as possible in question, first of time I was make it simple. – j ton Oct 12 '22 at 06:13
  • hey @ matigo, I used ls, and ls -a in linux to list up all the files that I post in question, I don't think I have MongoDB repository, cause I checked by sudo rm -r /var/log/mongodb /var/lib/mongodb shows rm: cannot remove '/var/log/mongodb': No such file or directory rm: cannot remove '/var/lib/mongodb': No such file or directory – j ton Oct 12 '22 at 06:22
  • Since Linux Ubuntu Version 22.04.1 LTS is jammy, shouldn't you use jammy instead of focal. I.e., echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list – rickhg12hs Oct 12 '22 at 07:12
  • thanks @rickhg12hs, I didn't realize that, I think we are close to success – j ton Oct 12 '22 at 08:53
  • @fdu_account OK, cool! It does look like you are getting close. I was holding off updating an answer I wrote a long time ago. https://askubuntu.com/a/842599/231142 , as apt-key has been deprecated so the key that MongoDB supplies isn't ready for the new trusted=keyfile that is supposed to be used on the repo line deb [arch=amd64 trusted=keyfile] ... way of setting up the repos. I have been successful with still using apt-key, but that method will be going away, so I was looking for a more permanent solution. – Terrance Oct 12 '22 at 13:11
  • Looking at your new error messages you have the repo for Bionic still enabled. You need to remove that repo as you really should only have 1 repo active for MongoDB. Remove the Bionic one from /etc/apt/source.list.d/ directory then reupdate the sources with sudo apt update and then try your installation again. However, I do think that with MongoDB 6.0 it is under a different name now as it installs the server as mongos and not mongod like in the past. The installation name I think is still the same as mongodb-org for the apt name. – Terrance Oct 12 '22 at 17:39
  • @Terrance I'm confident that MongoDB executable names have not been changed with version 6.X. – rickhg12hs Oct 12 '22 at 18:21
  • thanks, I will try to do that – j ton Oct 13 '22 at 00:33
  • @rickhg12hs Actually, I was wrong on the install too. The Jammy repo for MongoDB does not have mongodb-org for install. You will have to use the Focal repo for mongod and version 6.0.2. – Terrance Oct 13 '22 at 00:35
  • @Terrance You're right! I just looked in the repo and there is no server. I wonder why. – rickhg12hs Oct 13 '22 at 00:54
  • I added on the 22.04 and version 6.0 install at the bottom of my answer: https://askubuntu.com/a/842599/231142 – Terrance Oct 13 '22 at 14:19
  • 1
    @rickhg12hs I really don't know why, but I am thinking that their repo for 6.0 and 22.04 is still under construction. I did add on to my answer in the link above how to make 6.0 work for 22.04 at this time. – Terrance Oct 13 '22 at 14:20

0 Answers0