Skip to content

Backups fail when remote shell isn't bash #78

@jinnko

Description

@jinnko

I've been successfully using btrfs-sxbackup for several years. After recent system updates the backups started failing.

Local/sending system: ArchLinux
Remote system: Debian bookworm

Default shell on both sides is zsh.

In January my existing installation of btrfs-sxbackup stopped working due to local Python updates on the sending side. After re-installing this week the commands started working again, but the backup fails with:

ERROR Command '['ssh', '-o', 'ServerAliveInterval=5', '-o', 'ServerAliveCountMax=3', 'root@backup-server', 'if [ -d "/path/to/backups/.temp"* ]; then btrfs sub del "/path/to/backups/.temp"*; fi']' returned non-zero exit status 1.
ERROR zsh:1: no matches found: /path/to/backups/.temp*
Command exited with non-zero status 1

I manually tried the command via the shell, and indeed when this is run with zsh as the remote shell the exit status is 1, and when it's run via bash it's 0.

With default zsh remote shell, as executed by btrfs-sxbackup:

root in ~ ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=3 root@backup-server 'if [ -d "/path/to/backups/.temp"* ]; then btrfs sub del "/path/to/backups/.temp"*; fi'
zsh:1: no matches found: /path/to/backups/.temp*

root in ~ echo $?
1

Modify remote command to explicitly use bash:

root in ~ ssh -o ServerAliveInterval=5 -o ServerAliveCountMax=3 root@backup-server 'bash -c "if [ -d \"/path/to/backups/.temp\"* ]; then btrfs sub del \"/path/to/backups/.temp\"*; fi"'

root in ~ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions