Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1701807

Summary: dnf ignores exception error raised by plugin etckeeper-dnf
Product: [Fedora] Fedora Reporter: Alick Zhao <alick9188>
Component: dnfAssignee: rpm-software-management
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 29CC: dmach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-4.2.5-1.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-04-29 02:15:04 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:

Description Alick Zhao 2019-04-22 03:05:50 UTC
Description of problem:

This bug is about the interplay between dnf and etckeeper (more specifically the etckeeper-dnf package). etckeeper has an option that, when enabled, aborts a 'dnf upgrade/install' operation when etckeeper detects there are uncommitted changes under /etc. This used to work fine, but now on Fedora 29, after etckeeper raises an error, dnf continues upgrading/installing packages, instead of aborting and letting the user 'etckeeper commit' first.

Version-Release number of selected component (if applicable):

dnf-4.2.2-2.fc29
etckeeper-dnf-1.18.8-1.fc29
etckeeper-1.18.8-1.fc29

How reproducible:
Always

Steps to Reproduce:
1. In `/etc/etckeeper/etckeeper.conf`, uncomment `AVOID_COMMIT_BEFORE_INSTALL=1`
2. sudo dnf upgrade

Actual results:

$ sudo dnf upgrade                                                                                                                                                                     
Last metadata expiration check: 0:24:00 ago on Sun 21 Apr 2019 09:09:27 PM CDT.                                                                                                        
                                                                                                                                                                                       
** etckeeper detected uncommitted changes in /etc prior to dnf run                                                                                                                     
** Aborting dnf run. Manually commit and restart.                                                                                                                                      
                                                                                                                                                                                       
Traceback (most recent call last):                                                                                                                                                     
  File "/usr/lib/python3.7/site-packages/dnf/plugin.py", line 104, in _caller                                                                                                          
    getattr(plugin, method)()                                                                                                                                                          
  File "/usr/lib/python3.7/site-packages/dnf-plugins/etckeeper.py", line 28, in resolved                                                                                               
    raise dnf.exceptions.Error('etckeeper returned %d' % (ret >> 8))                                                                                                                   
dnf.exceptions.Error: etckeeper returned 1                                                                                                                                             
                                                                                                                                                                                       
Dependencies resolved.                                                                                                                                                                 
=======================================================================================================================================================================================
 Package                                             Architecture               Version                                            Repository                                     Size 
=======================================================================================================================================================================================
Installing:                                                                                                                                                                            
 kernel                                              x86_64                     5.0.7-200.fc29                                     updates                                        30 k 
 kernel-core                                         x86_64                     5.0.7-200.fc29                                     updates                                        26 M 
...


Expected results:

dnf aborts upon etckeeper returned 1

Additional info:
None.

Comment 1 Jaroslav Mracek 2019-04-23 10:19:39 UTC
I created a patch that runs plugins safely, but in case that plugin raises dnf.exceptions, it allows termination (https://github.com/rpm-software-management/dnf/pull/1383).

Comment 2 Fedora Update System 2019-04-25 16:43:26 UTC
dnf-4.2.5-1.fc29 libdnf-0.31.0-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2612a121ba

Comment 3 Fedora Update System 2019-04-26 22:10:06 UTC
dnf-4.2.5-1.fc29, libdnf-0.31.0-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-2612a121ba

Comment 4 Fedora Update System 2019-04-29 02:15:04 UTC
dnf-4.2.5-1.fc29, libdnf-0.31.0-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.