Description of problem: When configured to avoid committing changes to /etc before installation, the etckeeper dnf plugin warns that /etc is not clean but allows dnf to proceed anyway. It should abort the dnf install, as the EPEL 7 (yum) version does. Version-Release number of selected component (if applicable): 1.18.14-1 How reproducible: Every time. Steps to Reproduce: 1. Ensure AVOID_COMMIT_BEFORE_INSTALL=1 uncommented in /etc/etckeeper/etckeeper.conf 2. Touch a new file or edit something in /etc - etckeeper unclean should exit with code 0 3. Run dnf install for a package Actual results: Last metadata expiration check: 0:27:06 ago on Mon 18 Jan 2021 13:59:04 GMT. "etckeeper pre-install" failed (exit code 1) and dnf proceeds as normal with the installation. Expected results: Equivalent behaviour of the yum plugin in EPEL 7: etckeeper: pre transaction commit ** etckeeper detected uncommitted changes in /etc prior to yum run ** Aborting yum run. Manually commit and restart. Additional info: Looks like something's wrong with the python3 translation of the plugin?
This happens on Fedora 34 as well. I'm not 100% certain, but I believe it did still work in Fedora 32. (I can check in a few days.) It's _extremely_ unpleasant to have an autocommit happen when you were expecting etckeeper to prevent autocommits.
It seems that etckeeper-1.18.12-fix-output-for-ansible.patch removes raising the exception when commit should not happen and only prints logger warning. This patch restores upstream exception (and fixes changes being committed together with the updates): diff --git a/etckeeper-dnf/etckeeper.py b/etckeeper-dnf/etckeeper.py --- a/etckeeper-dnf/etckeeper.py +++ b/etckeeper-dnf/etckeeper.py @@ -25,10 +25,8 @@ class Etckeeper(dnf.Plugin): ret = subprocess.call(("etckeeper", command), stdout=devnull, stderr=devnull, close_fds=True) - if ret > 0: - logger.warning('"etckeeper %s" failed (exit code %d)' % (command, ret)) - if ret < 0: - logger.warning('"etckeeper %s" died (signal %d)' % (command, -ret)) + if ret != 0: + raise dnf.exceptions.Error('"etckeeper %s" returned: %d' % (command, ret)) except OSError as err: logger.warning('Failed to run "etckeeper %s": %s' % (command, err)) Results: # dnf update Last metadata expiration check: 2:16:56 ago on Mon 21 Nov 2022 06:01:49 PM CET. Error: "etckeeper pre-install" returned: 1 The error message however could be improved further to indicate why it failed (as in EPEL 7).
See http://etckeeper.branchable.com/todo/DNF:_fix_logging__44___so_it_will_work_from_Ansible/#comment-001e7df84c078099b13e9329de359c2b . Before applying the patch, output caused problems when DNF was used from Ansible. On the other hand, not all DNF versions seem to cancel the transaction when an exception is generated in the plugin's hook. It is not clear to me what the correct solution is. On which OS did you test your patch?
Looking at bug 1701807, the corresponding patch https://github.com/rpm-software-management/dnf/pull/1383 seems to have been included in dnf-4.2.5, so is included in el 8.1 and later. So we could try your patch (i.e., partly reverting the etckeeper-1.18.12-fix-output-for-ansible.patch).
FEDORA-EPEL-2022-b416abaa5f has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-b416abaa5f
FEDORA-EPEL-2022-f6e51740fc has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f6e51740fc
FEDORA-2022-7d3ab5fc50 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-7d3ab5fc50
FEDORA-2022-0d644cc063 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-0d644cc063
FEDORA-2022-7d3ab5fc50 has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-7d3ab5fc50` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-7d3ab5fc50 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-b416abaa5f has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-b416abaa5f See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2022-f6e51740fc has been pushed to the Fedora EPEL 9 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-f6e51740fc See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2022-0d644cc063 has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-0d644cc063` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-0d644cc063 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
> On which OS did you test your patch? I'm using el 8.6 or el 8.7. I didn't see that initially dnf did not terminate after an exception, but I suppose this is now included after el 8.1 I haven't tested Ansible so I can't say if exception causes additional problems there.
FEDORA-EPEL-2023-892e5376ac has been pushed to the Fedora EPEL 9 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-892e5376ac See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-a427abed1e has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-a427abed1e` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-a427abed1e See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-11e40b5991 has been pushed to the Fedora 36 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-11e40b5991` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-11e40b5991 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2023-8fe90c6cd1 has been pushed to the Fedora EPEL 8 testing repository. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-8fe90c6cd1 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-EPEL-2023-8fe90c6cd1 has been pushed to the Fedora EPEL 8 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-EPEL-2023-892e5376ac has been pushed to the Fedora EPEL 9 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2023-11e40b5991 has been pushed to the Fedora 36 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2023-a427abed1e has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.