Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1669491

Summary: stream switching should be prevented with installed profiles
Product: Red Hat Enterprise Linux 8 Reporter: Karel Srot <ksrot>
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED CURRENTRELEASE QA Contact: Karel Srot <ksrot>
Severity: medium Docs Contact: Vladimír Slávik <vslavik>
Priority: high    
Version: 8.0CC: dmach, fweimer, imcleod, james.antill, jamills, jblazek, jmracek, ksrot, kwalker, ppisar, psabata, qe-baseos-security, sct, sgallagh, tbaeder, tmihinto, vslavik, wchadwic
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: rule-engine: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.0.9.2-5.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-14 00:54:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1649352    

Description Karel Srot 2019-01-25 13:05:37 UTC
Description of problem:

Per bug 1653623#c20 ( this is probably in conflict with former requirements):

We would like to prevent stream switches if their RPM content is installed (by default), issuing an error message.  We would also like to have an override flag so users who know what they are doing can proceed.

Additionally, I believe that switching streams should fail (even with no profiles installed) if the stream depends on another module which is either disabled or enabled with a different stream.

Additionally, when switching the stream a message
 """
 Switching module streams does not alter installed packages (see 'module enable' in dnf(8) for details)
 """
is printed, however the message is printed after the transaction is executed. I might be more usable to have it printed before user confirms the transaction.


Version-Release number of selected component (if applicable):
dnf-4.0.9.2-1.el8.noarch
libdnf-0.22.5-1.el8.x86_64


How reproducible:
always

Comment 2 Kyle Walker 2019-01-30 14:10:12 UTC
*** Bug 1640784 has been marked as a duplicate of this bug. ***

Comment 20 Jaroslav Mracek 2019-02-13 18:03:00 UTC
I create a pull-request (https://github.com/rpm-software-management/dnf/pull/1321) that provides requested behavior from Comment 17. The new behavior:

[jmracek@localhost libdnf]$ sudo dnf module enable perl:5.26 nodejs:10
Last metadata expiration check: 0:15:00 ago on Wed 13 Feb 2019 06:46:29 PM CET.
The operation would result in switching of module 'nodejs' stream '8' to stream '10'
The operation would result in switching of module 'perl' stream '5.24' to stream '5.26'
Error: The module stream switching is not allowed operation.
It is reccomend to remove all installed content from the module and then reset the module using 'dnf module reset <module_name>' command.
The reseting of the module allows to enable different stream.
[jmracek@localhost libdnf]$ echo $?
1

Comment 22 Stephen Gallagher 2019-02-13 18:27:03 UTC
(In reply to Jaroslav Mracek from comment #20)
> I create a pull-request
> (https://github.com/rpm-software-management/dnf/pull/1321) that provides
> requested behavior from Comment 17. The new behavior:
> 
> [jmracek@localhost libdnf]$ sudo dnf module enable perl:5.26 nodejs:10
> Last metadata expiration check: 0:15:00 ago on Wed 13 Feb 2019 06:46:29 PM
> CET.
> The operation would result in switching of module 'nodejs' stream '8' to
> stream '10'
> The operation would result in switching of module 'perl' stream '5.24' to
> stream '5.26'
> Error: The module stream switching is not allowed operation.
> It is reccomend to remove all installed content from the module and then
> reset the module using 'dnf module reset <module_name>' command.
> The reseting of the module allows to enable different stream.
> [jmracek@localhost libdnf]$ echo $?
> 1

Does `dnf module reset` work for modules with no default stream?

Comment 23 Jaroslav Mracek 2019-02-13 18:34:14 UTC
"dnf module reset" removes installed profile, and status of module independently on default present. From my test it works like expected and provide requested feature.

Comment 27 Petr Pisar 2019-02-14 09:08:09 UTC
(In reply to Jaroslav Mracek from comment #20)
> It is reccomend 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 cannnot 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 a users to "remove all installed content from the module", we need to provide a tool for it.