Dnf btrfs snapshots with Timeshift in Fedora

Hi,

I am a developer of timeshift-autosnap-apt which runs before any update|install|remove command on Ubuntu, and works particularly well with btrfs.

I would like to have the same for Fedora 33 on btrfs, which requires changing the names of the subvolumes as I have outlined here:

Now timeshift works fine, but I was wondering if anyone knows how to implement a “DPkg::Pre-Invoke hook” in dnf? Or something similar to a Pacman trigger, but in dnf?
The idea is that when one runs a dnf update or upgrade command, timeshift should automatically create a btrfs snapshot.

2 Likes

Since your timeshift-autosnap-apt app does some really low-level, crucial things for the OS (including interfacing with grub itself, to allow booting from older BTRFS subvols), I would personally far prefer that you focus on making it ultra-stable, and ultra-reliable, squashing any and all bugs that might arise, before expanding your scope and moving into Redhat territory.

Can you demonstrate that your tool holds up under various forms of torture testing, like a laptop’s battery running out, right in the middle of some crucial operation?

How “atomic” are the crucial operations performed, such that they can gracefully be resumed/repeated again, if interrupted?

Thanks for the feedback, any contributions and collaborations to the script are more than welcome. Currently, there are some (very cool) feature requests which I’ll get to when I have the time (or someone does a Pull Request). Regarding crucial bugs: the script basically just calls timeshift to create a snapshot, so any crucial bugs of timeshift will also affect this, obviously. And there are MANY issues with timeshift as it is not so well maintained unfortunately. Nevertheless it is available in Debian, Ubuntu, Redhat and Arch territory, so I think this is fine. And most of the issues are with RSYNC and not so much with BTRFS. Here, if something happens (like battery dies) during the snapshot creation, this means that basically your snapshot might be corrupted (or most likely will just not be created), but your system subvolumes are not changed or anything. Note that the snapshot will be created before an actual update, so if something goes wrong with the update process, then you will have a snapshot of your root and/or home subvolume to return to it.

But these are my thoughts on this, I might miss something of course :slight_smile:
Anyways, any idea on the pre hook in DNF?