linuxmint / linuxmint/timeshift

[Feature Request] Support for Pre-snapshot Hooks (Command execution before backup)

Open
#503 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vala
Stars
4.3k
Forks
155
PR merge metrics
No merged PRs in 30d

Description

Title: [Feature Request] Support for Pre-snapshot Hooks (Command execution before backup)

Description:
As a user of a high-performance workstation (Debian-based with Dual NVIDIA GPUs), I recently experienced a critical failure that could be avoided with a new feature in Timeshift: Pre-snapshot Hooks.

The Problem:
In rolling or fast-updating distributions (like Debian Testing or even Point Releases), Kernel updates often occur in the background. If a scheduled Timeshift snapshot runs after a Kernel update but before the user reboots or manually syncs the NVIDIA DKMS modules, the resulting snapshot is "broken" upon restoration.

When restored, the system files are back to the snapshot state, but the initramfs and bootloader might be out of sync with the current hardware modules, leading to the dreaded "Black Screen" (failed X11/Wayland initialization).

Proposed Solution:
Implement a "Pre-snapshot Hook" option in the configuration. This would allow users to define a script or a list of commands to be executed immediately before the rsync/btrfs process begins.

For NVIDIA/DKMS users, this hook would allow running:

dkms autoinstall

update-initramfs -u

update-grub

Benefits:

Reliability: Ensures that every snapshot is "Snapshot-Worthy" and fully bootable.

Professional Use: Professional workstations (Engineering, AI, Rendering) using proprietary drivers would have a much higher success rate in disaster recovery.

Automation: Users wouldn't need to rely on external crontab workarounds (which is what I am currently forced to use to protect my "MGQ" Workstation).

Current Workaround:
I have implemented a manual cron job that runs 10 minutes before the scheduled Timeshift backup to sync the system integrity, but a native implementation within Timeshift would be much more robust and user-friendly.

Thank you for your incredible work on this essential tool.

Dr. Mario Galindo
mario.galindo@galindoingenieria.com

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Timeshift's configuration and scheduled snapshot flow through the point where the rsync or BTRFS process begins. Review how user-defined commands could run before either snapshot method, including the listed DKMS, initramfs, and GRUB commands. Done means the hook is configurable, executes before snapshots, and handles command success or failure clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.