Linux: Ruby Rails sqlite3 libsqlite3-dev libssl-dev Install Error
Sqlite and libssl-dev Install Problem
Summary. If you are trying to install Ruby on Rails on Ubuntu, and you got this error:
The following packages have unmet dependencies: libsqlite3-dev : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is to be installed libssl-dev : Depends: libssl1.0.0 (= 1.0.1-4ubuntu5.8) but 1.0.1-4ubuntu5.9 is to be installed sqlite3 : Depends: libsqlite3-0 (= 3.7.9-2ubuntu1) but 3.7.9-2ubuntu1.1 is to be installed E: Unable to correct problems, you have held broken packages.
The problem is probably because you disabled one of the repository source in update-manager.
To fix, start
update-manager &, then in the “settings” button at bottom, in “Updates” tab, make sure you check box the “Recommended updates (precise-updates)”.
Manual Fix Using dpkg
If you search the web, you might find a few page that try to tell you how to fix it by using
dpkg. For example, these:
- [Can't install anything, bad libsqlite3-0:amd64 By Steveriley. At http://www.kubuntuforums.net/showthread.php?60125-Can-t-install-anything-bad-libsqlite3-0-amd64 , accessed on 2013-06-03 ]
- [Ruby on Rails – Installing on Ubuntu 12.04 – Success Finally By ?. At http://allelseweretaken.wordpress.com/2012/12/29/ruby-on-rails-installing-on-ubuntu-12-04-success-finally/ , accessed on 2013-06-03 ]
That would work, but is very dangerous and error-prone. If the problem is a turned-off source repository, you better turn it back on, else you'll need to manually fix lots of other packages.
If the problem is not repository source, here's how you can fix it manually.
- First, go to Ubuntu package site http://packages.ubuntu.com/, and find the package you want. Be sure the Ubuntu version and 32/64 bits architecture matches yours, otherwise you might be download a older version of the package.
- Download the 32bits and 64 bits “.deb” packages.
- Force remove the packages on your system, by, for example,
sudo dpkg --force-depends --purge libsqlite3-0. WARNING: dangerous. This better not be a production system, unless you know what you are doing.
- Install the ones you downloaded. Like this:
sudo dpkg --install /home/xah/Downloads/libsqlite3-0_3.6.22-1_i386.deb. You might need to install both 32bits and 64bits versions, i'm not sure.
See also: Linux: How to Install/Remove Packages .