apt-get remove A "-r"

Asked by Xan

Hi,

Many times we install package A that depends of B_1, ..., B_n, but when we do "apt-get remove A", B_1, ..., B_n are not removed, even if _only_ B_i are used by A (there are no other packages have as dependency B_i).

By this way we get system with more and more waste package (packages that does not use for packages) and so less avaliable space

Is there any way to detect such packages (B_i) and remove it?

Thanks in advance,
Xan.

PS: In my ideal world, there were an option of apt-get remove:

apt-get remove A -r

removes A and all packages which A depends on and no other package depends on. But it should be done by developers in one spec

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Alan Pope 🍺🐧🐱 πŸ¦„
Solved:
Last query:
Last reply:
Revision history for this message
Best Alan Pope 🍺🐧🐱 πŸ¦„ (popey) said :
#1

The feature already exists:-

apt-get autoremove

It's a fairly recent development. Here is an example of it running on my desktop which is running Ubuntu 7.04 (development release):-

alan@wopr:~$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bochsbios libqt4-qt3support libsqlite0-dev vgabios libqt4-sql
  libgimme-codec0
The following packages will be REMOVED:
  bochsbios libgimme-codec0 libqt4-qt3support libqt4-sql libsqlite0-dev
  vgabios
0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 5005kB disk space will be freed.
Do you want to continue [Y/n]?

Revision history for this message
Xan (dxpublica) said :
#2

User confirmed that the request is solved.

Revision history for this message
Xan (dxpublica) said :
#3

Is this only avaliable in 7.04? Will it be included officially in 7.04?
Can you provide me the spec of autoremove?

Thanks,
Xan.

Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) said :
#4

Well, feisty definately has it, dapper doesn't. Dapper has apt version 0.6.43.3ubuntu, feisty has 0.6.46.4ubuntu. I guess it came in somewhere between the two.

From the man page:-

       autoremove
          autoremove is used to remove packages that were automatically
          installed to satisfy dependencies for some package and that are no
          more needed.

Revision history for this message
Xan (dxpublica) said :
#5

Thank you very much,
Xan.