Wednesday, July 24, 2013

[Ubuntu] How to fix dependency problems

This is not a very generic method to solve dependency hells but in many obvious cases this is a very good one. It solved one of my problems with some components of "MySQL" being replaced / removed by some mysterious force. I'll pick the scenario here and try to draw a picture on the approach. The solution is based on the askUbuntu answer here [ http://askubuntu.com/questions/227978/problem-after-mysql-server-installation-i-cant-install-any-thing-in-ubuntu-12-04/228450#228450 ]

The problem: I was trying to access a web app that I was working on inside my 'localhost', but for some reason the mysql components were not functioning properly.
The server configuration: Apache2, PHP5, MySQL. The server was setup using 'Automatic virtual hosting' method.
The packages used were installed using:
apt-get install ia32-libs-multiarch build-essential ncurses-term g++ mc lfm unrar firefox apache2 apache2-doc apache2-suexec git zsh vim aria2 awesome curl chromium-browser mpd ncmpcpp git conky pcregrep unagi mysql-server libapache2-mod-auth-mysql php5-mysql php5 php-pear php5-sqlite php5-curl php5-imap php5-intl php5-mysql phpmyadmin openssh-server php5-mcrypt 
It's the full string from my server setup script, you can see the apache, php and mysql packages being used in the list.
How did I find the cause: I tried the package installation script again and it threw these errors
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
 php5-curl : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
 php5-mysql : Depends: php5-common (= 5.4.9-4ubuntu2) but 5.4.9-4ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.
Then I Googled the first line (mysql) and found the askUbuntu answer page.
This indicated the cause to be a recent addition of and external repo into my repo list.
How did I fix the problem : I first removed repos that were added by me from Synaptic > Other softwares. [ Open Synaptic and then untick repos from "Other software" tab
First I executed the commands
sudo apt-get -f remove mysql-server-core-5.5 mysql-server-5.5 mysql-server-5.5 mysql-server
sudo apt-get -f remove php5-curl
sudo apt-get -f remove php5-common
Then executed the installation commands again and the problem was fixed.

No comments:

Post a Comment

Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.

Connect Rapoo MT750S with Linux (Tested on Manjaro)

 I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...