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 1677253 - Provide a way of removing all packages belonging to a stream
Summary: Provide a way of removing all packages belonging to a stream
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: 8.1
Assignee: Jaroslav Mracek
QA Contact: Eva Mrakova
URL:
Whiteboard:
Depends On: 1681084
Blocks: 1755139
TreeView+ depends on / blocked
 
Reported: 2019-02-14 11:34 UTC by Petr Pisar
Modified: 2021-03-01 14:05 UTC (History)
13 users (show)

Fixed In Version: dnf-4.2.17-1.el8
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:47:40 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1823 0 None None None 2020-04-28 16:47:54 UTC

Description Petr Pisar 2019-02-14 11:34:46 UTC
This request is forked from <https://bugzilla.redhat.com/show_bug.cgi?id=1669491#c27>.

DNF is going print this message:

> It is recomended to remove all installed content from the module and then
> reset the module using 'dnf module reset <module_name>' command.

How can I "remove all installed content from the module" using DNF? "dnf module remove STREAM" does not do that. It can maybe remove profiles, but it cannot clean up all packages belonging to a module: Example:

I have perl:5.24 enabled:

# dnf -q module list --enabled
Red Hat Enterprise Linux 8 AppStream - x86_64
Name      Stream       Profiles                   Summary                                 
httpd     2.4 [d][e]   common [d], devel, minimal Apache HTTP Server                      
perl      5.24 [e]     common [d], minimal        Practical Extraction and Report Language
python27  2.7 [d][e]   common [d]                 Python programming language, version 2.7
python36  3.6 [d][e]   common [d], build          Python programming language, version 3.6
virt      rhel [d][e]  common [d]                 Virtualization module                   

And some packages from perl:5.24 installed:

# rpm -q perl --qf '%{NEVRA}\n'
perl-4:5.24.4-403.module+el8+2770+c759b41a.x86_64
# dnf -q module info perl:5.24 |grep 'perl-4:5.24.4-403.module+el8+2770+c759b41a.x86_64'
Artifacts        : perl-4:5.24.4-403.module+el8+2770+c759b41a.x86_64

# dnf -q module remove perl:5.24
Unable to match profile in argument perl:5.24

If we recommend users to "remove all installed content from the module", we need to provide a tool for it.

Tested with dnf-4.0.9.2-4.el8.

Comment 1 Jaroslav Mracek 2019-02-20 09:37:49 UTC
To delivery the feature we suggest to use name of packages from artifact according to available metadata.

Comment 2 Petr Pisar 2019-02-20 09:57:43 UTC
I agree.

Comment 4 Kyle Walker 2019-06-12 12:27:52 UTC
A resounding +1 for this functionality. However, what is the plan for empty modules?


> To delivery the feature we suggest to use name of packages from artifact according to available metadata.

If a user leverages this functionality and removes a populated module stream[/profile], they would have the content removed. In the empty-module instance, you would get no effect:

  Name             : perl
  Stream           : 5.26 [d][e][a]
  Version          : 820181219174508
  Context          : 9edba152
  Profiles         : common [d] [i], minimal
  Default profiles : common
  Repo             : rhel-8-for-x86_64-appstream-rpms
  Summary          : Practical Extraction and Report Language
  Description      : Perl is a high-level programming language with roots in C, sed, awk and shell scripting. Perl is good at handling processes and files, and is especially good at handling text. Perl's hallmark>

  Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled, [a]ctive]


Though, the installation of the above module resulted in 155 packages being installed from the two primary repos:

 # yum history info last | awk '/Install/ {counts[$NF]++} END {for(idx in counts) {printf("%3d - %s\n", counts[idx], idx)}}'
  37 - @rhel-8-for-x86_64-baseos-rpms
 118 - @rhel-8-for-x86_64-appstream-rpms

Comment 5 Petr Pisar 2019-06-12 13:14:42 UTC
Are we going to uninstall a profile content or a module content? The first case calls for removing the packages listed in a profile no matter what module or a non-module they come from; the second case calls for removing artifacts belonging to the module.

However, uninstalling profiles is not easy. A package can belong to multiple profiles. A package can be installed directly by a package name (or a RPM provide or a file name), not by a profile. And should keep removing transitively dependent packages from foreign modules or non-modules? And if not, why should we stop at a border of one module? Also uninstalling profiles is not enough for purging a module content. There can be artifacts not listed in any profile.

I believe we should follow the rule that uninstalls all artifacts. Because if not, how deeply should we follow the dependency tree? Up to glibc? I woulnd't complicated this feature. It's goal is removing artifacts after resetting a stream. Nothing more. Actually DNF could simply ask after resetting a stream whether a user wants to uninstall the former stream content, so that the user does not have to issue yet another command just to follow recommendation of the same tool.

Comment 10 Jaroslav Mracek 2019-11-21 07:56:18 UTC
I created a pull request (https://github.com/rpm-software-management/dnf/pull/1536) that adds --all option for module remove command. It also adds `module repoquery` command that can be used with --available and --installed options.

Comment 12 Jaroslav Mracek 2019-11-22 07:57:32 UTC
Tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/698

Comment 17 errata-xmlrpc 2020-04-28 16:47:40 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, 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-2020:1823


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