Is dnf autoremove safe?

Removing unnecessary packages is good for reducing disk usage and potential problems, but I also remember reading somewhere that dnf autoremove could sometimes uninstall dependencies of other packages.

Is there a consensus on the safety of dnf autoremove?

On my system, it proposes removing the following packages. If I can safely remove them, that’s great, but if will create headaches, I’ll just keep them.

$ sudo dnf autoremove
Dependencies resolved.
================================================================================
 Package                 Arch   Version                Repository          Size
================================================================================
Removing:
 GeoIP                   x86_64 1.6.12-6.fc31          @fedora            359 k
 GeoIP-GeoLite-data      noarch 2018.06-4.fc31         @fedora            1.2 M
 ORBit2                  x86_64 2.14.19-22.fc31        @fedora            629 k
 PackageKit-gtk3-module  x86_64 1.1.12-11.fc31         @fedora             39 k
 celt051                 x86_64 0.5.1.3-18.fc31        @fedora            138 k
 ck                      x86_64 0.6.0-10.fc31          @fedora             53 k
 clang5.0-libs           x86_64 5.0.1-6.fc30           @fedora             70 M
 dcraw                   x86_64 9.28.0-6.fc31          @fedora            559 k
 ebtables-compat         x86_64 2.0.10-37.fc31         @fedora              0  
 ebtables-services       x86_64 2.0.10-37.fc31         @fedora            2.4 k
 efivar                  x86_64 37-1.fc30              @fedora             52 k
 espeak                  x86_64 1.48.04-16.fc31        @fedora            2.4 M
 f27-backgrounds-base    noarch 27.0.1-6.fc31          @fedora             23 M
 f27-backgrounds-mate    noarch 27.0.1-6.fc31          @fedora            311  
 faac                    x86_64 1.29.9.2-7.fc31        @rpmfusion-nonfree 226 k
 firebird                x86_64 3.0.4.33054-5.fc31     @updates            16 M
 firebird-utils          x86_64 3.0.4.33054-5.fc31     @updates           4.4 M
 ftgl                    x86_64 2.1.3-0.21.rc5.fc31    @fedora            436 k
 fwupdate-efi            x86_64 11-4.fc29              @fedora            140 k
 fwupdate-libs           x86_64 11-4.fc29              @fedora             64 k
 glade-libs              x86_64 3.22.1-5.fc31          @fedora            2.1 M
 gstreamer-plugins-good  x86_64 0.10.31-20.fc27        @anaconda          5.0 M
 gtkglext-libs           x86_64 1.2.0-35.fc31          @fedora            568 k
 gtksourceview2          x86_64 2.11.2-30.fc31         @fedora            3.4 M
 gtkspell3               x86_64 3.0.10-4.fc31          @fedora            122 k
 kf5-kactivities         x86_64 5.61.0-1.fc31          @fedora            600 k
 kf5-kdeclarative        x86_64 5.61.0-2.fc31          @fedora            1.2 M
 kf5-kpackage            x86_64 5.61.0-1.fc31          @fedora            867 k
 kf5-kwayland            x86_64 5.61.0-2.fc31          @fedora            2.4 M
 kf5-plasma              x86_64 5.61.0-1.fc31          @fedora            7.7 M
 libIDL                  x86_64 0.8.14-20.fc31         @fedora            215 k
 libXxf86misc            x86_64 1.0.4-5.fc31           @fedora             35 k
 libbonobo               x86_64 2.32.1-17.fc31         @fedora            2.0 M
 libdnet                 x86_64 1.12-31.fc31           @fedora             83 k
 libdwarf                x86_64 20191002-1.fc31        @fedora            557 k
 libechonest             x86_64 2.3.0-11.fc31          @fedora            546 k
 libfbclient2            x86_64 3.0.4.33054-5.fc31     @updates           2.2 M
 libglade2               x86_64 2.6.4-21.fc31          @fedora            165 k
 libgnome                x86_64 2.32.1-19.fc31         @fedora            4.5 M
 libib-util              x86_64 3.0.4.33054-5.fc31     @updates            15 k
 liblogging-stdlog       x86_64 1.0.6-7.fc31           @fedora             34 k
 libmimic                x86_64 1.0.4-15.fc31          @rpmfusion-free     85 k
 libopenraw              x86_64 0.1.3-6.fc31           @fedora            727 k
 libqxt                  x86_64 0.6.2-16               @rpmsphere         2.7 M
 libspiro                x86_64 20150131-11.fc31       @fedora             74 k
 libtommath              x86_64 1.0.1-10.fc31          @fedora             98 k
 libuuid-devel           x86_64 2.34-3.fc31            @fedora             18 k
 llvm5.0-libs            x86_64 5.0.1-10.fc31          @fedora             67 M
 minizip                 x86_64 2.8.9-2.fc31           @fedora            300 k
 mozjs52                 x86_64 52.9.0-5.fc31          @fedora             26 M
 munge                   x86_64 0.5.13-4.fc31          @fedora            293 k
 nss-pem                 x86_64 1.0.5-2.fc31           @fedora            401 k
 opencc                  x86_64 1.0.5-5.fc31           @fedora            5.1 M
 pangox-compat           x86_64 0.0.2-15.fc31          @fedora            171 k
 pcre                    i686   8.43-2.fc31.1          @fedora            532 k
 phonon-qt5              x86_64 4.10.2-3.fc31          @fedora            1.0 M
 phonon-qt5-backend-gstreamer
                         x86_64 2:4.9.1-1.fc31         @fedora            596 k
 plymouth-theme-charge   x86_64 0.9.4-11.20191022git32c097c.fc31
                                                       @updates           3.5 k
 pygtk2-libglade         x86_64 2.24.0-27.fc31         @updates            33 k
 python2-backports-ssl_match_hostname
                         noarch 3.5.0.1-12.fc31        @fedora             18 k
 python2-chardet         noarch 3.0.4-10.fc31          @fedora            906 k
 python2-cssselect       noarch 0.9.2-11.fc31          @fedora            158 k
 python2-gstreamer       x86_64 0.10.22-21.fc31        @fedora            1.4 M
 python2-html5lib        noarch 1:1.0.1-4.fc31         @fedora            1.2 M
 python2-idna            noarch 2.8-2.fc31             @fedora            621 k
 python2-ipaddr          noarch 2.1.10-12.fc30         @fedora            197 k
 python2-ipaddress       noarch 1.0.18-7.fc31          @fedora            228 k
 python2-joblib          noarch 0.11-6.fc29            @fedora            2.1 M
 python2-libuser         x86_64 0.62-21.fc31           @fedora             75 k
 python2-libxml2         x86_64 2.9.10-1.fc31          @updates           1.4 M
 python2-nose            noarch 1.3.7-24.fc31          @fedora            1.1 M
 python2-pygpgme         x86_64 0.3-26.fc28            @fedora            305 k
 python2-pysocks         noarch 1.7.0-2.fc31           @fedora             92 k
 python2-requests        noarch 2.22.0-3.fc31          @fedora            397 k
 python2-rpm             x86_64 4.15.1-1.fc31          @updates           187 k
 python2-setproctitle    x86_64 1.1.10-12.fc30         @fedora             43 k
 python2-urllib3         noarch 1.25.7-1.fc31          @updates           695 k
 python2-webencodings    noarch 0.5.1-8.fc31           @fedora             80 k
 python3-IPy             noarch 0.81-27.fc31           @fedora            123 k
 python3-argh            noarch 0.26.1-13.fc31         @fedora            170 k
 python3-asn1crypto      noarch 0.24.0-7.fc31          @fedora            854 k
 python3-bind            noarch 32:9.11.13-2.fc31      @updates           182 k
 python3-cffi            x86_64 1.12.3-1.fc31          @fedora            1.0 M
 python3-coverage        x86_64 4.5.4-2.fc31           @fedora            955 k
 python3-cryptography    x86_64 2.6.1-3.fc31           @updates           2.7 M
 python3-cssselect       noarch 0.9.2-11.fc31          @fedora            141 k
 python3-dmidecode       x86_64 3.12.2-16.fc31         @fedora            280 k
 python3-html5lib        noarch 1:1.0.1-4.fc31         @fedora            1.1 M
 python3-iniparse        noarch 0.4-34.fc31            @fedora            106 k
 python3-librepo         x86_64 1.11.0-1.fc31          @updates           177 k
 python3-ply             noarch 3.11-3.fc31            @fedora            430 k
 python3-pyOpenSSL       noarch 19.0.0-2.fc31          @fedora            546 k
 python3-pyaudio         x86_64 0.2.11-4.fc31          @fedora            119 k
 python3-pycparser       noarch 2.14-20.fc31           @fedora            850 k
 python3-sh              noarch 1.12.14-13.fc31        @fedora            212 k
 python3-smartcols       x86_64 0.3.0-7.fc31           @fedora            351 k
 python3-sssdconfig      noarch 2.2.2-3.fc31           @updates           186 k
 python3-webencodings    noarch 0.5.1-8.fc31           @fedora             72 k
 python3-wrapt           x86_64 1.11.2-2.fc31          @fedora            166 k
 qt5-qtgraphicaleffects  x86_64 5.12.5-1.fc31          @fedora            687 k
 qt5-qtquickcontrols     x86_64 5.12.5-1.fc31          @fedora            5.3 M
 qt5-qtquickcontrols2    x86_64 5.12.5-1.fc31          @fedora            8.8 M
 qt5-qtstyleplugins      x86_64 5.0.0-36.fc31          @fedora            1.4 M
 qtlockedfile            x86_64 2.4-29.20150629git5a07df5.fc31
                                                       @fedora             82 k
 qtsingleapplication     x86_64 2.6.1-36.fc31          @fedora            104 k
 qtsinglecoreapplication x86_64 2.6.1-36.fc31          @fedora            103 k
 texlive-powerdot        noarch 9:svn45165-6.fc31      @updates           174 k
 texlive-pst-blur        noarch 9:svn15878.2.0-6.fc31  @updates            15 k
 texlive-pst-slpe        noarch 9:svn24391.1.31-6.fc31 @updates            20 k
 texlive-type1cm         noarch 9:svn21820.0-6.fc31    @updates            16 k
 torque-libs             x86_64 4.2.10-23.fc31         @updates           338 k
 wiiuse                  x86_64 0.15.4-3.fc31          @fedora            108 k

Transaction Summary
================================================================================
Remove  112 Packages

Freed space: 299 M
Is this ok [y/N]: 

Hi @fasulia

About DNF autoremove : " Removes all “leaf” packages from the system that were originally installed as dependencies of user-installed packages, but which are no longer required by any such package.

Packages listed in installonlypkgs are never automatically removed by this command."

Personally i did use autoremove 8-10 times and never did have a problem but it doesn’t mean than will be the same in your case.

You already have a register/log of these packages that in case of that some dependencies is going to be missing you can reinstall them.

Also you can use in case of some break dependencies the command sudo dnf distro-sync
https://dnf.readthedocs.io/en/latest/command_ref.html#distro-sync-command-label

Really it is your decision because nobody know than packages did you install and why, you can see than there are old packages than obviously you don’t need like packages from previous versions of fedora.

Regards.

1 Like

Thanks for letting me know it worked ok for you.

sudo dnf distro-sync only reinstalled rpmsphere-release for me.

I’ll have to think about whether I want to take the chance with autoremove, but at least as you said, I have the list of packages in case I need it.

There are some old and some recent complaints of autoremove doing unexpected things:

https://bugzilla.redhat.com/show_bug.cgi?id=1201445

https://www.linuxquestions.org/questions/fedora-35/why-dnf-autoremove-removed-my-explicitly-installed-packages-4175555058/

About kernel to remove did i receive advise 2 times but never did delete something because this package is marked as protected so never deleted them. About the others links they are from long time ago i want believe than dnf and this option is better now. But like said i never had problems but it can not be your case. This are personal decision :wink:

Regards.

Also, if you see packages in the list you want to keep just mark them as installed

dnf mark installed <package1> <package2> ... <packageN>

This makes it so you don’t have to manually erase packages to keep the ones you want.

Thanks
Richard

2 Likes

Yeah, autoremove isn’t foolproof, though even when it does make mistakes they’re usually pretty easy to correct.

The biggest thing it can’t know about is whether any of the packages it considers unused are actually used by something outside of its control, like something installed in a user directory that requires the package. If it’s not under dnf control, it can’t be taken into account.

Just the other week a GSConnect user had DNF uninstall the gnome-shell-extensions-gsconnect system package, because he was running the updated version installed from E.G.O, and DNF removed nautilus-python with it, since it had originally been installed as a dependency of the system GSConnect package. Problem was, the extension in the user’s .local/share/gnome-shell/extensions directory still needed nautilus-python for its file manager extension.

And that wasn’t even autoremove, just the regular dependency removal logic. But, like I said, the solution was as simple as reinstalling nautilus-python. Which is a permanent fix, too, because any package that’s installed explicitly by the user is automatically marked in-use and won’t be subject to autoremove rules.

1 Like

FWIW, @fasulia, as long as it is your autoremove list actually looks pretty safe to me. It’s mostly a few categories:

  1. A lot of Qt/KDE stuff, which unless you’re running KDE as a desktop or KDE applications you probably don’t need. The important Qt stuff like QtBase, QtGui, QtWidgets etc. isn’t there, it’s all ancillary libraries.
  2. Python modules, all the python2 stuff can go for sure if nothing’s using it, and the python3 packages look much like the Qt packages – stuff that’s believably extraneous if none of the packages that originally pulled them in are still installed.
  3. Really outdated GNOME stuff. (Remember ORBit?!!?) That can definitely go.

There are a few that are questionable (I have no idea what “wiiuse” is for, but you’d probably know if you use it or not), but it’s not like uninstalling any of those is going to lock you out of your system or anything. At worst, some software complains or functions a bit weirdly. Hopefully in fairly obvious ways so it’s easy to correct.

EDIT: Oh, you might want to sudo dnf mark install gstreamer-plugins-good, that’s probably useful even if DNF doesn’t know it. But that’s basically the only item on the list I’d be reluctant to flush.

1 Like