I am trying to install something new on a server with apt-get and am getting this error:
The following packages have unmet dependencies:
cassandra : Depends: python-support (>= 0.90.0) but it is not installable
Recommends: ntp but it is not going to be installed or time-daemon
...
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Everything I have found on the net so far advises upgrading/uninstalling Cassandra. I definitely can't do that! How can I get this error to go away without messing with Cassandra? I don't mind if I can't upgrade it afterwords using the package manager.
Is there a way to remove the package but leave all its files in place?
You can manipulate the dpkg package management system by hand editing its database of packages in one of the possible installed states:
/var/lib/dpkg/status
. It is quite human friendly readable. Each package in its own block with empty lines in between. Each block can specify Depends, Conflicts, Breaks, Provides, Replaces type of lines, which are parsed by dpkg to get a view of the tree of packages and install possibilities or problems.Of course you should be beware of editing this file when apt or dpkg programs are running. Stopping the unattended-upgrades service could also be important. And also realize that your edits are lost when a package that you edited is up/downgraded replaced by alternatives or from another repository.
In this case it is possible to remove the
python-support
package from the Depends: line of the cassandra package and then dpkg has no missing dependency anymore.You can also put a Hold marker on the cassandra package to stop it and its status entry from being overwritten accidentally or unattended:
apt-mark hold cassandra
Other possibilities would be removing the cassandra package from the status database. But that would make it vulnerable for missing upgrades to other packages that make it non-functional. Its files would be left alone, and there may be trigger scripts that are triggered by other package configurations.
Or you could add a fake python-support package. Of course that would be dangerous if some other program is installed later on that really depends on it.
Some more apt tricks: https://unix.stackexchange.com/a/161940