Ubuntu – Doesn’t apt-get install dependency resolution work when specifying old versions

aptdependencies

The following used to work and now it doesn't:

apt-get install r-base=3.3.1-1trusty0 r-base-dev=3.3.1-1trusty0 r-recommended=3.3.1-1trusty0 r-base-core=3.3.1-1trusty0
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 to resolve the situation:

The following packages have unmet dependencies:
 r-recommended : Depends: r-cran-mgcv (>= 1.1.5) but it is not going to be installed
                 Depends: r-cran-nlme (>= 3.1.52) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

If I remove the versions (e.g. 3.3.1-1trusty0), apt-get install works with no errors.

This answer notes that when specifying versions, "you may need to do some dependency resolution on your own".

Why does dependency resolution fail when the version is specified? What is the likely explanation of why apt-get install succeeded with no dependency errors with this same command (using these versions) about a month ago?

Best Answer

Your older version must satisfy two criteria.

1) The old version must be in a repository that apt can see.

2) The old version must not break other software on your system.

Your error messages, especially errors about 'held broken package' indicate a version conflict. A version conflict means that the old package violates #2, and is about to break other parts of your system.

Dependencies like foo 1.1 depends upon libfoo(>0.98) are set by the packager of the software when they create the package. Packagers are volunteers - you can learn to do it, too.

Lazy packagers simply use the current dependencies they have on hand. Example: foo 1.1 depends upon libfoo(=1.1). That lack of flexibility in dependency versions causes lots of problems for users. Lazy packages are found in many PPAs and other non-Ubuntu sourced software, and are one reason those are unsupported sources.

More experienced packagers will test their packages to achieve functionality with the widest range of dependency versions. Example: foo 1.1 depends upon libfoo(>=0.75). These packages are usually found in Debian and imported into Ubuntu each release cycle.

Distros like Debian and Ubuntu are 'snapshot' distros. Each release is based on a single stable snapshot. Older snapshots are in older releases. Since versions change constantly, this usually means that many packages are compatible ONLY with the release they are built for.

If you want to run older packages, you must often do so in an older release of Ubuntu (using a VM, for example). You CAN install older software on any you system you wish...but not by using packages.

Related Question