Skip to content

"rsync error 23" (Partial transfer due to errors) #1587

@aryoda

Description

@aryoda

This issue is meant to centralize all "error 23" issues to discuss a common solution...

Background

BiT Version 1.4.0 (2023-09-14) introduced the evaluation of rsync exit codes for better error recognition:

backintime/CHANGES

Lines 32 to 42 in 726bffa

* Fix bug: takeSnapshot() recognizes errors now by also evaluating the rsync exit code (#489)
Fixes related problem: Killing `rsync` was not handled gracefully (by ignoring the rsync exit code)
* Fix bug: The error user-callback is now always called if an error happened while taking a snapshot (#1491)
* Fix bug: D-Bus serviceHelper error "LimitExceeded: Maximum length of command line reached (100)":
Max command length is now 120 instead of 100 (#1027)
* Feature: Introduce new error codes for the "error" user callback (as part of #1491):
5: Error while taking a snapshot.
6: New snapshot taken but with errors.
* Feature: The `rsync` exit code is now contained in the snapshot log (part of #489). Example:
[E] Error: 'rsync' ended with exit code -9 (negative values are signal numbers, see 'kill -l')
* Fix bug: Treat rsync exit code 24 as INFO instead of ERROR (#1506)

Before this change rsync errors reported only via exit code were hidden and left users with the feeling that everything worked well (but didn't).

Collected reasons for rsync exit code 23

The final error message in the snapshot log is always

[I] Take snapshot (rsync: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7])
[E] 'rsync' ended with exit code 23: See 'man rsync' for more details

Here are typical snapshot log entries causing exit code 23 (shall be extended here to be extended step by step to get a holistic picture):

  • [I] Take snapshot (rsync: symlink has no referent: "/home/user/Documents/dead-link")
  • [E] Error: rsync: [sender] send_files failed to open "/home/user/Documents/root_only_file.txt": Permission denied (13)

Other known reasons: See #1587 (comment)

Current impact

Some of the reasons for exit code 23 may be out of control of the BiT user or are OK to be ignored since not considered as "severe" (eg. dead links).

Despite that BiT snapshots do always fail with an error now.

Even though rsync treats exit code 23 always as error the BiT user should have the freedom to treat some reasons for exit code 23 as INFO or WARNING only...

Possible solutions

  1. Add exit code 23 to the ignore list (as before) and let the user think everything went OK (until looking into the snapshot log)

    backintime/common/snapshots.py

    Lines 1247 to 1252 in 726bffa

    # dict of exit codes (as keys) that are treated as INFO only by BiT
    # (not as ERROR). The values are message strings for the snapshot log.
    rsync_non_error_exit_codes = {
    0: _("Success"),
    24: _("Partial transfer due to vanished source files (see 'man rsync')")
    }

  2. Find and use rsync options so that we can ignore minor exit code 23 reasons:
    https://unix.stackexchange.com/questions/598736/how-to-skip-copying-broken-links-with-rsync-copy-links

  3. Introduce a new snapshot result state "Warning" (currently we have only "OK" and "with errors)

    backintime/common/snapshots.py

    Lines 1110 to 1131 in 726bffa

    def takeSnapshot(self, sid, now, include_folders):
    """
    This is the main backup routine. It will take a new snapshot and store
    permissions of included files and folders into ``fileinfo.bz2``.
    Args:
    sid (SID): snapshot ID which the new snapshot
    should get
    now (datetime.datetime): date and time when this snapshot was
    started
    include_folders (list): folders to include. list of
    tuples (item, int) where ``int`` is 0
    if ``item`` is a folder or 1 if ``item``
    is a file
    Returns:
    list: list of two bool
    (``ret_val``, ``ret_error``)
    where ``ret_val`` is ``True`` if a new
    snapshot has been created and
    ``ret_error`` is ``True`` if there was
    an error during taking the snapshot

Challenges

rsync has several reasons for exit code 23 and always treats it as an error.

Related issues

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions