(→Answer:: Links to DNF and URPMI wiki pages) |
(→Other method for cleaning up RPMs: +section: Remove old kernels) |
||
Line 79: | Line 79: | ||
== Other method for cleaning up RPMs == | == Other method for cleaning up RPMs == | ||
Apart from orphans, there are additional methods for cleaning up your system. | Apart from orphans, there are additional methods for cleaning up your system. | ||
+ | |||
+ | === Remove old kernels === | ||
+ | |||
+ | You should keep the running kernel, and one elder as fall-back. For most use cases you can safely delete elder kernels and other kernel flavours. | ||
+ | |||
+ | See [https://forums.mageia.org/en/viewtopic.php?f=7&t=14170 Forum]. For scripts, see for example [https://bugs.mageia.org/show_bug.cgi?id=24403#c29 Comment 29] or later in {{Bug|24403}} ''- Feature request : tool to remove old kernels''. | ||
=== Removing unused localisation and hardware support === | === Removing unused localisation and hardware support === |
Revision as of 13:28, 21 May 2021
Other languages Deutsch ; English ; Français ; |
Synopsis: After many discussions about the urpme --auto-orphans command, here is a page from this [thread].
|
Contents
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.
Here be dragons! URPMI and DNF use different methods to track orphans. If you ever use both you should never use either's automatic functionality to remove orphans! |
Small example:
You have a clean system as a 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 any you see, just urpmi
them ...
Then it works as aked, and described above.
Another way would be to 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 tedious...
Removing with dependencies
Example: urpme --auto-orphans task-x11
will remove x11 and the dependencies
Reference: * https://bugs.mageia.org/show_bug.cgi?id=3163#c7 - urpmi should simplify removal of meta-packages and their dependencies, similar to purge option of apt
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-plasma5
installed. A meta package is an empty package which does not contain any files, but has many other packages as dependencies. task-plasma5
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-plasma5
is missing and so the meta package task-plasma5
is removed as well. That is fine, all the other packages which were installed as part of task-plasma5
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 Plasma installation.
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
Resolved
mga#920- 'urpme --auto-orphans' message shouldn't be shown when using rpmdrakemga#12567- Target specifications about urpmi orphans mechanismmga#14594(duplicate:mga#11287) - Do not show any message about orphans when using rpmdrake / mgaapplet / drakrpm-update
To ponder
- mga#3947 - orphans detection should record requested files, not installed through deps
- mga#8123 - Add "orphaned" as selective view to rpmdrake
Other method for cleaning up RPMs
Apart from orphans, there are additional methods for cleaning up your system.
Remove old kernels
You should keep the running kernel, and one elder as fall-back. For most use cases you can safely delete elder kernels and other kernel flavours.
See Forum. For scripts, see for example Comment 29 or later in mga#24403 - Feature request : tool to remove old kernels.
Removing unused localisation and hardware support
Our tool remove-unused-packages
is what the live installer runs.
On an installed system you can start it manually in a terminal as root. Use su -
to become root. Never use just su without the dash! Or configure and use sudo.
If it finds nothing to unistall, it will exit without dialogue. If it find no unused locale it will not show that option, same for drivers.
To see what it is about to uninstall, click the Advanced button. For every localisation, typically related translations will be removed. If you think it is too much: either abort, or let it go on and reinstall what you need afterwards. Example: Personally I reinstall what I need: urpmi locales-en autocorr-en hunspell-en hyphen-en mythes-en
- Because that makes English spell check work for example when I write this... ;)
Persistent Live USB
Especially for a Live USB with persistence, and also a conventionally made installation to USB stick, it is nice to get rid of unused packages to save space on the persistent partition, and updating time and bandwidth.
( More technically precise: Packages will not be removed from the live iso read-only partition created as an image of the iso file - but to the package system they will look removed, so thus not pull updates that would otherwise be stored in the persistent partition. )
So on a booted persistent Live USB system, before updating it, remove unused localisations like this: Open a terminal, become root by entering su -
(the dash is important!), and then issue remove-unused-packages
. You will be presented a dialogue window. There typically deselect removal of hardware support (so you can still use the stick on most computers) and then click OK.
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
You may need some of them
You may have packages installed that really do not want to uninstall, like
- Drivers for printers fetched from the manufacturer.
- Some nice program you fetched
- ...