Debian – Could Apt delete packages that are need by software that users have installed from source

aptdebiandependencies

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?

Best Answer

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.

Related Question