Skip to content

Instantly share code, notes, and snippets.

@gubatron
Last active March 3, 2019 14:46
Show Gist options
  • Save gubatron/d2186a15b2b940f989ce to your computer and use it in GitHub Desktop.
Save gubatron/d2186a15b2b940f989ce to your computer and use it in GitHub Desktop.
Ubuntu: Tips to get out of dependency hell.

If you find yourself in dependency hell, usually the error, at the top, tells you what's the offending package that can't be installed.

Go to http://packages.ubuntu.com/ and download the current version installed, and sudo dpkg -i it, then try downloading the next one and do the same.

Then try going for sudo apt-get install -f to see if the issue is resolved.

Basically, installing the dep tree by hand should help.

For example:

You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 perl : Depends: perl-modules (>= 5.20.2-2ubuntu0.1) but 5.18.2-2ubuntu1 is installed
        Recommends: rename but it is not installable
 php5-apcu : Depends: phpapi-20121212
 php5-cli : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.4+dfsg-4ubuntu6.4 is installed
 php5-curl : Depends: phpapi-20121212
             Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.4+dfsg-4ubuntu6.4 is installed
 php5-json : Depends: phpapi-20121212
 php5-memcache : Depends: phpapi-20121212
 php5-memcached : Depends: phpapi-20121212
 php5-mysql : Depends: phpapi-20121212
              Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.4+dfsg-4ubuntu6.4 is installed
 php5-readline : Depends: phpapi-20121212
                 Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.14) but 5.6.4+dfsg-4ubuntu6.4 is installed

this is the part that matters:

perl : Depends: perl-modules (>= 5.20.2-2ubuntu0.1) but 5.18.2-2ubuntu1 is installed
        Recommends: rename but it is not installable

In this case I downloaded perl-modules 5.20.2-2ubuntu0.1 and did sudo dpkg -i perl-modules_5.20.2-2ubuntu0.1_all.deb

In other cases you might have to re-download the one that's supposedly installed.

Also a sudo dpkg --configure -a might help, to reconfigure everything that was broken.

Other useful tricks

Getting an error like this? insserv: Service mountkernfs has to be enabled to start service networking

try this sudo apt-get install initscripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment