9

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

Zanna
  • 70,465
  • 1
    There is no supported upgrade path directly from 17.10 to 18.10. Please edit your question to include 1) a clear and complete explanation of how you upgraded, 2) the complete contents of /etc/apt/sources.list and 3) the complete output of apt-cache policy for both php7.20curl and curl – user535733 Dec 08 '18 at 13:00
  • Please ensure that you have enabled all software repositories (especially -updates and -security) then run sudo apt update and sudo apt dist-upgrade (to get new dependencies). Also add output of apt-cache policy php7.2-curl curl libcurl4 to the question. – N0rbert Dec 08 '18 at 13:05
  • @user535733 and N0rbert I have edited the question hope this will be helpful – Mustafa Taheri Dec 08 '18 at 14:44
  • Muistafa, try the duplicates first and keep the results. If none of the duplicates work, edit in the results from the steps you took over there. And please? Don't post screenshots, but copy-paste the *text* of terminal output so we can just copy-paste it as well... – Fabby Dec 14 '18 at 08:23
  • Apologies for inconvenience @Fabby but none of the above duplicate answer worked for me. I have followed the instructions given by user535733 and that solved my problem. – Mustafa Taheri Dec 15 '18 at 12:03
  • @Mustafa Voted to reopen. Sorry for the spelling error in your name... :-( Pressed u and i at the same time and didn't notice until now... – Fabby Dec 15 '18 at 12:17

3 Answers3

16

SIMPLE SOLUTION: (worked for me)

sudo apt remove libcurl4
sudo apt install curl
kaiz3n
  • 169
  • 1
    This is the ONLY solution that worked for me on Ubuntu 17.04! And the simplest at all!!!!!many thanks! – user2342558 Sep 06 '19 at 18:48
  • Ubuntu 22.04 - solution still works.

    Removing libcurl4, also removes apache2 apache2-bin libapache2-mod-php libapache2-mod-php8.1 libapache2-mod-php8.2 libapache2-mpm-itk libcurl4 php8.1-curl

    So after reinstalling curl, these packages should be manually reinstalled too.

    – AndreyP Jan 10 '24 at 11:35
2

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.

user535733
  • 62,253
  • 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. – Mustafa Taheri Dec 10 '18 at 07:17
  • 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 http://ubuntuforums.org, where you can have days or weeks of interactive hand-holding with experts while you learn. – user535733 Dec 10 '18 at 09:41
  • 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. – Mustafa Taheri Dec 14 '18 at 07:34
  • Re-read the answer above. The relevant instruction is clear. – user535733 Dec 14 '18 at 12:55
  • I have solved that by your instruction. thanx, a lot brother @user535733. You have saved me... – Mustafa Taheri Dec 15 '18 at 12:01
  • 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. – Cecil Curry Feb 07 '19 at 20:43
1

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

  • 1
    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. – Lorenz Keel Sep 02 '20 at 10:14
  • 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 – Anatoly Gorchuk Sep 02 '20 at 14:28