Saturday, October 13, 2012

Quick scratch way to get rid of dependency hell!

***Disclaimer***
This may not be the most optimal thing to do. You may end up with a screwed up Ubuntu setup if things go wrong!
It worked for me tho :)

What do you do when you need to install a package on Ubuntu and the trusted package manager throws a bunch of "xyz will not be installed" error?
I am sure the first two options are: Curse and Whine :-P

If you so badly need a package, you may download the source, curse more times compile and install (probably this is the right way to do things...).

If you want to do something easy, here you go.
I found this on askubuntu forums.

Many times, the distro installation has a higher version of some library than what is needed by the package. This is the main culprit behind the errors that one encounters.

In such case, its simple, do a downgrade and install the package!
Steps:
1. Create  'preferences' file
    sudo vi /etc/apt/preferences
        with the following contents:

    Package: *      
    Pin: release a=precise*
    Pin-Priority: 2012

        Pin-Priority must be greater than 1000.
        I use the 12.04 LTS version, hence release a=precise*.
2. Downgrade the packages with an upgrade command ;-)
    sudo apt-get dist-upgrade
3. Install the necessary packages.
4. Remove the preferences file:
    sudo rm /etc/apt/preferences
        Without removing this, apparently you do not get the updates.

That's all for now.

Adios,
Akshay