Improve error message when mounting archive when multiple repositories are defined #566

Closed
opened 2022-07-24 09:07:56 +00:00 by NielsH · 6 comments

What I'm trying to do and why

We're busy migrating our backups to a different storage backend. This means we now have two different repositories defined within the borgmatic configuration.

Backups have a timestamp in their archive name, and while similar, the name is of course different on both backup repositories. Now when we attempt to mount a backup that is present on our second repository borgmatic will try to mount it from our first defined repository first. This fails, of course, and prints out a big red error message.

After that, it tries mounting it from the second defined repository, and succeeds since the archive name is present there, but the success is silent. This leads to a red error message but in fact also having succeeded in mounting it from the other repo.

This behaviour is a bit confusing.

Steps to reproduce (if a bug)

So if you have defined 2 repositories in a borgmatic config and do a borgmatic list, you'd get something like this (filtered):

ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Listing archives
demo03-2022-07-24T03:48:34.972201    Sun, 2022-07-24 03:48:36 [370e3aec0e881295dab1325b9bd6ad5a8fb746e95c25f12c991b5a0fe171af4e]
ssh://borg@10.40.5.20:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Listing archives
demo03-2022-07-24T03:49:45.410766    Sun, 2022-07-24 03:49:46 [a4bdd085d7dfe64c3832865cb1aae5c9197f34b4d58b1e67b1597094340d1dcf]

Now if we attempt to mount the secondary archive:

root@demo03:~# borgmatic mount --archive=demo03-2022-07-24T03:49:45.410766 --mount-point=/mnt
ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Error running actions for repository
Command 'borg mount --lock-wait 7200 ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52::demo03-2022-07-24T03:49:45.410766 /mnt' returned non-zero exit status 2.
/etc/borgmatic.d/aerial-bear.yaml: Error running configuration file

summary:
/etc/borgmatic.d/aerial-bear.yaml: Error running configuration file
ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Error running actions for repository
Archive demo03-2022-07-24T03:49:45.410766 does not exist
Command 'borg mount --lock-wait 7200 ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52::demo03-2022-07-24T03:49:45.410766 /mnt' returned non-zero exit status 2.

Need some help? https://torsion.org/borgmatic/#issues

However, it mounted correctly from the second backup repository:

root@demo03:~# mount | grep /mnt
borgfs on /mnt type fuse (ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions)

Other notes / implementation ideas

Perhaps when multiple repo's are present either give the error message at the end if all repo's failed to mount the supplied archive, or give an information message that:

  1. the backup is being attempted to mount from $repo
  2. Succeeded, or, when it failed, that:
  3. It is now being attempted to be mounted from $second_repo
  4. Succedeeded (repeat if >2 repo's are defined)

Environment

borgmatic version: [1.6.6]

Use sudo borgmatic --version or sudo pip show borgmatic | grep ^Version

borgmatic installation method: [pip]

Borg version: [1.2.1]

Use sudo borg --version

Python version: [3.9.2]

Use python3 --version

operating system and version: [Debian 11]

#### What I'm trying to do and why We're busy migrating our backups to a different storage backend. This means we now have two different repositories defined within the borgmatic configuration. Backups have a timestamp in their archive name, and while similar, the name is of course different on both backup repositories. Now when we attempt to mount a backup that is present on our second repository borgmatic will try to mount it from our first defined repository first. This fails, of course, and prints out a big red error message. After that, it tries mounting it from the second defined repository, and succeeds since the archive name *is* present there, but the success is silent. This leads to a red error message but in fact also having succeeded in mounting it from the other repo. This behaviour is a bit confusing. #### Steps to reproduce (if a bug) So if you have defined 2 repositories in a borgmatic config and do a borgmatic list, you'd get something like this (filtered): ``` ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Listing archives demo03-2022-07-24T03:48:34.972201 Sun, 2022-07-24 03:48:36 [370e3aec0e881295dab1325b9bd6ad5a8fb746e95c25f12c991b5a0fe171af4e] ssh://borg@10.40.5.20:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Listing archives demo03-2022-07-24T03:49:45.410766 Sun, 2022-07-24 03:49:46 [a4bdd085d7dfe64c3832865cb1aae5c9197f34b4d58b1e67b1597094340d1dcf] ``` Now if we attempt to mount the secondary archive: ``` root@demo03:~# borgmatic mount --archive=demo03-2022-07-24T03:49:45.410766 --mount-point=/mnt ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Error running actions for repository Command 'borg mount --lock-wait 7200 ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52::demo03-2022-07-24T03:49:45.410766 /mnt' returned non-zero exit status 2. /etc/borgmatic.d/aerial-bear.yaml: Error running configuration file summary: /etc/borgmatic.d/aerial-bear.yaml: Error running configuration file ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52: Error running actions for repository Archive demo03-2022-07-24T03:49:45.410766 does not exist Command 'borg mount --lock-wait 7200 ssh://borg@10.40.5.10:22/./bb9ae878-ef5b-4c4b-bbad-4490e5643d52::demo03-2022-07-24T03:49:45.410766 /mnt' returned non-zero exit status 2. Need some help? https://torsion.org/borgmatic/#issues ``` However, it mounted correctly from the second backup repository: ``` root@demo03:~# mount | grep /mnt borgfs on /mnt type fuse (ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions) ``` #### Other notes / implementation ideas Perhaps when multiple repo's are present either give the error message at the end if all repo's failed to mount the supplied archive, or give an information message that: 1. the backup is being attempted to mount from $repo 2. Succeeded, or, when it failed, that: 3. It is now being attempted to be mounted from $second_repo 4. Succedeeded (repeat if >2 repo's are defined) #### Environment **borgmatic version:** [1.6.6] Use `sudo borgmatic --version` or `sudo pip show borgmatic | grep ^Version` **borgmatic installation method:** [pip] **Borg version:** [1.2.1] Use `sudo borg --version` **Python version:** [3.9.2] Use `python3 --version` **operating system and version:** [Debian 11]
Owner

Thanks for filing this! I totally agree that the existing behavior is confusing. What do you think of making the --repository flag required for borgmatic mount if there are multiple repositories configured (or in general)? It doesn't really make sense to attempt to mount a named archive from multiple repositories onto a single mount point; one of them is going to fail.

Thanks for filing this! I totally agree that the existing behavior is confusing. What do you think of making the `--repository` flag required for `borgmatic mount` if there are multiple repositories configured (or in general)? It doesn't really make sense to attempt to mount a named archive from multiple repositories onto a single mount point; one of them is going to fail.
Author

Requiring the repository flag when multiple mountpoints are defined seems fair to me as well, with a informational message that this flag is required when attempting to mount without supplying --repository.

I personally wouldn't require it when just a single repository is defined; having it filled in automatically when there's only one possible choice to make seems more user friendly 👍

Requiring the repository flag when multiple mountpoints are defined seems fair to me as well, with a informational message that this flag is required when attempting to mount without supplying `--repository`. I personally wouldn't require it when just a single repository is defined; having it filled in automatically when there's only one possible choice to make seems more user friendly 👍
Owner

That makes sense, thanks!

That makes sense, thanks!
Owner

This is implemented in master now, and will be part of the next release. Thanks again!

This is implemented in master now, and will be part of the next release. Thanks again!
Author

Thank you!

Thank you!
Owner

Just released in borgmatic 1.7.0!

Just released in borgmatic 1.7.0!
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#566
No description provided.