Bug 1398871 - dnf group remove removes packages from other groups, and explicitly installed packages
Summary: dnf group remove removes packages from other groups, and explicitly installed...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 25
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-26 21:19 UTC by FishFace
Modified: 2018-04-30 14:07 UTC (History)
6 users (show)

Fixed In Version: dnf-2.6.2-1.fc26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-25 16:55:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
What dnf wants to remove (42.48 KB, text/plain)
2016-11-26 21:19 UTC, FishFace
no flags Details

Description FishFace 2016-11-26 21:19:35 UTC
Created attachment 1224659 [details]
What dnf wants to remove

Description of problem:

I installed Fedora 24 Workstation and upgraded to Fedora 25. After this I installed KDE with the command `dnf install @kde-desktop'. I have decided I want to remove KDE again, using `dnf group remove kde-desktop' (I also tried the dnf remove version) but this command wants to remove a huge list of packages including gdm, gnome-shell, vlc and qt5ct. The latter two I installed explicitly, the former two are obviously components of Gnome that I don't want removed. At least one way this could happen is because kde-desktop includes the gnome-keyring-pam package, which is a dependency of many Gnome packages.

At first I thought this behaviour might partly be due to not having marked the Gnome Desktop group installed, but I did this and it didn't change anything. This behaviour is clearly opposed to the description of what `dnf group remove' should do (and against all common sense.) the clean_requirements_on_remove preference does affect the packages to be removed, but still displays this incorrect behaviour (and those four packages are still marked for removal)

This has the potential to damage a system if a user is not paying attention - they will obviously expect a large number of package removals and may not carefully look through the list. I only noticed because `vlc' was due to be removed - a package at the end of the list by virtue of the alphabet and one I'd installed very recently.

Version-Release number of selected component (if applicable):
1.1.10


Steps to Reproduce:
Starting from F25 Workstation
1. dnf install @kde-desktop
2. dnf remove @kde-desktop

Actual results:
A lot of Gnome components are marked for removal, and perhaps explicitly installed ones are too.

Expected results:
No packages that are part of Gnome or explicitly installed, or dependencies thereof, are marked for removal.

Comment 1 Jaroslav Mracek 2016-11-28 13:42:18 UTC
Thank you very much for your report. We know, that after fresh install of Fedora24 there is no group marked as installed. It was fixed in fc25, therefore if you will install Fedora 25, after install there should be Env group 'Fedora Workstation' installed. 

To solve your problem, please try following:
1. sudo dnf group install 'Fedora Workstation'
(it will mark env group 'Fedora Workstation' as installed)
2. Try to remove "dnf remove @kde-desktop"
(Now it should not remove components for gnome)

Please if it helps, can you close the report. If there is still an issue, please don't hesitate to report your experience. Anyway thank you for using Fedora.

Comment 2 FishFace 2016-11-28 19:54:09 UTC
This did help. However, I am not sure whether something funny is still going on; since vlc was manually installed, and gnome-shell was part of the marked-installed (by me, manually, in an attempt to work around this) group GNOME.

The dnf documentation suggests that it will not try to remove packages during a group remove operation that belong to another marked-installed group, nor user-installed packages. If I had to guess what was going on, there is something in the KDE group which is a dependency of [a dependency of...] gnome-shell, and vlc.

My understanding of the manpage - and just common sense! - say this is not good behaviour. I don't know for sure, and don't know how to easily search the dependencies to see if this is true, but presumably what has happened is that the Fedora Workstation group directly includes whatever package(s) were in KDE and depended on by GNOME, hiding the problem? I have not (yet) removed KDE to make it easier to provide more information if necessary.

Comment 3 Jaroslav Mracek 2016-11-29 07:58:41 UTC
I am really sorry, but from your description, we cannot even guess what behavior are you talking about. Probably I can provide some information about groups structure.

What was your original problem:
After installing system, installer installed env group 'Fedora Workstation', each packages was marked as installed from group, but installer (Anaconda) didn't marked that env group 'Fedora Workstation' was installed. The group can have same packages or content, therefore when you installed @kde-desktop and than removed, it also tied to remove other packages installed from by group install (system installed), that are not required by any other installed group. It also remove packages are installed as dependency, that are not required by any other user installed package.
The original problem was, that group 'Fedora Workstation' was installed but not marked as installed, therefore there were no protection of packages, because system did not see that other group this packages also require.
The reason how package was installed is stored in /var/lib/dnf/yumdb/*/*/reason by content user, dep, or group. 

Please if you will be able to provide additional information that will describe additional problem, please don't hesitate to reopen the bug report or file new bug, but because the original problem was solved I am closing it.

Comment 4 FishFace 2016-11-29 18:37:48 UTC
The original problem is not actually solved; for example, the user-installed package python3-ipython is still marked for removal when I try to remove the kde-desktop group. Hopefully I can be more precise in my description of the issue, by following the chain of dependencies for this specific package.

python3-ipython depends on:
python3-ipython-gui, which depends on:
python3-PyQt4, which depends on:
phonon.so.4, which is from:
phonon, which depends on:
phonon-backend, which is provided by:
phonon-backend-gstreamer, which is part of kde-desktop, but NOT user-installed, and NOT part of the Fedora Workstation Core.

So I think that the cause of the issue is that dnf sees phonon-backend-gstreamer, which is part of the group to be removed, not user-installed, not part of any other installed group and marks it for removal, without checking whether its removal would require the removal of any further packages which *are* user-installed or from other groups. Recall that I *had* marked the GNOME group as installed myself before filing the bug, so gnome-shell, which was set for removal earlier, should not have been; presumably what happened after marking Fedora Workstation Core as installed is that whichever dependency of gnome-shell was in kde-desktop but NOT in the GNOME group, was now marked as installed for a group from one of the other groups comprising Fedora Workstation Core.

Having actually tracked through all these dependencies I can now execute:

# rpm remove --exclude phonon-backend-gstreamer '@kde-desktop'

And python3-ipython will no longer be marked for removal.

Of course, this is not really a fun task to do for every single package that will be removed (and was even worse before I followed your instruction to mark the Fedora Workstation Core group installed!)

I could do a similar analysis for the packages that I mentioned before (vlc, for instance) but I don't think there's much need.

I hope that clarifies the problem. In particular, I'd like to point out one thing you mentioned:

>It also remove packages are installed as dependency, THAT ARE NOT REQUIRED BY ANY OTHER USER INSTALLED PACKAGE.

(capitals added by me) - this would be correct behaviour, but this seems to not be happening, otherwise python3-ipython, which is user-installed:

# dnf history userinstalled | grep ipython 
python3-ipython-3.2.1-8.fc25.noarch

would not be removed by dnf remove '@kde-desktop'.

Hopefully that explains exactly what is happening.

Comment 5 Honza Silhan 2016-12-05 12:18:01 UTC
We should investigate how yum deals with these problems.

Comment 6 Jaroslav Mracek 2017-05-16 08:00:23 UTC
Thanks a lot for information. I created a patch (https://github.com/rpm-software-management/dnf/pull/812) that should help. Please can you try it if it really solve your problem? The rpm of dnf with patch can be downloaded from copr repo (Fedora 25) - "dnf copr enable rpmsoftwaremanagement/rpm-gitoverlay-1494920340.375112"

Comment 7 Fedora Update System 2017-07-24 14:50:47 UTC
libdnf-0.9.3-1.fc26 dnf-plugins-core-2.1.3-1.fc26 dnf-2.6.2-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-6f4c06b2d7

Comment 8 Fedora Update System 2017-07-25 04:26:38 UTC
dnf-2.6.2-1.fc26, dnf-plugins-core-2.1.3-1.fc26, libdnf-0.9.3-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-6f4c06b2d7

Comment 9 Fedora Update System 2017-07-25 16:55:28 UTC
dnf-2.6.2-1.fc26, dnf-plugins-core-2.1.3-1.fc26, libdnf-0.9.3-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.