curl is not working on Ubuntu 18.04 LTS

I can't fetch content from the web using `curl. I tried to install it and got the output below:

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) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I've checked for held packages both with sudo apt-mark showheld and dpkg -l | grep ^h, but I get no results either way.

Also, when I attempt to install libcurl4, it almost breaks my system, since it attempts to remove these packages:

libcurl3 mongodb-enterprise mongodb-enterprise-server mongodb-enterprise-tools msodbcsql msodbcsql17 mssql-tools php7.1-curl r-base r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-codetools r-cran-foreign r-cran-getopt r-cran-kernsmooth r-cran-lattice r-cran-littler r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-recommended slack-desktop virtualbox-5.2

Edit

This is the output of cat /etc/apt/sources.list:

# See for how to upgrade to
# newer versions of the distribution. deb bionic main restricted deb-src bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution. deb bionic-updates main restricted deb-src bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team. deb bionic universe deb-src bionic universe
deb bionic-updates universe
deb-src bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team. deb bionic multiverse deb-src bionic
multiverse
deb bionic-updates multiverse
deb-src bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb-src bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users. deb bionic partner deb-src bionic partner
deb bionic-security main restricted
deb-src bionic-security main
restricted
deb bionic-security universe deb-src bionic-security universe
deb bionic-security multiverse
deb-src bionic-security multiverse
deb bionic-proposed main
multiverse universe restricted #Not for humans during development
stage of release bionic
# ded-src trusty-backports main restricted ui=niverse
deb bionic-backports main
restricted multiverse universe
9

5 Answers

This problem is common in multiple packages in ubuntu recent LTS. Preinstalled packages have a possible error in version convention because "18.04" and other strings referencing repo are considering as part of the package version and not reference to the repo.
The workaround is uninstall preinstalled dependency and then reinstall. After that, you can install cURL.

apt remove -y libcurl4
apt install -y libcurl4 curl

Other packages with that problem are okular and libsdl2, and the solution is the same, track problematic dependencies, remove and reinstall.

Also, 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

Install curl from source. That worked for me.

git clone
cd curl
./buildconf
./configure
make
make test # optional
sudo make install

Try to use

sudo apt install libcurl4-openssl-dev

If you get any errors, try the commands below and then the above command again.

sudo apt update
sudo apt remove libcurl4
1

To start a clean slate first clean you packages:

sudo apt autoremove
sudo apt remove libcurl4

Then you install libcurl4 and curl

apt install -y libcurl4 curl

Install libcurl4 by using sudo apt-get install libcurl4 then, Install curl by using sudo apt-get install curl

If you get "CURL_OPENSSL_4 not found error" then, remove "/usr/lib/x86_64-linux-gnu/libcurl.so.4" file by using following command:sudo rm /usr/lib/x86_64-linux-gnu/libcurl.so.4

Create softlink again by using following command :sudo ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0 /usr/lib/x86_64-linux-gnu/libcurl.so.4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like