Ubuntu 18.04.3 - when trying to uninstall mongodb says that it doesn't exist, when trying to install says it exists
I have been working on this and read a lot of articles. I am trying to get this working on my test server hosted by digital ocean. for some reason, out of seemingly nowhere the my server couldn't connect to Mongodb, so since it's a testing and after exhausting those resources I decided to delete and reinstall, However, whenever trying to remove mongodb it says that it doesn't exist: after running $ sudo apt-get purge mongodb mongodb-server mongodb-server-core mongodb-clients
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'mongodb' is not installed, so not removed
Package 'mongodb-clients' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies: mongodb-org : Depends: mongodb-org-server but it is not going to be installed Depends: mongodb-org-mongos but it is not going to be installed Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).so it says that it doesn't exist so after $ sudo apt-get install mongodb-org I get:
Reading package lists... Done
Building dependency tree
Reading state information... Done
mongodb-org is already the newest version (3.6.17).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies: mongodb-org : Depends: mongodb-org-server but it is not going to be installed Depends: mongodb-org-mongos but it is not going to be installed Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).I tried in both cases to do the apt --fix-broken install but to no avail.
when typing $ mongo I get
MongoDB shell version v3.6.17
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2020-03-31T18:26:22.472+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-03-31T18:26:22.472+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failedI read about unmasking, enabling, or any type of mongodb interactivity I get:
2020-03-31T18:26:22.472+0000: command not found
-bash: connect@src/mongo/shell/mongo.js:263:13: No such file or directory
@(connect):1:6: command not found
exception:: command not found
-bash: root@ubuntu-s-1vcpu-1gb-fra1-01:/home/name#: No such file or directoryI am performing all the same actions that previously did to access the db.... no clue WHAT happened.... thank you guys.
1 Answer
It seems that you've messed up your repositories by adding additional mongodb-org repository.
Try to comment out it's source in /etc/apt/sources.list.d/mongodb-org-4.2.list or similar file.
Then do sudo apt update && sudo apt install -f
Then try again: sudo apt install mongodb and so on.