Guideschevron_rightStorage

Storage · 6 min read · Updated

rsync Error 23, 24, 255 and Other Exit Codes

rsync ends every run with an exit code, and the most common ones are: 23, some files or attributes were not transferred (often permissions or a missing path); 24, files vanished while rsync was copying (normal for logs); 255, the SSH connection failed; 2 with “protocol version mismatch”, the remote shell printed text it should not have; and 127, rsync is not installed on the other end. The lines rsync prints just before the final error say which file or connection caused it. The messages below are real output from rsync 3.2.7.

The Codes You Will Actually See

Common rsync exit codes
CodeMeaningUsual cause
23Partial transfer due to errorPermission denied, a source path that does not exist, attributes the destination cannot store
24Some source files vanishedFiles deleted or rotated while rsync ran
255SSH failed ("unexplained error")Wrong host or port, refused or timed-out connection, key not accepted
2Protocol incompatibilityThe remote shell prints a banner or text on login
127Remote command not foundrsync not installed on the remote, or a wrong --rsync-path
12Error in the protocol data streamConnection dropped mid-transfer, remote disk full, remote rsync killed
11Error in file I/ODisk full or read-only at the destination
30Timeout in data send or receive--timeout reached on a stalled connection
1Syntax or usage errorA mistyped option

Error 23: Some Files Were Not Transferred

rsync: [sender] link_stat "/srv/data/missing" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1356) [sender=3.2.7]

The run completed, but the lines above the error list what was skipped. Typical fixes: correct a path that does not exist; run as a user that can read every source file (or with sudo); and when the destination cannot store owners or permissions (some network shares and storage services cannot), drop them with --no-owner --no-group or --no-perms instead of -a's defaults.

Error 24: Files Vanished

rsync builds its file list first and copies second. Files deleted in between, such as rotated logs, cache files and temporary uploads, produce file has vanished warnings and exit code 24. It is harmless. Exclude busy directories with --exclude, or treat 24 as success in your script.

Error 255: SSH Failed

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(232) [sender=3.2.7]

rsync could not get an SSH connection. Test SSH on its own with the same options; the real error appears there. A non-standard port is the classic cause: pass it with -e "ssh -p 23". Fixing SSH errors covers refused, timed-out and key problems.

ssh -p 23 USER@HOST            # does plain SSH work?
rsync -av -e "ssh -p 23" ./data/ USER@HOST:data/

Error 2: Protocol Version Mismatch

protocol version mismatch -- is your shell clean?
(see the rsync manpage for an explanation)
rsync error: protocol incompatibility (code 2) at compat.c(622) [sender=3.2.7]

rsync talks to the remote rsync over the SSH session, so anything the remote prints on login (a welcome message or an echo in .bashrc) corrupts the stream. Test with ssh USER@HOST true | wc -c: the answer must be 0. Move the output into a check that only runs for interactive shells, such as [[ $- == *i* ]] && echo hello.

Error 127: rsync Not Found on the Remote

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(232) [sender=3.2.7]

The other end has no rsync, or not where expected. Install it there (apt install rsync), or point at it with --rsync-path=/path/to/rsync. If you cannot install anything on the remote, copy with SFTP-based tools instead: see rsync vs scp vs rclone.

Error 12 and Error 11: Stream and Disk Problems

Code 12 means the data stream between the two rsyncs broke mid-transfer: the connection dropped, the remote rsync was killed, or the remote disk filled up. Code 11 is a read or write failure on a file, most often a full or read-only destination. Check free space on the destination with df -h first, then retry with --partial so large files resume instead of starting over.

Common Questions

  • Is rsync error 23 serious?

    It means the run finished but some files or attributes were not copied. Everything else was transferred. Scroll up to the lines above the error: each skipped file is listed with its reason, usually a permission problem or a path that does not exist.

  • Should a backup script treat error 24 as a failure?

    Usually not. Code 24 means files disappeared between rsync listing them and copying them, which is normal for logs and temporary files on a running system. Many backup scripts treat 0 and 24 as success and everything else as failure.

  • How do I see which files caused the error?

    rsync prints a line for each problem before the final error, starting with rsync: and the file path. Run again with -v for more detail, or with --itemize-changes to see what was and was not copied.

  • Where is the full list of exit codes?

    In the EXIT VALUES section of man rsync. Codes 255 and 127 are not in it, because they come from SSH and from the remote shell rather than from rsync itself.

Storage boxes accept rsync over SSH on port 23, so the same commands work for backups to them.

See storage boxes

Keep Reading

All guides
rsync Error 23, 24, 255 and Other Exit Codes | Virteche