From Mageia wiki
Jump to: navigation, search
(Other method for cleaning up RPMs: +section: Remove old kernels)
(Other method for cleaning up RPMs: Per release suffix, and more)
Line 78: Line 78:
  
 
== 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.
  
Line 97: Line 98:
  
 
==== Persistent Live USB ====
 
==== Persistent Live USB ====
 +
 
Especially for a [[Installation_Media#Live_DVD_ISO | 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.
 
Especially for a [[Installation_Media#Live_DVD_ISO | 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.
  
Line 106: Line 108:
  
 
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).
 
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
+
$ rpm -qa --qf '%{SIZE} %{NAME}\n' | sort -nr | head -n 10
  
 
=== Removing packages which are not included in any of your repositories ===
 
=== 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") :
+
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" - just another version) :
 
+
$ rpm -qa | xargs urpmq --media "Core Release","Core 32bit Release" -r
  rpm -qa | xargs urpmq --media "Core Release","Core 32bit Release" -r
 
  
 
Feel free to list the repositories you want in a comma-separated format.
 
Feel free to list the repositories you want in a comma-separated format.
Line 118: Line 119:
  
 
To simply show all packages that are not contained in any of the currently configured repositories, use
 
To simply show all packages that are not contained in any of the currently configured repositories, use
 +
$ urpmq --not-available
 +
 +
==== Check per release suffix ====
 +
 +
List all packages not ".mga8":
 +
$ rpm -qa | grep -v .mga8
 +
 +
List all packages from previous version - Mageia 7 here:
 +
$ rpm -qa | grep .mga7
 +
 +
For a graphical interface method: {{prog|Mageia Control Center}} section {{menu|Software Management -> Install & Remove Software}}, in first dropdown select: "All", in second: "Installed", and in "Find" field click magnify glass symbol, select "in names" and enter "mga7" (without quotes).
 +
 +
Removing some packages from previous Mageia release may remove applications of current Mageia release - that happened me for filezilla and vlc, then just reinstall them afterwards.
  
  urpmq --not-available
+
Some packages may not want to uninstall, like Boomaga in {{Bug|28419}}. Then try command as root like {{cmd|rpm -e --noscripts boomaga-3.0.0-1.mga7}} in that case.
  
==== You may need some of them ====
+
=== You may need some of them ===
  
You may have packages installed that really do not want to uninstall, like
+
You may have packages installed that you really do not want to uninstall, but you do not realise that immediately. Examples:
* Drivers for printers fetched from the manufacturer.
+
* Drivers for printers fetched from the manufacturer - may consist of many packages
* Some nice program you fetched
+
* Some application you fetched and installed as rpm from other source than Mageia
 +
* Application you compiled and packaged locally
 +
* Application kept from previous Mageia release, [[Mageia_8_Release_Notes#Packages_removed_from_the_distribution|not available in current release]] but still working
 +
* Packages from previous Mageia releases that are needed by some of above cases
 
* ...
 
* ...
 +
 +
Keep in mind
 +
* It very rarely hurts to keep superfluous packages
 +
* If you accidentally (or for checking) remove packages - do you have them available so you can install them again?

Revision as of 17:27, 29 May 2021


Drakconf multiflag.png
Other languages
Deutsch ; English ; Français ;
Synopsis:
After many discussions about the urpme --auto-orphans command, here is a page from this [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.

Dragon-head.png 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 rpmdrake
  • mga#12567 - Target specifications about urpmi orphans mechanism
  • mga#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" - just another version) :

$ 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

Check per release suffix

List all packages not ".mga8":

$ rpm -qa | grep -v .mga8

List all packages from previous version - Mageia 7 here:

$ rpm -qa | grep .mga7

For a graphical interface method: Mageia Control Center section Software Management -> Install & Remove Software, in first dropdown select: "All", in second: "Installed", and in "Find" field click magnify glass symbol, select "in names" and enter "mga7" (without quotes).

Removing some packages from previous Mageia release may remove applications of current Mageia release - that happened me for filezilla and vlc, then just reinstall them afterwards.

Some packages may not want to uninstall, like Boomaga in mga#28419. Then try command as root like rpm -e --noscripts boomaga-3.0.0-1.mga7 in that case.

You may need some of them

You may have packages installed that you really do not want to uninstall, but you do not realise that immediately. Examples:

  • Drivers for printers fetched from the manufacturer - may consist of many packages
  • Some application you fetched and installed as rpm from other source than Mageia
  • Application you compiled and packaged locally
  • Application kept from previous Mageia release, not available in current release but still working
  • Packages from previous Mageia releases that are needed by some of above cases
  • ...

Keep in mind

  • It very rarely hurts to keep superfluous packages
  • If you accidentally (or for checking) remove packages - do you have them available so you can install them again?