14

Apt handles dependencies among packages installed from its repositories or *.deb files. However, what about software that users have compiled and installed from source with ./configure && make && make install without creating a .deb file first? Is it possible that Apt could remove packages needed by such softwares? Would installing software from source in /opt or /usr/local make a difference?

  • 1
    You could install an equivs package as stand-in for a package installed from source, to force your dependencies to stay installed. – Faheem Mitha Jul 4 '15 at 16:46
13

APT doesn't know anything about software that was installed manually. It doesn't know what libraries that software needs or anything.

When APT installs a package only to fulfill the dependencies of another package, this package is marked as automatically installed. If you remove all the packages that depend on an automatically-installed package, that package is removed when you run apt-get autoremove; higher-level frontends to APT will typically offer to do that after other maintenance. To avoid removing packages that are needed by locally-installed software, mark these packages as manually installed: apt-mark manual PACKAGE-NAME, or the m key in aptitude.

To find what library packages a binary executable needs, run ldd /path/to/executable. For each line containing /usr/lib/SOMETHING, run dpkg -S /usr/lib/SOMETHING to display the name of the package containing that library. For scripts, head -n 1 /path/to/script shows the interpreter used by the script; make sure that this interpreter remains installed. Finding what libraries are used by a script can be difficult, there's no universal way to do that.

If you've manually installed a more recent version of a package that's present in your distribution, look at the dependencies of the distribution's package and mark them as manually installed.

  • apt-get in Debian Jessie does not have the manual option. For these manual vs. auto(matic) installation hints I have been using apt-mark instead. (apt-mark manual pkg, apt-mark showmanual pkg, apt-mark auto pkg, etc.) – Lekensteyn Jul 5 '15 at 14:54
  • @Lekensteyn I meant apt-mark, thanks. – Gilles 'SO- stop being evil' Jul 5 '15 at 14:59
14

apt and dpkg absolutely can remove software that is required by locally installed other software that is outside the scope of the package management system. There is simply no way for apt and dpkg to know that such software might exist.

The location where such software is installed makes no difference: it could be /opt or /usr/local or in users' home directories (in which case even the sysadmin may not be aware of its presence), or anywhere, really.

Technically apt or dpkg could even remove software that is required by other software that is part of the package management system, if the latter software fails to declare that it depends on the former software. However, the process for creating deb packages includes automation to help prevent package maintainers from forgetting to declare a dependency like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.