3

On debian systems I can use aptitude markauto and aptitude unmarkauto to mark packages as manually or automatically installed. I use this to remove unneeded packages by marking the packages I know I want. Then apt-get autoremove will remove all packages that are not needed.

I'm now on a fedora system and would like a similar feature in either rpm or yum or other program. Does rpm/yum even have a concept of manual/auto installed packages like debian systems?

3 Answers 3

10

At least newer yum versions (tested on Fedora 20 with yum 3.4.3) are able to distinguish between manually-installed packages and packages installed as dependencies. This information is stored in yumdb using the key "reason" which can be either set to "user" or "dep".

# yumdb set reason dep [package name or wildcard]

should be the equivalent to "aptitude markauto". If you do not provide a package name, the change is applied to all packages. I wouldn't do that, the less radical way is to use

# yumdb search reason user

and manually remove the packages you don't want.

If you run

# yum autoremove

all packages marked as "dep" are removed if they are no longer referenced by other packages. Should be equivalent to "aptitude autoremove".

Packages installed not using yum (e.g rpm -i) might not have the "reason" key, I assume the default behavior of autoremove is to treat them as "user" packages, but they are not listed using the "yumdb search" command.

2
  • 4
    For future reference on newer systems, the dnf equivalents of the above commands are: dnf mark install [package names] to mark packages as user-installed; dnf mark remove [package names] to mark packages as installed for dependencies; and dnf autoremove to remove dependency-installed packages that are no longer needed.
    – Ben Liblit
    Oct 7, 2015 at 15:06
  • 2
    To list user installed packages: dnf repoquery --userinstalled
    – Justin
    Oct 29, 2019 at 17:12
5

With DNF

To unmark a package as user installed (ie. the package will be removed by autoremove if it is not a dependency of a user installed package):

dnf mark remove [package name or wildcard]

Conversely, to mark a package as user installed (the package will never be removed by autoremove):

dnf mark install [package name or wildcard]

There is also dnf mark group [package], which marks a package as having been installed as part of some package group. When a package is marked as installed by a group it will be removed when any group it belongs to is removed using the dnf group remove command if it is not part of another installed group.

0

No, but there's no reason one couldn't write a yum plugin to provide this ability.

2
  • So yum/rpm has no concept of manual/auto package states? Just installed/not installed?
    – Justin
    Mar 14, 2012 at 5:20
  • Correct. There's a plugin for removing leaves, but that's not quite the same thing. Mar 14, 2012 at 5:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .