"curl : Depends: libcurl4 (= 7.61.0-1ubuntu2.2) but it is not going to be installed" on Ubuntu 18.10 with PHP 7.2.10

15,418

Solution 1

The problem: When preparing your dist-upgrade, looks like you made mistakes:

  • You failed to disable a 17.10 repository.
  • You failed to uninstall non-Ubuntu software, and did not disable those PPAs.

Now you are stuck with a mixture of wrong-version packages which are (understandably) blocking apt. We would usually call this a partial or incomplete upgrade. All this information is from the output you provided.

The solution: You have two options:

  1. Clean up the mess.

    • Uninstall all PPA and other non-Ubuntu software, and disable the sources they came from.
    • Disable the 17.10 repo.
    • Then run an apt update and then an apt dist-upgrade to get you as close to stock 18.10 as possible.
    • Then, one by one, start adding back non-Ubuntu sources and software.
  2. If you don't know how to do #1, then preserve your data and do a clean-install of 18.10.

Solution 2

SIMPLE SOLUTION: (worked for me)

sudo apt remove libcurl4
sudo apt install curl

Solution 3

After I removed the package libcurl4, my apache stopped starting and shows error 502. Be careful when removing this package.

Share:
15,418
Mustafa Taheri
Author by

Mustafa Taheri

Updated on September 18, 2022

Comments

  • Mustafa Taheri
    Mustafa Taheri over 1 year

    I am struggling with installing cURL module in Ubuntu 18.10. While upgrading from 17.10 to 18.10 cURL was removed/deleted. Now when I try to execute the command

    sudo apt-get install php7.2-curl
    

    I get this error:

    The following packages have unmet dependencies:
      php7.2-curl :
      Depends: libcurl4 (>= 7.44.0) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    sudo apt-get install curl
    

    gives the error

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

    Content List of my /etc/apt/sources.list.d/

    output of apt-cache policy php7.2-curl curl libcurl4

    Output of apt update and apt dist-upgrade

    Other Software List

  • Mustafa Taheri
    Mustafa Taheri over 5 years
    can you please suggest how can this be fixed by 1st option as I can't install fresh 18.10. Please tell me the sequence of commands so that I can clear this mess.
  • user535733
    user535733 over 5 years
    If you cannot clean-install 18.10, the you must keep your system packages clean, release-upgrade on schedule, and other basic maintenance. Bad news, sorry - there is no single set of magic incantations to solve your problem: You must learn the skills required to do each step, including reading your output and understanding how the package manager works. AskUbuntu's format is poorly suited to this kind of learning - I suggest opening a thread in our sibling site ubuntuforums.org, where you can have days or weeks of interactive hand-holding with experts while you learn.
  • Mustafa Taheri
    Mustafa Taheri over 5 years
    hey, @user535733 just need some of your help I have removed all the repo which include 17.10 and bionic in there title as they are not of 18.10 but there are still some of them and I am unable to judge whether to remove them or not. Adding the image in Que to refer with name Other Software List.
  • user535733
    user535733 over 5 years
    Re-read the answer above. The relevant instruction is clear.
  • Mustafa Taheri
    Mustafa Taheri over 5 years
    I have solved that by your instruction. thanx, a lot brother @user535733. You have saved me...
  • Cecil Curry
    Cecil Curry about 5 years
    Note: for a command-line snippet safely purging all previously installed PPAs and PPA packages (complete with dry-run preview for additional safety), see this accepted StackOverflow answer.
  • user2342558
    user2342558 over 4 years
    This is the ONLY solution that worked for me on Ubuntu 17.04! And the simplest at all!!!!!many thanks!
  • Lorenz Keel
    Lorenz Keel over 3 years
    Could you add details of the reason why apache showed that error and how you fixed it? It may be useful for the ones that read your answer.
  • Anatoly Gorchuk
    Anatoly Gorchuk over 3 years
    I haven't solved this problem yet. After I removed this package, I had to completely change the Apache2 settings because the server stopped working. The problem turned out to be much more serious. And reinstalling the package libcurl4 didn't help. I want to warn others not to uninstall the package libcurl4 unnecessarily. I am using ubuntu 20.04