Cannot dry-run with LVM #1093

Closed
opened 2025-05-12 05:37:37 +00:00 by jacksonchen666 · 3 comments
Contributor

What I'm trying to do and why

I'm trying to run a dry-run of borgmatic by running borgmatic -n. It cannot go through all the steps, and instead tries again. Until it fails.

Steps to reproduce

  1. Have LVM snapshots setup
  2. run borgmatic -n
  3. Experience issue

Actual behavior

Running 2 commands for pre-everything hook (dry run; not actually running hooks)
Set hook umask to 0o22
/etc/borgmatic/config.yaml: Calling file hook function load_credential
/etc/borgmatic/config.yaml: BORG_PASSPHRASE_FD=*** BORG_RELOCATED_REPO_ACCESS_IS_OK=*** BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=*** BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=*** BORG_EXIT_CODES=*** borg --version --debug --show-rc
/etc/borgmatic/config.yaml: Borg 1.4.0
/etc/borgmatic/config.yaml: Calling ntfy hook function initialize_monitor
/etc/borgmatic/config.yaml: Calling ntfy hook function ping_monitor
/etc/borgmatic/config.yaml: Pinging ntfy topic backup-flattop (dry run; not actually pinging)
/etc/borgmatic/config.yaml: Using Ntfy ping URL https://ntfy.jacksonchen666.com/backup-flattop
/etc/borgmatic/config.yaml: Calling file hook function load_credential
borgbase: Running actions for repository
borgbase: No commands to run for pre-actions hook
borgbase: No commands to run for pre-backup hook
borgbase: Creating archive (dry run; not making any changes)
borgbase: Using runtime directory /root/backups/borgmatic
borgbase: Calling bootstrap hook function remove_data_source_dumps
borgbase: Looking for bootstrap manifest files to remove in /root/backups/borgmatic/bootstrap (dry run; not actually removing anything)
borgbase: Removing bootstrap manifest at /root/backups/borgmatic/bootstrap/manifest.json (dry run; not actually removing anything)
borgbase: Calling btrfs hook function remove_data_source_dumps
borgbase: Calling lvm hook function remove_data_source_dumps
borgbase: lsblk --output name,path,mountpoint,type --json --list
borgbase: Looking for snapshots to remove in /root/backups/borgmatic/lvm_snapshots/* (dry run; not actually removing anything)
borgbase: Unmounting LVM snapshot at /root/backups/borgmatic/lvm_snapshots/3751af5bd81011e6d21d/ (dry run; not actually removing anything)
borgbase: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s
File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3
borgbase: Deleting LVM snapshot alpine-root_borgmatic-17895 (dry run; not actually removing anything)
borgbase: Calling mariadb hook function remove_data_source_dumps
borgbase: Removing MariaDB data source dumps (dry run; not actually removing anything)
borgbase: Calling mongodb hook function remove_data_source_dumps
borgbase: Removing MongoDB data source dumps (dry run; not actually removing anything)
borgbase: Calling mysql hook function remove_data_source_dumps
borgbase: Removing MySQL data source dumps (dry run; not actually removing anything)
borgbase: Calling postgresql hook function remove_data_source_dumps
borgbase: Removing PostgreSQL data source dumps (dry run; not actually removing anything)
borgbase: Calling sqlite hook function remove_data_source_dumps
borgbase: Removing SQLite data source dumps (dry run; not actually removing anything)
borgbase: Calling zfs hook function remove_data_source_dumps
borgbase: Calling bootstrap hook function dump_data_sources
borgbase: Calling lvm hook function dump_data_sources
borgbase: Snapshotting LVM logical volumes (dry run; not actually snapshotting anything)
borgbase: lsblk --output name,path,mountpoint,type --json --list
borgbase: Creating LVM snapshot alpine-root_borgmatic-18082 of / (dry run; not actually snapshotting anything)
borgbase: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s
File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3
borgbase: Error running actions for repository
borgbase: Cannot find LVM snapshot alpine-root_borgmatic-18082
borgbase: Retrying... attempt 1/3
flattop-external-drives: Running actions for repository
flattop-external-drives: No commands to run for pre-actions hook
flattop-external-drives: No commands to run for pre-backup hook
flattop-external-drives: Creating archive (dry run; not making any changes)
flattop-external-drives: Using runtime directory /root/backups/borgmatic
flattop-external-drives: Calling bootstrap hook function remove_data_source_dumps
flattop-external-drives: Looking for bootstrap manifest files to remove in /root/backups/borgmatic/bootstrap (dry run; not actually removing anything)
flattop-external-drives: Removing bootstrap manifest at /root/backups/borgmatic/bootstrap/manifest.json (dry run; not actually removing anything)
flattop-external-drives: Calling btrfs hook function remove_data_source_dumps
flattop-external-drives: Calling lvm hook function remove_data_source_dumps
flattop-external-drives: lsblk --output name,path,mountpoint,type --json --list
flattop-external-drives: Looking for snapshots to remove in /root/backups/borgmatic/lvm_snapshots/* (dry run; not actually removing anything)
flattop-external-drives: Unmounting LVM snapshot at /root/backups/borgmatic/lvm_snapshots/3751af5bd81011e6d21d/ (dry run; not actually removing anything)
flattop-external-drives: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s
File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3
flattop-external-drives: Deleting LVM snapshot alpine-root_borgmatic-17895 (dry run; not actually removing anything)
flattop-external-drives: Calling mariadb hook function remove_data_source_dumps
flattop-external-drives: Removing MariaDB data source dumps (dry run; not actually removing anything)
flattop-external-drives: Calling mongodb hook function remove_data_source_dumps
flattop-external-drives: Removing MongoDB data source dumps (dry run; not actually removing anything)
flattop-external-drives: Calling mysql hook function remove_data_source_dumps
flattop-external-drives: Removing MySQL data source dumps (dry run; not actually removing anything)
flattop-external-drives: Calling postgresql hook function remove_data_source_dumps
flattop-external-drives: Removing PostgreSQL data source dumps (dry run; not actually removing anything)
flattop-external-drives: Calling sqlite hook function remove_data_source_dumps
flattop-external-drives: Removing SQLite data source dumps (dry run; not actually removing anything)
flattop-external-drives: Calling zfs hook function remove_data_source_dumps
flattop-external-drives: Calling bootstrap hook function dump_data_sources
flattop-external-drives: Calling lvm hook function dump_data_sources
flattop-external-drives: Snapshotting LVM logical volumes (dry run; not actually snapshotting anything)
flattop-external-drives: lsblk --output name,path,mountpoint,type --json --list
flattop-external-drives: Creating LVM snapshot alpine-root_borgmatic-18082 of / (dry run; not actually snapshotting anything)
flattop-external-drives: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s
File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3
flattop-external-drives: Error running actions for repository
flattop-external-drives: Cannot find LVM snapshot alpine-root_borgmatic-18082
flattop-external-drives: Retrying... attempt 1/3
borgbase: Running actions for repository
borgbase: Sleeping 10s before next retry

Expected behavior

borgmatic handles whatever the issue is (lacking LVM snapshots) in dry-run mode and proceeds with the dry-run

Other notes / implementation ideas

No response

borgmatic version

1.9.14

borgmatic installation method

Alpine Linux

Borg version

borg 1.4.0

Python version

Python 3.12.10

Database version (if applicable)

No response

Operating system and version

Alpine Linux v3.21

### What I'm trying to do and why I'm trying to run a dry-run of borgmatic by running `borgmatic -n`. It cannot go through all the steps, and instead tries again. Until it fails. ### Steps to reproduce 1. Have LVM snapshots setup 2. run `borgmatic -n` 3. Experience issue ### Actual behavior ``` Running 2 commands for pre-everything hook (dry run; not actually running hooks) Set hook umask to 0o22 /etc/borgmatic/config.yaml: Calling file hook function load_credential /etc/borgmatic/config.yaml: BORG_PASSPHRASE_FD=*** BORG_RELOCATED_REPO_ACCESS_IS_OK=*** BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=*** BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=*** BORG_EXIT_CODES=*** borg --version --debug --show-rc /etc/borgmatic/config.yaml: Borg 1.4.0 /etc/borgmatic/config.yaml: Calling ntfy hook function initialize_monitor /etc/borgmatic/config.yaml: Calling ntfy hook function ping_monitor /etc/borgmatic/config.yaml: Pinging ntfy topic backup-flattop (dry run; not actually pinging) /etc/borgmatic/config.yaml: Using Ntfy ping URL https://ntfy.jacksonchen666.com/backup-flattop /etc/borgmatic/config.yaml: Calling file hook function load_credential borgbase: Running actions for repository borgbase: No commands to run for pre-actions hook borgbase: No commands to run for pre-backup hook borgbase: Creating archive (dry run; not making any changes) borgbase: Using runtime directory /root/backups/borgmatic borgbase: Calling bootstrap hook function remove_data_source_dumps borgbase: Looking for bootstrap manifest files to remove in /root/backups/borgmatic/bootstrap (dry run; not actually removing anything) borgbase: Removing bootstrap manifest at /root/backups/borgmatic/bootstrap/manifest.json (dry run; not actually removing anything) borgbase: Calling btrfs hook function remove_data_source_dumps borgbase: Calling lvm hook function remove_data_source_dumps borgbase: lsblk --output name,path,mountpoint,type --json --list borgbase: Looking for snapshots to remove in /root/backups/borgmatic/lvm_snapshots/* (dry run; not actually removing anything) borgbase: Unmounting LVM snapshot at /root/backups/borgmatic/lvm_snapshots/3751af5bd81011e6d21d/ (dry run; not actually removing anything) borgbase: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3 borgbase: Deleting LVM snapshot alpine-root_borgmatic-17895 (dry run; not actually removing anything) borgbase: Calling mariadb hook function remove_data_source_dumps borgbase: Removing MariaDB data source dumps (dry run; not actually removing anything) borgbase: Calling mongodb hook function remove_data_source_dumps borgbase: Removing MongoDB data source dumps (dry run; not actually removing anything) borgbase: Calling mysql hook function remove_data_source_dumps borgbase: Removing MySQL data source dumps (dry run; not actually removing anything) borgbase: Calling postgresql hook function remove_data_source_dumps borgbase: Removing PostgreSQL data source dumps (dry run; not actually removing anything) borgbase: Calling sqlite hook function remove_data_source_dumps borgbase: Removing SQLite data source dumps (dry run; not actually removing anything) borgbase: Calling zfs hook function remove_data_source_dumps borgbase: Calling bootstrap hook function dump_data_sources borgbase: Calling lvm hook function dump_data_sources borgbase: Snapshotting LVM logical volumes (dry run; not actually snapshotting anything) borgbase: lsblk --output name,path,mountpoint,type --json --list borgbase: Creating LVM snapshot alpine-root_borgmatic-18082 of / (dry run; not actually snapshotting anything) borgbase: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3 borgbase: Error running actions for repository borgbase: Cannot find LVM snapshot alpine-root_borgmatic-18082 borgbase: Retrying... attempt 1/3 flattop-external-drives: Running actions for repository flattop-external-drives: No commands to run for pre-actions hook flattop-external-drives: No commands to run for pre-backup hook flattop-external-drives: Creating archive (dry run; not making any changes) flattop-external-drives: Using runtime directory /root/backups/borgmatic flattop-external-drives: Calling bootstrap hook function remove_data_source_dumps flattop-external-drives: Looking for bootstrap manifest files to remove in /root/backups/borgmatic/bootstrap (dry run; not actually removing anything) flattop-external-drives: Removing bootstrap manifest at /root/backups/borgmatic/bootstrap/manifest.json (dry run; not actually removing anything) flattop-external-drives: Calling btrfs hook function remove_data_source_dumps flattop-external-drives: Calling lvm hook function remove_data_source_dumps flattop-external-drives: lsblk --output name,path,mountpoint,type --json --list flattop-external-drives: Looking for snapshots to remove in /root/backups/borgmatic/lvm_snapshots/* (dry run; not actually removing anything) flattop-external-drives: Unmounting LVM snapshot at /root/backups/borgmatic/lvm_snapshots/3751af5bd81011e6d21d/ (dry run; not actually removing anything) flattop-external-drives: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3 flattop-external-drives: Deleting LVM snapshot alpine-root_borgmatic-17895 (dry run; not actually removing anything) flattop-external-drives: Calling mariadb hook function remove_data_source_dumps flattop-external-drives: Removing MariaDB data source dumps (dry run; not actually removing anything) flattop-external-drives: Calling mongodb hook function remove_data_source_dumps flattop-external-drives: Removing MongoDB data source dumps (dry run; not actually removing anything) flattop-external-drives: Calling mysql hook function remove_data_source_dumps flattop-external-drives: Removing MySQL data source dumps (dry run; not actually removing anything) flattop-external-drives: Calling postgresql hook function remove_data_source_dumps flattop-external-drives: Removing PostgreSQL data source dumps (dry run; not actually removing anything) flattop-external-drives: Calling sqlite hook function remove_data_source_dumps flattop-external-drives: Removing SQLite data source dumps (dry run; not actually removing anything) flattop-external-drives: Calling zfs hook function remove_data_source_dumps flattop-external-drives: Calling bootstrap hook function dump_data_sources flattop-external-drives: Calling lvm hook function dump_data_sources flattop-external-drives: Snapshotting LVM logical volumes (dry run; not actually snapshotting anything) flattop-external-drives: lsblk --output name,path,mountpoint,type --json --list flattop-external-drives: Creating LVM snapshot alpine-root_borgmatic-18082 of / (dry run; not actually snapshotting anything) flattop-external-drives: lvs --report-format json --options lv_name,lv_path --select lv_attr =~ ^s File descriptor 3 (pipe:[5930347]) leaked on lvs invocation. Parent PID 18082: /usr/bin/python3 flattop-external-drives: Error running actions for repository flattop-external-drives: Cannot find LVM snapshot alpine-root_borgmatic-18082 flattop-external-drives: Retrying... attempt 1/3 borgbase: Running actions for repository borgbase: Sleeping 10s before next retry ``` ### Expected behavior borgmatic handles whatever the issue is (lacking LVM snapshots) in dry-run mode and proceeds with the dry-run ### Other notes / implementation ideas _No response_ ### borgmatic version 1.9.14 ### borgmatic installation method Alpine Linux ### Borg version borg 1.4.0 ### Python version Python 3.12.10 ### Database version (if applicable) _No response_ ### Operating system and version Alpine Linux v3.21
Owner

Thanks for filing this. Looking at the code, it appears that borgmatic is being a little too optimistic in what LVM hook code it's running during a dry run. Fortunately, the fix looks pretty straightforward: during a dry run, skip slightly more code than is being skipped now.

Thanks for filing this. Looking at the code, it appears that borgmatic is being a little too optimistic in what LVM hook code it's running during a dry run. Fortunately, the fix looks pretty straightforward: during a dry run, skip slightly more code than is being skipped now.
Owner

This is fixed in main and will be part of the next release!

This is fixed in main and will be part of the next release!
Owner

Released in borgmatic 2.0.6!

Released in borgmatic 2.0.6!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#1093
No description provided.