From Mageia wiki
Jump to: navigation, search
Drakconf multiflag.png
Other languages

Deutsch ; English ; Français ;


Taken from related forums thread

When I remove a package, will the dependencies it pulled in be removed, too?

If I install a package using "urpmi <packagename>" and let's say it installs 9 dependencies, so 10 packages in total, then if I remove the package using the "urpme" command, does it remove all 10 packages?

If not, what is the best command to use to remove all 10 packages?

Answer:

No, it will only remove the package that you requested to install, not the dependencies. This is what the urpme --auto-orphans option was intended to do, and basically it works as designed, if you know how it really works, as there's some mechanics that you need to know and need to pay attention to, so that it works exactly as you requested.

Small example: You have a clean system as starting point, where urpme --auto-orphans gives no orphans, that is, all packages currently installed were requested by you to be installed. Literally each one. Then you install foo, this pulls in packages bar and baz.

The orphans function marks bar and baz as not explicitely requested by putting them into /var/lib/rpm/installed-through-deps.list Then, some time later you want to remove foo. But bar and baz stay, as they may still be of use, maybe they are some shared libraries. Now, you could remove them via urpme --auto-orphans.

You can manually mark packages "un-orphaned" (i.e. remove them from /var/lib/rpm/installed-through-deps.list) by telling urpmi to install that package, that will do nothing but remove it from the orphans list, as you told urpmi directly to install it.

That is the ideal case. Just run urpme --auto-orphans (but DO NOT say yes to remove packages!!!) to see how many "orphans" you currently have. If you want to keep them, just urpmi all of them ... Then it works as you requested, and as i described.

Only other way would be to grep -F [RPM] /var/log/syslog or, starting with Mageia 3, journalctl -a | grep -F [RPM] and look for packages that were installed together with the one you want to remove to manually remove them also, but that's more fiddling ...

Warning

There is a good reason to be cautious with urpme --auto-orphans.

It is VERY easy to unintentionally remove important packages with it.

Consider this example. You have the meta-package task-kde4 (now task-plasma5) installed. A meta package is an empty package which does not contain any files, but has many other packages as dependencies. task-kde4 has 100's of packages as dependencies.

Now you remove just one of those packages because you do not want it. Say for example it is the document reader okular. Removing okular means that one of the dependencies of task-kde4 is missing and so the meta package task-kde4 is removed as well. That is fine, all the other packages which were installed as part of task-kde4 are still in place, only now they are marked as orphans. Now if you were to run urpme --auto-orphans you would see there were 100's of orphaned packages, and one press of your keyboard would erase your entire KDE installation.

Lots of newbies have caused serious damage to their installation because they paid attention to the pop up window rpmdrake shows after deleting a package about removing orphans. I for one wish that rpmdrake hid the existence of the urpme --auto-orphans option.

Tool to Manage Orphans

Since quite some time, there is a tool to manage orphans. It enables users to selective uninstall single items from the orphans list, mark single items un-orphaned (the same happens when you use urpmi with the name of an installed package, it gets marked as manually installed, effectively un-orphaned).

The tool was created by former members of the mandrivauser.de community, now proud Mageians :) It is called qt4urpm and contained in core_release repository. Project site can be found at http://sourceforge.net/projects/qt4urpm/

Mark all orphans as un-orphaned

To simply mark all orphaned packages as manually installed, one can use e.g.

 urpmi $(urpmq --auto-orphans -f)

Additional Note about Orphans

Managing Orphans in most cases is more of a technical concern than a practical one. The kind of procedure you might need if you are trying out lots of different software & have limited memory.

Related bug reports

Other method for cleaning up RPMs

Apart from orphans, there are additional methods for cleaning up your system.

Removing biggest packages

The following command will list the top 10 biggest packages on your system. If one of them is not useful to you anymore you can use urpme to remove it and optionally, also remove the orphaned packages (see above).

 rpm -qa --qf '%{SIZE} %{NAME}\n' | sort -nr | head -n 10

Removing packages which are not included in any of your repositories

If you upgraded your system (maybe several times) or manually installed some packages, there may also be some packages you would like to remove. The command below will list all packages which are not in the "Core Release" repositories (no need to specify Updates repositories: all packages in "Updates" are also in "Release") :

 rpm -qa | xargs urpmq --media "Core Release","Core 32bit Release" -r

Feel free to list the repositories you want in a comma-separated format.


To simply show all packages that are not contained in any of the currently configured repositories, use

 urpmq --not-available