1

On Lubuntu 18.04, I have installed mongodb, by following https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition

sudo apt install -y mongodb-org mongodb-org-server libcurl3

and now want to install curl

$ sudo apt install curl
Reading package lists... Done
Building dependency tree       
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:
 curl : Depends: libcurl4 (= 7.58.0-2ubuntu3.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I followed https://askubuntu.com/a/1051988/1471

you can use apt downgrade mechanism (thus, is not necessary to uninstall packages that depend of libcurl4).

apt install -y libcurl4=7.58.0-2ubuntu3
apt install -y curl

But then libcurl3 and mongodb were removed

$ sudo apt install -y libcurl4=7.58.0-2ubuntu3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  calibre-bin fonts-mathjax geoclue-2.0 iio-sensor-proxy libbrotli1 libchm1 libgeoclue-2-0 libjs-coffeescript libjs-mathjax libpodofo0.9.5 libqt5designer5 libqt5help5
  libqt5positioning5 libqt5sensors5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5webchannel5 libqt5webkit5 libqt5xml5 libwoff1 mongodb-org-mongos mongodb-org-shell
  mongodb-org-tools python-apsw python-asn1crypto python-bs4 python-cffi-backend python-chardet python-cherrypy3 python-cryptography python-cssselect python-cssutils
  python-dateutil python-dbus python-dnspython python-enum34 python-feedparser python-html5-parser python-html5lib python-idna python-ipaddress python-libxml2 python-lxml
  python-markdown python-mechanize python-msgpack python-netifaces python-olefile python-openssl python-pil python-pygments python-pyparsing python-pyqt5 python-pyqt5.qtsvg
  python-pyqt5.qtwebkit python-regex python-repoze.lru python-routes python-simplejson python-sip python-six python-utidylib python-webencodings python-webob python-yaml
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  libcurl3 mongodb-org mongodb-org-server
The following NEW packages will be installed:
  libcurl4
0 upgraded, 1 newly installed, 3 to remove and 0 not upgraded.
Need to get 214 kB of archives.
After this operation, 61.6 MB disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libcurl4 amd64 7.58.0-2ubuntu3 [214 kB]
Fetched 214 kB in 1s (419 kB/s)
(Reading database ... 235089 files and directories currently installed.)
Removing mongodb-org (4.0.0) ...
Removing mongodb-org-server (4.0.0) ...
Removing libcurl3:amd64 (7.58.0-2ubuntu2) ...
Selecting previously unselected package libcurl4:amd64.
(Reading database ... 235068 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3) ...
Setting up libcurl4:amd64 (7.58.0-2ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...

When I tried to install mongodb, then libcurl4 will be removed

$ sudo apt install -y mongodb-org mongodb-org-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  calibre-bin fonts-mathjax geoclue-2.0 iio-sensor-proxy libbrotli1 libchm1 libgeoclue-2-0 libjs-coffeescript libjs-mathjax libpodofo0.9.5 libqt5designer5 libqt5help5
  libqt5positioning5 libqt5sensors5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5webchannel5 libqt5webkit5 libqt5xml5 libwoff1 python-apsw python-asn1crypto python-bs4
  python-cffi-backend python-chardet python-cherrypy3 python-cryptography python-cssselect python-cssutils python-dateutil python-dbus python-dnspython python-enum34
  python-feedparser python-html5-parser python-html5lib python-idna python-ipaddress python-libxml2 python-lxml python-markdown python-mechanize python-msgpack python-netifaces
  python-olefile python-openssl python-pil python-pygments python-pyparsing python-pyqt5 python-pyqt5.qtsvg python-pyqt5.qtwebkit python-regex python-repoze.lru python-routes
  python-simplejson python-sip python-six python-utidylib python-webencodings python-webob python-yaml
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libcurl3
The following packages will be REMOVED:
  libcurl4
The following NEW packages will be installed:
  libcurl3 mongodb-org mongodb-org-server
0 upgraded, 3 newly installed, 1 to remove and 0 not upgraded.
Need to get 15.7 MB of archives.
After this operation, 61.6 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 libcurl3 amd64 7.58.0-2ubuntu2 [214 kB]
Get:2 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 mongodb-org-server amd64 4.0.0 [15.5 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 mongodb-org amd64 4.0.0 [3,518 B]                                                              
Fetched 15.7 MB in 25s (639 kB/s)                                                                                                                                                
(Reading database ... 235073 files and directories currently installed.)
Removing libcurl4:amd64 (7.58.0-2ubuntu3) ...
Selecting previously unselected package libcurl3:amd64.
(Reading database ... 235068 files and directories currently installed.)
Preparing to unpack .../libcurl3_7.58.0-2ubuntu2_amd64.deb ...
Unpacking libcurl3:amd64 (7.58.0-2ubuntu2) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../mongodb-org-server_4.0.0_amd64.deb ...
Unpacking mongodb-org-server (4.0.0) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../mongodb-org_4.0.0_amd64.deb ...
Unpacking mongodb-org (4.0.0) ...
Setting up libcurl3:amd64 (7.58.0-2ubuntu2) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up mongodb-org-server (4.0.0) ...
Setting up mongodb-org (4.0.0) ...

How shall I install both curl and mongodb

4
  • MongoDB 4.0.1 (just released today) adds support for Ubuntu 18.04. Can you try installing the new package: edit /etc/apt/sources.list.d/mongodb-org-4.0.list to include bionic instead of xenial and then apt-get update before installing mongodb-org-server. Attempting to install the 16.04 (xenial) packages on 18.04 (bionic) will result in a package conflict as per your output. – Stennie Aug 6 '18 at 21:11
  • Thanks. What is the command to install mongodb? Is it still sudo apt install -y mongodb-org mongodb-org-server libcurl3? I need libcurl4 – Tim Aug 6 '18 at 22:18
  • After you update to the bionic repo and apt-get update, you should be able to sudo apt-get install -y mongodb-org to install the MongoDB server and command line tools (or sudo apt-get install -y mongodb-org-server if you only need mongod). Don't include libcurl3 or other dependencies -- these should be handled by the package. – Stennie Aug 6 '18 at 22:53
  • 1
    The problem persist for Bionic (18.04). Any solution? – steffen Jun 18 '19 at 13:50
0

Another way to solve libraries dependencies issues is to use a docker container.

For example in that case, once docker-ce installed, you could run something like this :

docker run -d --name mongo-4.0.9  -p 127.0.0.1:27017:27017  --restart unless-stopped -v /var/lib/mongodb:/data/db mongo:4.0.9 

In that way, you do not depend on your system dependencies.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.