RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2016070 - dnf rollback of a transaction with a group upgrade in it causes errors when trying to downgrade group
Summary: dnf rollback of a transaction with a group upgrade in it causes errors when t...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jan Kolarik
QA Contact: Eva Mrakova
Mariya Pershina
URL:
Whiteboard:
Depends On:
Blocks: 2122626
TreeView+ depends on / blocked
 
Reported: 2021-10-20 17:57 UTC by Alena
Modified: 2023-05-16 11:09 UTC (History)
6 users (show)

Fixed In Version: dnf-4.7.0-13.el8
Doc Type: Bug Fix
Doc Text:
.Reverting a YUM upgrade transaction is now possible for a package group or environment Previously, the `yum history rollback` command failed when attempting to revert an upgrade transaction for a package group or an environment. With this update, the issue has been fixed, and you can now revert the YUM upgrade transaction for a package group or environment.
Clone Of:
: 2122626 (view as bug list)
Environment:
Last Closed: 2023-05-16 09:06:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-100394 0 None None None 2021-10-20 18:00:37 UTC
Red Hat Product Errata RHBA-2023:2980 0 None None None 2023-05-16 09:07:24 UTC

Description Alena 2021-10-20 17:57:47 UTC
Description of problem:

Using dnf rollback on a transaction with a group upgrade in it causes issues when dnf tries to downgrade the group since downgrade isn't a valid group action.

Version-Release number of selected component (if applicable):
dnf-4.4.2-11.el8.noarch
libdnf-0.55.0-7.el8.x86_64


How reproducible:
Always 

Steps to Reproduce:

1. Release lock to get an older version of a group installed (for my testing I used 8.2)
2. Install a group. I used the "Security Tools" group, but it's reproducible with all groups:
   # yum group install 'Security Tools'
3. Upgrade the group:
   # yum group upgrade 'Security Tools'
4. Attempt to rollback, with <id> as the id before the group upgrade:
   # yum history rollback <id>


Actual results:

[root@e4e271df66fb /]# yum history rollback 3
Last metadata expiration check: 0:01:15 ago on Tue Oct 19 18:16:03 2021.
Error: The following problems occurred while running a transaction:
  Unexpected value of group action "Downgraded" for group "security-tools".


Expected results:
yum should have the ability to downgrade groups, or it should properly handle this so that the group is removed and packages are downgraded, then the group is marked installed again.

Additional info:
I got different behavior when using the deprecated 'groupupdate' syntax on the update of the group. On one occasion it threw a traceback, on the other occasion it actually removed the group and downgraded the package which is the closest to desired behavior, but still not perfect because it results in the group not being marked installed. 

There is the workaround of marking the group removed, downgrading the packages, and marking it installed, but it should not be the case that a 'yum history rollback' causes this issue in the first place, and ideally yum group would have downgrade as a valid action instead of just the following three actions:

---
534                 if action == "Install":
535                     self._swdb_group_install(group_id, pkg_types, group_data["packages"])
536                 elif action == "Upgrade":
537                     self._swdb_group_upgrade(group_id, pkg_types, group_data["packages"])
538                 elif action == "Removed":
539                     self._swdb_group_remove(group_id, pkg_types, group_data["packages"])
540                 else:
541                     errors.append(TransactionError(
542                         _('Unexpected value of group action "{action}" for group "{group}".')
543                             .format(action=action, group=group_id)
544                     ))
---
~~~

Additional info:

Comment 1 Jaroslav Mracek 2022-07-19 10:55:52 UTC
We consider the bug as a valid but because the issue has limited impact (medium priority) we postpone the issue in favor of other issues.

Comment 3 Jaroslav Mracek 2022-08-24 06:11:18 UTC
I have seen in the bug that a possible solution for undo group upgrade would be implement group downgrade functionality. But I am not sure whether is it a good idea. Let me explain what group upgrade does and then we will see what will be a good solution.

DNF upgrade
1. upgrade packages defined in group
2. install packages that were not define in group at time of the last operation with the group
3. Reason change - for new packages in the group that are already installed as a dep there can be a reason change to group (not sure whether it is there or not or whether reason change is also covered by undo operation)
4. Update a definition of the group in history DB and update what is installed from the group


During `undo`, first two points are already covered by rpm transaction elements and they are reverted. The point 3 is not reported by the issue therefore let's skip it. Then there is point 4. To revert point 4 100% correctly I am supposed to revert definition of the group to the state like the operation was never performed. I guess it is doable if we undo an operation that is the last that modified the group but if the situation in history db is like that:

1. group install core -x sssd (installs dnf, systemd, (sssd is define in group but excluded from transaction))
2. group upgrade core (at that time additional package (nodejs) was defined in the group) => upgrade dnf, systemd, install nodejs
3. group upgrade core - new set of packages defined in metadata

Then  when I perform - `dnf history undo 2` => then it is quite difficult to detect into which state the definition of the group it should be reverted.

Comment 4 Jan Kolarik 2022-08-30 13:12:52 UTC
I was checking the history DB state and after each group operation new definition of group is created, so it is easy to rollback previous state.

Comment 5 Jan Kolarik 2022-08-30 13:14:33 UTC
Following PRs were queued to fix this:

fix:   https://github.com/rpm-software-management/dnf/pull/1844
tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/1149

Comment 6 Jan Kolarik 2022-08-30 13:20:00 UTC
Cloned into RHEL9 ticket https://bugzilla.redhat.com/show_bug.cgi?id=2122626.

Comment 21 errata-xmlrpc 2023-05-16 09:06:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2980


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