Bug 2216622

Summary: Regression: Unknown argument "--noautoremove" for command "remove".
Product: [Fedora] Fedora Reporter: Martin Pitt <mpitt>
Component: dnf5Assignee: Jan Kolarik <jkolarik>
Status: POST --- QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: agurenko, jkolarik, nsella, pkratoch, rpm-software-management
Target Milestone: ---Keywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
URL: https://artifacts.dev.testing-farm.io/958c5148-f22a-4a23-aa91-5e37a8f26188/
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Pitt 2023-06-22 05:47:06 UTC
The latest update of Rawhide moved to dnf5. This forgot about "dnf remove -y --noautoremove ...".

This option is hard to avoid -- without --noautoremove it will remove automatic dependencies (which breaks our test), and with `rpm -e` it will fail because some other (unpredictable for us) packages depend on it.

Reproducible: Always

Steps to Reproduce:
dnf remove --noautoremove bash-doc
Actual Results:  
Unknown argument "--noautoremove" for command "remove". Add "--help" for more information about the arguments.

Expected Results:  
dnf removes the specified packages and packages that depend on it, but not automatic dependencies of the specified packages -- as before.

Comment 1 Jan Kolarik 2023-06-22 06:10:46 UTC
Hi, I guess this is due to "clean_requirements_on_remove" configuration option set to True by default. You can switch it off to achieve the desired behavior, either in configuration file /etc/dnf/dnf.conf like "clean_requirements_on_remove=False" or with command-line switch: "dnf5 remove bash-doc --setopt=clean_requirements_on_remove=False".

Comment 2 Jan Kolarik 2023-06-22 06:25:12 UTC
I've tried to improve our documentation with creating this PR: https://github.com/rpm-software-management/dnf5/pull/641.

Comment 3 Martin Pitt 2023-06-22 06:40:57 UTC
Thanks for the hint about "--setopt=clean_requirements_on_remove=False". That seems to work on at least Fedora 38 as well. I'll test it in https://github.com/cockpit-project/cockpit/pull/18987 if it also works on C8S and others.

Comment 4 Martin Pitt 2023-06-22 06:48:37 UTC
❱❱❱ podman run -it --rm quay.io/centos/centos:stream8 sh -exc 'dnf install -y bash-doc; dnf remove --setopt=clean_requirements_on_remove=False bash-doc'

This actually works, nice! So we have a command that continues to work everywhere. That plus the doc update seems fine to me, thanks!

Comment 5 Fedora Release Engineering 2023-08-16 08:11:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.