2
votes

I upgraded the mysql version from 5.5 to 5.7 on my Ubuntu.

But, nothing related to the mysql worked after that. I updated the php5-mysql package as well.

I found out I have to install php5-mysqlnd package using command sudo apt-get install php5-mysqlnd. But, it can't be installed. the message:

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 resolve the situation:

The following packages have unmet dependencies:
 php5-mysqlnd : Depends: phpapi-20121212
                Depends: php5-common (= 5.5.36+dfsg-1+donate.sury.org~trusty+1) but 5.6.18+dfsg-1+deb.sury.org~trusty+1 is to be installed
E: Unable to correct problems, you have held broken packages.

My PHP Version 5.6.18-1+deb.sury.org~trusty+1

1
It looks like you use a custom repository donate.sury.org, please add your apt configuration in the question. And try with the default repositories?A.L

1 Answers

1
votes

You have some packages from one repository, and some others from the main repository. Additionally, and this is where the error creeps in, some of those packages are held. You chose not to upgrade them:

php5-mysqlnd : Depends: phpapi-20121212
               Depends: php5-common (= 5.5.36...) but 5.6.18... is to be
                        installed
E: Unable to correct problems, you have held broken packages.

What probably happened

During a previous upgrade, the system had an error and suggested some resolutions, one of which was to the tune of, "...continue and break dependencies". You chose that one -- i.e., you signed a waiver to APT saying, "I'm never gonna upgrade that".

Now you want to do exactly that -- and you no longer can.

What you need to do

You need to identify those held packages, determine why they're held, and upgrade them accordingly; or go back to MySQL 5.5, if some more important dependency would be broken.

apt-get update

apt-get --ignore-hold --dry-run upgrade

will tell you what would happen if you try and upgrade also those packages that are currently held. You can try also the --fix-missing and --fix-broken options. But the most important answer you need is, why were those packages held back in the first place.

If you just go on and ignore the held packages, you risk breaking something that can't be easily repaired. I did that once when I unwittingly upgraded a held-back Subversion package that was required to access a specific and very choosy repository. The upgrade went OK, but then I could no longer commit source changes.