Bug 2326283 - etckeeper stop committing on dnf package install/remove
Summary: etckeeper stop committing on dnf package install/remove
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: etckeeper
Version: 41
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Thomas Moschny
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: DNF5
TreeView+ depends on / blocked
 
Reported: 2024-11-14 15:16 UTC by Jonathan GASNIER
Modified: 2025-04-18 21:21 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jonathan GASNIER 2024-11-14 15:16:43 UTC
On Fedora 40 etckeeper commit pending changes prior to any dnf package install and commit again changes following the installation.

I've updated from Fedora 40 to 41.

Since the update this behavior does work anymore.
It's like etckeeper is not called by dnf.
Dnf log does show anything regarding an etckeeper plugins.

I don't know if it is due to the switch to dnf5 or not.

Packages etckeeeper-dnf and python3-dnf are installed.

I've tried reinstall the package but it changes nothing.

Reproducible: Always

Steps to Reproduce:
1. Install etckeeper and its dependancies
2. Create a file with random content in /etc
3. Install any package with dnf
Actual Results:  
You won't see any commit in the git repository of /etc

Expected Results:  
See 2 commits in the git repository with the following messages :
- saving uncommitted changes in /etc prior to dnf run
- committing changes in /etc made by "-bash"

After the update to fedora 41, I've noticed 2 files were still in /var/cache/etckeeper/ :
- packagelist.fmt
- packagelist.pre-install

During my tests I've tried to keep them or removed them but nothing changes.

Comment 1 Michel Lind 2024-11-22 17:33:32 UTC
This is due to Fedora switching to dnf5 for Fedora 41 - the etckeeper dnf plugin is not ported yet.

It just came up in the ELN meeting (we're discussing what porting work is needed to make everything DNF5 compatible for the upcoming CentOS Stream 11 / RHEL 11) so I'll get a tracking bug created for Fedora to drive this.

Comment 2 Michel Lind 2024-11-22 21:32:25 UTC
Reported upstream: https://etckeeper.branchable.com/forum/RFE:_please_add_support_for_DNF_5/

Comment 3 Martin B. 2025-01-26 18:37:05 UTC
I tried to use Actions plugin[1] to run etckeeper via pre and post installation hooks like this:

```
# cat /etc/dnf/libdnf5-plugins/actions.d/etckeeper.actions
pre_transaction::::etckeeper pre-install
post_transaction::::etckeeper post-install
```

It seems to work, but but when `etckeeper pre-install` fails (with non zero return code), there is no way propagate this error to prevent dnf to continue and start the transaction. This is a problem eg. when you use AVOID_COMMIT_BEFORE_INSTALL=1.

So if you use AVOID_COMMIT_BEFORE_INSTALL=0, you can try that etckeeper.actions approach as a workaround until there is a proper libdnf5 plugin.

When I have a minimal working libdnf5 plugin, I will share it here. That said, I'm also considering reaching out to the maintainers of the actions plugin, as if they will be ok with extending error handling, etckeeper dnf5 integration could be implemented in a simple 2 line config file which the upstream could easily accept. 

[1] https://dnf5.readthedocs.io/en/latest/libdnf5_plugins/actions.8.html

Comment 4 Martin B. 2025-01-26 19:13:15 UTC
(In reply to Martin B. from comment #3)
> reaching out to the maintainers of the actions
> plugin, as if they will be ok with extending error handling, etckeeper dnf5
> integration could be implemented in a simple 2 line config file which the
> upstream could easily accept. 

https://github.com/rpm-software-management/dnf5/issues/2023

Comment 5 Martin B. 2025-04-18 21:21:00 UTC
With https://github.com/rpm-software-management/dnf5/issues/2023 implemented (since dnf5 5.2.11.0, Actions plugin version 1.4), it's possible to create a proper etckeeper
plugin using Actions plugin config file.

I'm proposing it upstream here: https://etckeeper.branchable.com/forum/RFE:_please_add_support_for_DNF_5/#comment-1b321f85ebaa5a57fa04a00c50c8f63e

When it will reach fedora, we will need to create a new subpackage etckeeper-dnf5
which will provide etckeeper.actions file as
/etc/dnf/libdnf5-plugins/actions.d/etckeeper.actions


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