Bug 1582157

Summary: [rfe] Ability to retarget installroot within a plugin post-resolve but before acting on transaction
Product: [Fedora] Fedora Reporter: Neal Gompa <ngompa13>
Component: dnfAssignee: rpm-software-management
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mblaha, packaging-team-maint, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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: 1665453    

Description Neal Gompa 2018-05-24 12:02:16 UTC
Description of problem:
I want to make a passive plugin for DNF that auto-hooks into install/remove/upgrade/distro-sync/etc. to retarget a transaction from the running system into a writable snapshot made using Btrfs.

This technique is one of the core functions of openSUSE's transactional-update[1] tool, but it's a lot more complicated because it's orchestrating Zypper instead of hooking into it.

Ultimately, I want to write a passive plugin that kicks in after successful resolution and after the user has said yes to the transaction, but before it starts the actual transaction. In the space between user acceptance and acting on the transaction, I want to create a new writable snapshot subvolume and tell DNF to change the current proposed transaction's target from the running system to the subvolume containing the writable snapshot. This subvolume snapshot might be created by Snapper, or by hand, or with some other mechanism, but whatever the process, I'd like to only proceed after the snapshot is successfully created and the transaction has been retargeted. Then after the successful transaction, I'd create a new boot to snapshot menu entry for the old state after switching the default subvolume to boot from.

[1]: https://github.com/openSUSE/transactional-update

Version-Release number of selected component (if applicable):
2.7.5-12.fc28

Comment 1 Neal Gompa 2021-04-14 01:48:36 UTC
This actually works now in libdnf, and I've implemented the txnupd plugin as proof: https://code.opensuse.org/microos/libdnf-plugin-txnupd

I'm not sure if this is possible yet at the dnf level, though.

Comment 2 Jaroslav Mracek 2023-08-09 20:02:23 UTC
Have you tried to use action plugin in DNF5?

Comment 3 Neal Gompa 2023-08-10 12:10:23 UTC
(In reply to Jaroslav Mracek from comment #2)
> Have you tried to use action plugin in DNF5?

Not yet. It's on my todo list, though.