What is meant by "depends" and "pre-depends", and the difference between those 2 types of package requirements when I am installing something in Ubuntu?
What is meant by "depends" and "pre-depends", and the difference between those 2 types of package requirements when I am installing something in Ubuntu?
As taken from this link: https://www.debian.org/doc/debian-policy/#document-ch-relationships
There are 5 types of dependencies:
The meaning of the five dependency fields is as follows:
Depends
This declares an absolute dependency. A package will not be configured unless all of the packages listed in its Depends field have been correctly configured. The Depends field should be used if the depended-on package is required for the depending package to provide a significant amount of functionality. The Depends field should also be used if the postinst or prerm scripts require the depended-on package to be unpacked or configured in order to run. In the case of postinst configure, the depended-on packages will be unpacked and configured first.
In the case of prerm or other postinst actions, the package dependencies will normally be at least unpacked, but they may be only "Half-Installed" if a previous upgrade of the dependency failed. Finally, the Depends field should be used if the depended-on package is needed by the postrm script to fully clean up after the package removal. There is no guarantee that package dependencies will be available when postrm is run, but the depended-on package is more likely to be available if the package declares a dependency (particularly in the case of postrm remove). The postrm script must gracefully skip actions that require a dependency if that dependency isn't available.
Recommends
Suggests
Enhances
Pre-Depends
This field is like Depends, except that it also forces dpkg to complete installation of the packages named before even starting the installation of the package which declares the pre-dependency, It works like this, when a package declaring a pre-dependency is about to be unpacked the pre-dependency can be satisfied if the depended-on package is either fully configured, or even if the depended-on package(s) are only unpacked or in the "Half-Configured" state, provided that they have been configured correctly at some point in the past (and not removed or partially removed since).
In this case, both the previously-configured and currently unpacked or "Half-Configured" versions must satisfy any version clause in the Pre-Depends field. When the package declaring a pre-dependency is about to be configured, the pre-dependency will be treated as a normal Depends. It will be considered satisfied only if the depended-on package has been correctly configured. However, unlike with Depends, Pre-Depends does not permit circular dependencies to be broken. If a circular dependency is encountered while attempting to honor Pre-Depends, the installation will be aborted.
Pre-Depends are also required if the preinst script depends on the named package. It is best to avoid this situation if possible. Pre-Depends should be used sparingly, preferably only by packages whose premature upgrade or installation would hamper the ability of the system to continue with any upgrade that might be in progress.
Smaller Version:
The term "dependency" can be used broadly to encompass "Depends" and "Pre-Depends" relationships (and sometimes even other, weaker relationships), or it can be used narrowly as a synonym of "Depends."
The difference between "Depends" and "Pre-Depends" package relationships is that if X depends on Y, then Y must be fully configured before X gets configured. (Configuration is the installation step where a package, once its files are unpacked to the proper locations--i.e., once "installed"--has whatever other necessary changes made so that it is possible to actually use the software it provides. For example, configuration of an HTTP server might involve making sure there is a
www
user with proper abilities and a/var/www
directory with proper permissions.) In contrast, if X pre-depends on Y then Y must be installed and (usually) fully configured before X is even installed.See Section 7.2 of the Debian Policy Manual for more details. I quote the two most relevant sections here, but there is other information in that section (and in chapter 7 more generally) that helps to illuminate how dependencies work.