Apt-getremove is A good understanding of the behavior of deleting A package, that is, deleting A package dependent on it. for example, A depends on B, and B depends on Capt-getremove to delete B, A will be deleted (it is easy to understand that A depends on B and B will be deleted, and A will not be able to run normally) first, we should explain that apt-getautoremove and aptituderemove are the same apt-get remove actions. we understand that when deleting a package, deleting the packages dependent on it
For example, A depends on B and B depends on C.
When apt-get remove deletes B, it will delete A (it is easy to understand that A depends on B, B is deleted, and A cannot run normally)
First, we will explain that apt-get autoremove and aptitude remove have the same effect.
1 |
Apt-get does not record auto-install Information at the beginning. |
2 |
In apt (0.6.44.2exp1), the auto-install record (/var/lib/apt/extended_states) similar to aptitude is added to apt-get (06 ). |
3 |
Since then, aptitude switched to the auto-install record of apt-get in version 0.4.5.1 (07), and abandoned its original record method. |
4 |
Later, apt-get added the autoremove option in version 0.7.7 (07 ). |
Dependency is a complex and staggered chain. let's take a few examples to see their behavior.
1 |
The green circle is the package automatically installed on apt-get or aptitude to satisfy the dependency. |
2 |
The blue circle is the administrator's use of apt-get install or aptitude install. |
3 |
Indicates the package to be installed. for short, it is a manual package. |
Example 1:
1. C depends on or Recommends B software package (apt-get and aptitude install the Recommends link package by default in addition to the necessary dependency packages)
2. B depends on or recommends A. A is dependent on other manually installed packages.
1 |
Apt-get removeC will delete C and prompt you to use apt-get autoremove to clear B |
2 |
Apt-get autoremove C will delete B, C |
3 |
Aptitude remove C will delete B, C |
My understanding: to delete C, The Package B is automatically installed, and no other manually installed package depends on it,
It is unnecessary to Judge B.
Example 2:
1. based on Example 1, D depends on or B is recommended, and D is not dependent on other manually installed packages.
This usually occurs after you use apt-get to remove a manually installed package.
1 |
Apt-get removeC will delete C and prompt you to use apt-get autoremove to clear B, D |
2 |
Apt-get autoremove C will delete B, C, D |
3 |
Aptitude remove C will delete B, C, D |
My understanding: delete C, then the packages B and D are both automatically installed, and no other manually installed packages depend on them,
It can be determined that B and D are unnecessary.
Example 3:
1. on the basis of Example 2, there is a manual installation package E recommended D (both E Recommends D and D will also be installed when you manually install e)
1 |
Apt-get removeC will delete C and prompt you to use apt-get autoremove to clear B, D |
2 |
Apt-get autoremove C will delete B, C, D |
3 |
Aptitude remove C will delete B, C, D |
My understanding: delete C, then the packages B and D are both automatically installed, and no other manually installed packages depend on them,
It can be determined that B and D are unnecessary.
Even though D was implemented by E Recommend, I didn't guess what developers thought.
Example 4:
1. based on Example 3, D becomes dependent on B, and E becomes dependent on D.
1 |
Apt-get removeC will delete C |
2 |
Apt-get autoremove C will delete C |
3 |
Aptitude remove C will delete C |
In my understanding, only C is deleted. because B is dependent on D, D is dependent on E. indirectly, E cannot run normally without B. Therefore, B and D are retained.
Example 5:
1. based on Example 4, D becomes recommendation B, and E is still dependent on D
1 |
Apt-get removeC will delete C and prompt you to use apt-get autoremove to clear B |
2 |
Apt-get autoremove C will delete B, C |
3 |
Aptitude remove C will delete B, C |
My understanding: deleting C, B is not directly or indirectly dependent on other manually installed packages (I refer to the relationship between depend on layers), and D is dependent on E.
So B is not necessary. it can be deleted, and D cannot be deleted.