6

I use Ubuntu 20.04.1 and trying to install cURL. When I run sudo apt install curl in the terminal I get an error of:

The following packages have unmet dependencies: curl : Depends: libcurl4 (= 7.68.0-1ubuntu2) but 7.68.0-1ubuntu2.2 is to be installed
E: Unable to correct problems, you have held broken packages.

I have tried to follow this slightly similar solution unsuccessfully.
This is the screenshot of the error as it appears in my computer:

screenshot of my error

Output of apt-cache policy curl libcurl4:

curl: 
  Installed: (none) 
  Candidate: 7.68.0-1ubuntu2 
  Version table: 
     7.68.0-1ubuntu2 500
     500 us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
libcurl4:
  Installed: 7.68.0-1ubuntu2.2
  Candidate: 7.68.0-1ubuntu2.2
  Version table: 
 *** 7.68.0-1ubuntu2.2 100
        100 /var/lib/dpkg/status 
     7.68.0-1ubuntu2 500
        500 us.archive.ubuntu.com/ubuntu focal/main amd64 Packages 
Kulfy
  • 17,696
  • 1
    You must have done something strange prior to this... here is my 20.04, and curl untouched / via upgrade (if that has happened):
    $ curl --version -> 7.68.0-1ubuntu2.2 => Did you apt get uninstall it?
    – Hannu Nov 23 '20 at 17:15
  • $ dpkg --list | grep libcurl => libcurl3-gnutls:amd64 and libcurl4:amd64 both with version 7.68.0-1ubuntu2.2 (Ubuntu 20.04.1 LTS) – Hannu Nov 23 '20 at 17:23
  • @Kulfy True. Here is the new output after running you command. curl: Installed: (none) Candidate: 7.68.0-1ubuntu2 Version table: 7.68.0-1ubuntu2 500 500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages libcurl4: Installed: 7.68.0-1ubuntu2.2 Candidate: 7.68.0-1ubuntu2.2 Version table: *** 7.68.0-1ubuntu2.2 100 100 /var/lib/dpkg/status 7.68.0-1ubuntu2 500 500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages – Charleskimani Nov 23 '20 at 17:26
  • @Kulfy See the image of the output here: https://slack-files.com/T98GZSJPR-F01FCCLSZPU-cadaad34a2 – Charleskimani Nov 23 '20 at 17:32
  • @Hannu I have run the command dpkg --list | grep libcurl - see this image of what I get https://slack-files.com/T98GZSJPR-F01EXLFS571-75f602694e
    That: ii libcurl3-gnutls:amd64 7.68.0-1ubuntu2.1 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour) ii libcurl4:amd64 7.68.0-1ubuntu2.2 amd64 easy-to-use client-side URL
    – Charleskimani Nov 23 '20 at 17:37
  • 1
    https://askubuntu.com/a/1134120/289138 <- might this work!? – Hannu Nov 23 '20 at 17:38
  • @Hannu I have apache2 in my computer, is there a way to remove libcurl14 alone, because I wouldn't love to unistall my apache server. When I run sudo apt remove libcurl4 I get this : https://slack-files.com/T98GZSJPR-F01FJJBC36G-8c34af6396 – Charleskimani Nov 23 '20 at 17:47
  • @Hannu That: The following packages will be REMOVED: apache2 apache2-bin atom libapache2-mod-php libapache2-mod-php7.4 libcurl4 – Charleskimani Nov 23 '20 at 17:54
  • @Hannu Thanks alot – Charleskimani Nov 23 '20 at 18:04

2 Answers2

3

You actually have libcurl4 from focal-updates while APT is trying to install cURL from focal since you don't have focal-updates updates enabled (anymore?). At this point you have 2 options. Either enable focal-updates repository or install libcurl4 from focal.

  1. To enable focal-updates, run

    echo "deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
    

    Once done, run sudo apt update and retry installing cURL.

  2. To install libcurl4 from focal, simply run

    sudo apt install libcurl4=7.68.0-1ubuntu2
    

    Retry installing cURL.

The later one might not work if you have packages dependent on installed libcurl4, i.e., version 7.68.0-1ubuntu2.2.

Kulfy
  • 17,696
1

Please run this command in terminal

sudo snap install curl  # version 7.84.0  

or

sudo apt  install curl  # version 7.68.0-1ubuntu2.13
Artur Meinild
  • 26,018