3

I am trying to install php5-cli package on my machine but I get the following error for unmet dependencies.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libmaven2-core-java : Depends: libdoxia-core-java (>= 1.1) but it is not going to be installed
 php5-cli : Depends: libonig2 (>= 5.9.5) but it is not going to be installed
            Depends: libqdbm14 (>= 1.8.74) but it is not going to be installed
            Depends: php5-common (= 5.6.12+dfsg-1+deb.sury.org~vivid+1) but it is not going to be installed
            Depends: php5-json but it is not going to be installed
            Recommends: php5-readline but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

I have tried apt-get install -f, apt-get clean and apt-get autoclean none of which helped. I have tried almost all the solutions given in this post How do I resolve unmet dependencies after adding a PPA? but none of them seemed to work for me.

edit:I tried installing the packages individually using

sudo apt-get install php5-readline php5-json php5-common libqdbm14 libonigia-core-java libmaven2-core-java 2 libdox

but that didn't seem to work either.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libonig2 is already the newest version.
libmaven2-core-java is already the newest version.
libmaven2-core-java set to manually installed.
libqdbm14 is already the newest version.
php5-common is already the newest version.
php5-json is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 php5-readline : Depends: php5-cli (= 5.6.12+dfsg-1+deb.sury.org~vivid+1) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Here is the output for apt-cache policy php5-readline

php5-readline:
  Installed: (none)
  Candidate: 5.6.12+dfsg-1+deb.sury.org~vivid+1
  Version table:
     5.6.12+dfsg-1+deb.sury.org~vivid+1 0
        500 http://ppa.launchpad.net/ondrej/php5-5.6/ubuntu/ vivid/main amd64 Packages
     5.6.12+dfsg-1 0
        500 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
     5.6.4+dfsg-4ubuntu6.2 0
        500 http://pk.archive.ubuntu.com/ubuntu/ vivid-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ vivid-security/main amd64 Packages
     5.6.4+dfsg-4ubuntu6 0
        500 http://pk.archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages

the output to grep -r 'ftp.us.debian.org' /etc/apt/ and apt-cache policy libmaven2-core-java is

/etc/apt/sources.list:deb http://ftp.us.debian.org/debian unstable main contrib non-free
/etc/apt/sources.list.save:deb http://ftp.us.debian.org/debian unstable main contrib non-free
/etc/apt/sources.list.bak:deb http://ftp.us.debian.org/debian unstable main contrib non-free
grep: and: No such file or directory
grep: apt-cache: No such file or directory
grep: policy: No such file or directory
grep: libmaven2-core-java: No such file or directory

And this is the output to the script:

alsa-base http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
cgroupfs-mount http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
curl http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
dmsetup http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
dnsmasq-base http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libarchive13 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libcurl3-gnutls http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libdevmapper1.02.1 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libeclipse-aether-java http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libgnutls-deb0-28 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libgnutls-deb0-28 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libgnutls-openssl27 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libgrpc-dev http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libgrpc0 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libhogweed4 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libhogweed4 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libjsch-java http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libnettle6 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libnettle6 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
librtmp1 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
librtmp1 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libsisu-inject-java http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libssh2-1 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libssl-dev http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libssl1.0.0 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libssl1.0.0 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libtasn1-6 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libtasn1-6 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libunwind8 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libwagon-java http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
libwagon2-java http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
pepperflashplugin-nonfree http://ftp.us.debian.org/debian/ unstable/contrib amd64 Packages

output for apt-cache policy libmaven2-core-java

libmaven2-core-java:
  Installed: 2.2.1-22
  Candidate: 2.2.1-22
  Version table:
 *** 2.2.1-22 0
        500 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
        100 /var/lib/dpkg/status
     2.2.1-17 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/universe amd64 Packages

I followed the steps in the answer, removed the repository, ran apt-get -f install and had to do an autoremove to remove some packages that were not required anymore. It seemed to have resolved the issue with libmaven2-core-java. I then tried to install php5-cli again but I got the following output.

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:
 php5-cli : Depends: php5-common (= 5.6.4+dfsg-4ubuntu6.2) but 5.6.12+dfsg-1+deb.sury.org~vivid+1 is to be installed
            Recommends: php5-readline but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

output to sudo apt-get install -f

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 53 not upgraded

and output to sudo apt-get install php5-cli

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:
 php5-cli : Depends: php5-common (= 5.6.4+dfsg-4ubuntu6.2) but 5.6.12+dfsg-1+deb.sury.org~vivid+1 is to be installed
            Recommends: php5-readline but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

the output for apt-cache policy php5-common

php5-common:
  Installed: 5.6.12+dfsg-1+deb.sury.org~vivid+1
  Candidate: 5.6.12+dfsg-1+deb.sury.org~vivid+1
  Version table:
 *** 5.6.12+dfsg-1+deb.sury.org~vivid+1 0
        100 /var/lib/dpkg/status
     5.6.4+dfsg-4ubuntu6.2 0
        500 http://archive.ubuntu.com/ubuntu/ vivid-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ vivid-security/main amd64 Packages
     5.6.4+dfsg-4ubuntu6 0
        500 http://archive.ubuntu.com/ubuntu/ vivid/main amd64 Packages

The output to dpkg -l | grep 'sury' is

ii  php5-json                                            1.3.7-1+deb.sury.org~vivid+1               amd64        JSON module for php5
SHuss
  • 33
  • 1
  • 6
  • [Edit] your question and add the output of apt-cache policy php5-cli; apt-cache policy libmaven2-core-java; apt-cache policy libdoxia-core-java; apt-cache policy libonig2 – A.B. Sep 07 '15 at 06:16
  • And where is the output of the command's above? And now I need apt-cache policy php5-readline too – A.B. Sep 07 '15 at 15:09
  • Purge this ... ppa:ondrej PPA! – A.B. Sep 07 '15 at 16:47
  • I've added an answer in progress, follow my steps exactly and give me a report. – A.B. Sep 08 '15 at 05:22
  • [Edit] your question and add the output of grep -r 'ftp.us.debian.org' /etc/apt/ and apt-cache policy libmaven2-core-java – A.B. Sep 08 '15 at 10:07
  • And [edit] your question and add the output of this script. – A.B. Sep 08 '15 at 10:47
  • and means and =) Give me the output of apt-cache policy libmaven2-core-java – A.B. Sep 08 '15 at 16:06
  • oops! Sorry! Must have overlooked it. Edited the question to include it now – SHuss Sep 09 '15 at 05:05
  • Updated my answer. Don't forget to give me the result. And ping me with @A.B. in your contents. Without that, I don't get a notification. – A.B. Sep 09 '15 at 05:19
  • @A.B. I just updated my question with the result from the steps. The issue with libmaven2-core-java seemed to have resolved but I still could not install php. Thanks for all your help btw! :) – SHuss Sep 09 '15 at 19:14
  • The PPA ppa:ondrej/php5-5.6 is still active. Purge it as described in my answer and don't forget the sudo apt-get update – A.B. Sep 09 '15 at 19:20
  • @A.B. I tried purging it but I got this "Updating packages lists PPA to be removed: ondrej php5-5.6 Warning: Could not find package list for PPA: ondrej php5-5.6" – SHuss Sep 10 '15 at 05:12
  • Start sudo apt-get update now. – A.B. Sep 10 '15 at 05:13
  • @A.B. done! But still getting the same message with the php5-cli installation – SHuss Sep 10 '15 at 05:16
  • [Edit] your question again and add the output of sudo apt-get install -f;; sudo apt-get install php5-cli – A.B. Sep 10 '15 at 05:19
  • @A.B. just updated the question with the outputs you requested – SHuss Sep 10 '15 at 05:41
  • Thank you again the output of apt-cache policy php5-common – A.B. Sep 10 '15 at 05:45
  • @A.B. added the output to the question – SHuss Sep 10 '15 at 07:13
  • I have added another downgrade into my answer: sudo apt-get install php5-common=5.6.4+dfsg-4ubuntu6.2 – A.B. Sep 10 '15 at 07:17
  • [Edit] your question again and add the output of `dpkg -l | grep 'sury' – A.B. Sep 10 '15 at 07:20
  • @A.B. That seemed to have done the trick. I did manage to install php5-cli finally! Thank you so much! – SHuss Sep 10 '15 at 09:10
  • And downgrade this package also: sudo apt-get install php5-json=1.3.2-2build1 – A.B. Sep 10 '15 at 09:18

1 Answers1

0

You have incompatible software repositories enabled. We can fix this…

  1. Use the main server for the Ubuntu repositories

    sudo sed -i.bak 's/http:\/\/pk\./http:\/\//' /etc/apt/sources.list
    sudo apt-get update
    
  2. Install ppa-purge

    sudo apt-get install ppa-purge
    

    If an installation isn't possible and ppa-purge isn't installed, download the deb package

    cd ..
    wget http://mirrors.kernel.org/ubuntu/pool/universe/p/ppa-purge/ppa-purge_0.2.8+bzr57_all.deb
    

    extract and copy the executable

    dpkg -x ppa-purge_0.2.8+bzr57_all.deb ppa-purge
    sudo cp ppa-purge/usr/sbin/ppa-purge /usr/sbin
    
  3. Purge the PPA ppa:ondrej/php5-5.6

    sudo ppa-purge ppa:ondrej/php5-5.6
    sudo apt-get update
    
  4. The next error message

    libmaven2-core-java : Depends: libdoxia-core-java (>= 1.1) but it is not going to be installed
    

    You use an additionally Debian repository, http://ftp.us.debian.org/. This repository provides libmaven2-core-java which depends on libdoxia-core-java. But this package isn't available.

    Therefore remove the repository http://ftp.us.debian.org/ in your /etc/apt/sources.list. After that, run

    sudo apt-get update
    

    and downgrade the packages with:

    sudo apt-get install libmaven2-core-java=2.2.1-17
    
  5. Usually not necessary after purging the PPA ppa:ondrej/php5-5.6 with ppa-purge, but in your case downgrade also the packages listed by dpkg -l | grep 'sury'

    sudo apt-get install php5-common=5.6.4+dfsg-4ubuntu6.2 
    sudo apt-get install php5-json=1.3.2-2build1
    
  6. Repair your installation

    sudo apt-get install -f
    
A.B.
  • 90,397
  • I could not install the ppa-purge package because i am getting the unmet dependencies error with it as well. – SHuss Sep 08 '15 at 05:43
  • Maybe it's already installed? Check with apt-cache policy ppa-purge – A.B. Sep 08 '15 at 06:20
  • It is not installed. I get Installed: (none) at the output – SHuss Sep 08 '15 at 08:24
  • Ok, I have added a step into my answer. See point 2 and use "If an installation isn't possible, download the deb package …" – A.B. Sep 08 '15 at 08:57
  • So I did try that. But that doesn't seem to work either. "libmaven2-core-java : Depends: libdoxia-core-java (>= 1.1) but it is not going to be installed" keeps popping up. I am not sure why though – SHuss Sep 08 '15 at 10:03
  • I tried sudo ppa-purge ppa:ondrej/php5-5.6 – SHuss Sep 10 '15 at 07:10
  • As you're a reputation 6 user: If this answer helped you, don't forget to click the grey at the left of this text, which means [Yes, this answer is valid][askubuntu.com/help/…](http://askubuntu.com/help/accepted-answer)! ;-) – Ravan Sep 10 '15 at 09:23