Suppose I 'apt-get install somepkg', then further install other packages ('abc' and 'def') that depend on 'somepkg'. Later, I might read that there are some desirable updates in the package's latest released source but I can see the pre-built version available through the package manager is stuck on a really old version, so I then get, make, and install from latest released source.
However, I now see that I have 2 different versions/sets of the various built/installed packages. E.g. /bin/somepkg-tool (v 1.0), /usr/bin/sompkg-tool (v1.0), along with the newer, built-from-up-to-date-src /usr/local/bin/somepkg-tool (v4.1), which raises a few questions -
- Might there be problems from having multiple sets of the binaries installed from different versions (one from the pre-built package manager and one from locally built latest src)? It feels like a source of potential problems that is best avoided.
- If I were to remove the older pre-built managed package with 'sudo apt-get purge somepkg', that now prompts to also remove the dependent packages 'abc' and 'def', which makes me uncomfortable because it's not clear whether that's strictly necessary or whether they can continue to work by finding the newer built binaries on the path. Is removing/purging a previously installed package inevitably going remove subsequent dependent packages? Also, if I accept the removal of the dependent packages, will/can the package manager see that subsequent (re)installing of 'abc' and 'def' no longer require fetching and installing the old 'somepkg', since I have locally built and installed the necessary 'somepkg' binaries from src?
- or is there some way of purging the older installed 'somepkg' through the package manager without removing the 2 dependent packages?
- Is there a general best way to resolve this kind of situation, or is it usually best handled on a case-by-case basis?
I noticed a similar unanswered question here but, the comments focus on the specific case being rather problematic because it's a fundamental dependency for many things.
Without wanting to distract from the general nature of this question, it may be useful to illustrate a specific case -
- I 'apt-get install git' (v2.30.2)
- I later 'apt-get install gitolite3' and '... git-lfs'.
- Later, I see a number of fixes/updates in release notes and my debian package manager tells me the latest git package is stuck on an older version (apt-get update, apt show git) so I 'wget ...git-2.37.3.tar.gz', make, and install from a newer release source.
Now I see that I have the following binaries (among all the others that come with the git package) -
- /bin/git (v2.30.2 old)
- /usr/bin/git (v2.30.2 old)
- /usr/local/bin/git (v2.37.3 new)
and would like to be sure to avoid problems from the dependenty gitolite repository server and LFS server from inadvertently using the older git binaries. Hence these questions.
sudo apt install -t bullseye-backports git
. – Stephen Kitt Sep 21 '22 at 09:34sudo apt install git
... Oh dear, that's an old version but there's a newer backport version, so will then doingsudo apt install -t bullseye-backports git
automatically upgrade the previously installed git? If so, is that going to do anything different fromsudo apt upgrade git/bullseye-backports
which indicates it recognises and will perform an upgrade to git? – Chuffleton Sep 21 '22 at 10:55git
from backports replaces whatever version is currently installed, if any.apt install
is used both for installing and upgrading named packages;apt upgrade
upgrades everything, it ignores any additional non-option arguments (soapt upgrade git/bullseye-backports
won’t actually installgit
from backports, it will upgrade any upgradable packages). – Stephen Kitt Sep 21 '22 at 11:07apt install
is intended to be idempotent; if it succeeds, you have the requested packages installed and configured, whatever that entailed (installing from scratch, upgrading, or nothing at all if the packages were already up-to-date). – Stephen Kitt Sep 21 '22 at 12:37