Bug 1237349 - dnf autoremove not removing what dnf list extras shows
Summary: dnf autoremove not removing what dnf list extras shows
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf   
(Show other bugs)
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Reopened, Triaged
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-30 21:51 UTC by Neil
Modified: 2017-10-04 22:25 UTC (History)
11 users (show)

Fixed In Version: dnf-2.7.2-1.fc27 dnf-2.7.2-1.fc26
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-10-04 14:23:40 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
dnf history (8.34 KB, text/plain)
2015-07-12 20:31 UTC, Neil
no flags Details
dnf history info kernel-devel kernel-modules-extra (199.05 KB, text/plain)
2015-07-13 18:20 UTC, Neil
no flags Details

Description Neil 2015-06-30 21:51:21 UTC
I ran dnf autoremove, and dnf tried to remove some random packages along with kernel and kernel-devel, on their repo field it said "@System" just like any orphan package.

I don't know how you can reply this, since it happens with random packages at random moments, I fixed that with:

dnf clean metadata
dnf makecache
dnf reinstall [packages listed on dnf autoremove]


and after that dnf stops trying to remove those packages.

Comment 1 Honza Silhan 2015-07-10 14:25:56 UTC
Thanks for the report.

(In reply to Duff Padmasana from comment #0)
> I ran dnf autoremove, and dnf tried to remove some random packages

I believe the packages which was installed as dependency not explicitly specified by `dnf install PKG`

> along with kernel and kernel-devel,

Trying to remove kernel packages without reaching the installonlylimit seems like duplicate of bug 1201445. The dnf > 1.0.0 unfortunately can't fix this issue for already installed packages.

> on their repo field it said "@System" just
> like any orphan package.

DNF shows all packages installed (no matter from which repo) as @System (see bug 1234491)

> I don't know how you can reply this, since it happens with random packages
> at random moments, I fixed that with:
> 
> dnf clean metadata
> dnf makecache
> dnf reinstall [packages listed on dnf autoremove]

We have filed RFE shortcut for this (bug 1125925)

Although this report contains many duplicates I am closing it as insufficient data. If you encounter this issue again, reopen and attach output of `dnf history` containing the package name which is trying to be removed in `dnf autoremove`, please.

Comment 2 Neil 2015-07-12 20:31:56 UTC
Created attachment 1051191 [details]
dnf history

Comment 3 Neil 2015-07-12 20:33:01 UTC
$ dnf autoremove
Last metadata expiration check performed 1:21:21 ago on Sun Jul 12 14:10:55 2015.
Dependencias resueltas.
==========================================================================================
 Paquete                      Arquitectura   Versión                Repositorio     Tamaño
==========================================================================================
Eliminando:
 kernel-devel                 x86_64         4.0.7-300.fc22         @System          35 M
 kernel-modules-extra         x86_64         4.0.7-300.fc22         @System         2.1 M

Resumen de la transacción
==========================================================================================
Eliminar  2 Packages

Tamaño instalado: 37 M
Está de acuerdo [s/N]:n


Happening again.

Comment 4 Michael Mráka 2015-07-13 09:38:19 UTC
Please attach output of `dnf history info kernel-devel kernel-modules-extra`.

Comment 5 Honza Silhan 2015-07-13 11:01:23 UTC
Do you have a clean installation of f22? Can you post output of, please:
# rpm -q dnf
# dnf list kernel*
# cat /etc/dnf/dnf.conf | grep installonly_limit
# dnf install acpi --assumeno

Comment 6 Neil 2015-07-13 18:18:12 UTC
I do.

# rpm -q dnf
dnf-1.0.1-2.fc22.noarch

# dnf list kernel*
Last metadata expiration check performed 15:27:53 ago on Sun Jul 12 21:48:57 2015.
Paquetes instalados
kernel.x86_64                                                                             4.0.6-300.fc22                                                         @System
kernel.x86_64                                                                             4.0.7-300.fc22                                                         @System
kernel-core.x86_64                                                                        4.0.6-300.fc22                                                         @System
kernel-core.x86_64                                                                        4.0.7-300.fc22                                                         @System
kernel-devel.x86_64                                                                       4.0.6-300.fc22                                                         @System
kernel-devel.x86_64                                                                       4.0.7-300.fc22                                                         @System
kernel-headers.x86_64                                                                     4.0.7-300.fc22                                                         @System
kernel-modules.x86_64                                                                     4.0.6-300.fc22                                                         @System
kernel-modules.x86_64                                                                     4.0.7-300.fc22                                                         @System
kernel-modules-extra.x86_64                                                               4.0.6-300.fc22                                                         @System
kernel-modules-extra.x86_64                                                               4.0.7-300.fc22                                                         @System
kernel-tools.x86_64                                                                       4.0.7-300.fc22                                                         @System
kernel-tools-libs.x86_64                                                                  4.0.7-300.fc22                                                         @System
Paquetes disponibles
kernel-debug.x86_64                                                                       4.0.7-300.fc22                                                         updates
kernel-debug-core.x86_64                                                                  4.0.7-300.fc22                                                         updates
kernel-debug-devel.x86_64                                                                 4.0.7-300.fc22                                                         updates
kernel-debug-modules.x86_64                                                               4.0.7-300.fc22                                                         updates
kernel-debug-modules-extra.x86_64                                                         4.0.7-300.fc22                                                         updates
kernel-rpm-macros.noarch                                                                  28-1.fc22                                                              updates
kernel-tools-libs.i686                                                                    4.0.7-300.fc22                                                         updates
kernel-tools-libs-devel.i686                                                              4.0.7-300.fc22                                                         updates
kernel-tools-libs-devel.x86_64                                                            4.0.7-300.fc22                                                         updates
kernelshark.x86_64                                                                        2.2.1-5.fc22                                                           fedora 

# cat /etc/dnf/dnf.conf | grep installonly_limit
installonly_limit=3

# dnf install acpi --assumeno
Last metadata expiration check performed 0:00:00 ago on Mon Jul 13 13:17:48 2015.
Dependencias resueltas.
========================================================================================================================================================================
 Paquete                              Arquitectura                           Versión                                       Repositorio                            Tamaño
========================================================================================================================================================================
Instalando:
 acpi                                 x86_64                                 1.7-3.fc22                                    fedora                                  29 k

Resumen de la transacción
========================================================================================================================================================================
Instalar  1 Package

Tamaño total de la descarga: 29 k
Tamaño instalado: 43 k
Operación abortada.

Comment 7 Neil 2015-07-13 18:20:12 UTC
Created attachment 1051490 [details]
dnf history info kernel-devel kernel-modules-extra

Comment 8 Neil 2015-07-16 00:42:31 UTC
A couple of minutes ago, I reinstalled kernel-devel-4.0.7-300 and it disappeared from "dnf autoremove" print.

Comment 9 Neil 2015-07-29 04:28:00 UTC
Updated to kernel 4.1.2, I haven't kernel-4.0.8-300.




[root@infinity duff]# dnf autoremove
Last metadata expiration check performed 0:16:16 ago on Tue Jul 28 23:10:35 2015.
Dependencias resueltas.
==========================================================================================
 Paquete                      Arquitectura   Versión                Repositorio     Tamaño
==========================================================================================
Eliminando:
 kernel-devel                 x86_64         4.1.2-200.fc22         @System          36 M
 kernel-modules-extra         x86_64         4.1.2-200.fc22         @System         2.1 M

Resumen de la transacción
==========================================================================================
Eliminar  2 Packages

Tamaño instalado: 38 M
Está de acuerdo [s/N]:n
Operación abortada.



This is dnf autoremove output, I get this with both kernels.

Comment 10 Neil 2015-07-29 04:28:38 UTC
I haven't removed kernel-4.0.8-300*

Comment 11 Neil 2015-08-28 17:36:52 UTC
Happening again after upgrade kernel.


[root@infinity duff]# dnf list extras
Last metadata expiration check performed 9:40:56 ago on Fri Aug 28 02:54:01 2015.
Paquetes extra
kernel.x86_64                                   4.1.5-200.fc22                     @System
kernel-core.x86_64                              4.1.5-200.fc22                     @System
kernel-devel.x86_64                             4.1.5-200.fc22                     @System
kernel-modules.x86_64                           4.1.5-200.fc22                     @System
kernel-modules-extra.x86_64                     4.1.5-200.fc22                     @System



[root@infinity duff]# dnf autoremove
Last metadata expiration check performed 9:41:12 ago on Fri Aug 28 02:54:01 2015.
Dependencias resueltas.
==========================================================================================
 Paquete                      Arquitectura   Versión                Repositorio     Tamaño
==========================================================================================
Eliminando:
 kernel-devel                 x86_64         4.1.6-200.fc22         @System          36 M
 kernel-modules-extra         x86_64         4.1.6-200.fc22         @System         2.1 M

Resumen de la transacción
==========================================================================================
Eliminar  2 Packages

Comment 12 Fedora Admin XMLRPC Client 2016-07-08 09:31:15 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 13 Fedora End Of Life 2016-07-19 15:08:30 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 14 Aleksandar Kostadinov 2017-07-22 17:10:14 UTC
Just upgraded to Fedora 26. It still doesn't remove extra packages.

Comment 15 Jaroslav Mracek 2017-07-24 19:43:47 UTC
Please can you provide additional data? We need provide a reproducer, or examples where you think that dnf should remove something. Otherwise we have to close it as insufficient data.

To get list of user installed packages please use ``dnf repoquery --userinstalled``.

List of packages that requires the package: ``dnf repoquery --whatrequires <pkg>``


What is not removed by autoremove:
1. installonly packages bellow limit
2. packages that are required by any other package
3. User installed packages
4. Group installed packages
5. Packages with unknown reason (installed by yum, rpm)

Comment 16 Aleksandar Kostadinov 2017-07-24 19:58:51 UTC
Hi, in fedora post-upgrade optional tasks, it is listed to run

> dnf list --extras

These are packages now not found in any repo - old cruft. So I thought, there should be a command to get rid of them in once, instead of me copy/pasting like crazy to console.

But thinking more about it, that command also lists packages that have updates already. So what we in fact need is a command that only lists packages not found in any current repo and without updates + a command to delete such packages.

Probably the `autoremove` should not do this by default. I think it only makes sense to do it when a special command option is specified by the user.

To recap, as far as I'm concerned, I'd like to have a command that lists and is able to delete any packages ligering on the system disconnected from any currently configured repo. Why:
1. to avoid the manual work after upgrade
2. clean-up when some third party repo is removed

Comment 17 Jaroslav Mracek 2017-07-24 20:21:06 UTC
And what about:
``dnf remove $(dnf repoquery --extras) --exclude=<something,pkgs...>``


It will be nice to have a fully upgraded system to reduce a number of excludes.

Comment 18 Aleksandar Kostadinov 2017-07-24 20:33:54 UTC
The above might be a workaround (I didn't know it can work like this) and can be documented in the `dnf system-upgrade` page. I think something more polished would be better.

Comment 19 Jaroslav Mracek 2017-07-25 09:03:34 UTC
Ok, I will create an example for remove command with repoquery part, but that is all what I can do for you. Your request is so specific but I am sure that there is bunch of users that want to do something similar but not exactly what you want to do. I always prefer to use general solution rather than produce a new option (we already have to many options). Hope that you understand that.

Comment 20 Jaroslav Mracek 2017-07-25 09:26:53 UTC
I created a pull-request that provides examples (https://github.com/rpm-software-management/dnf/pull/872).

For you would be better:

``dnf remove $(dnf repoquery --extras --exclude=<something,pkgs...>)``

Comment 21 Aleksandar Kostadinov 2017-07-25 10:08:47 UTC
Looks good to me. Thank you!

Comment 22 Fedora Update System 2017-10-02 10:34:47 UTC
dnf-plugins-extras-2.0.3-1.fc27 dnf-plugins-core-2.1.4-1.fc27 dnf-2.7.2-1.fc27 libdnf-0.10.1-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 23 Fedora Update System 2017-10-02 10:38:07 UTC
dnf-plugins-extras-2.0.3-1.fc26 dnf-plugins-core-2.1.4-1.fc26 dnf-2.7.2-1.fc26 libdnf-0.10.1-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 24 Fedora Update System 2017-10-02 20:28:47 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-70a8618065

Comment 25 Fedora Update System 2017-10-02 21:28:02 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-faf235c683

Comment 26 Fedora Update System 2017-10-04 14:23:40 UTC
dnf-2.7.2-1.fc27, dnf-plugins-core-2.1.4-1.fc27, dnf-plugins-extras-2.0.3-1.fc27, libdnf-0.10.1-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 27 Fedora Update System 2017-10-04 22:25:43 UTC
dnf-2.7.2-1.fc26, dnf-plugins-core-2.1.4-1.fc26, dnf-plugins-extras-2.0.3-1.fc26, libdnf-0.10.1-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.