minarca-shell falling back to rdiff-backup 1.2 if extra parameters are passed from rdiff-backup
After upgrading most of my homelab servers and LXC containers to Debian 12 (Bookworm), I started running into some unexpected errors which I had not seen previously.
Key info about my environment:
- I use backupninja to perform backups from my Linux servers, with ssh keys added via the Minarca web GUI
- minarca-server 5.0.3 running in a Debian 12 based LXC, host is running Proxmox VE 8.1.10
From most (but not all) of my Debian 12-based VMs or LXCs I notice that by default the argument --terminal-verbosity 3
is added to the remote ssh command issued by rdiff-backup itself, resulting in minarca-shell picking rdiff-backup-1.2. The result is errors about incompatible pickle protocol because of incompatible python versions:
Exception 'unsupported pickle protocol: 4' raised of class '<type 'exceptions.ValueError'>'
Excerpt from the minarca-shell log, /var/log/minarca/shell.log
:
[2024-04-06 00:42:12,726][INFO ][10.0.0.21][admin][MainThread][minarca_server.shell] running command [/usr/bin/rdiff-backup-1.2 --server] in jail [/backup_ext/minarca] for: rdiff-backup --terminal-verbosity 3 --server
As a workaround, I made a small change to /opt/minarca-server/lib/python3.11/site-packages/minarca_server/shell.py
on the Minarca server. Line 129, originally:
if ssh_original_command in ["rdiff-backup --server"]:
I was tempted to use regex for this, since the "in" operator doesn't support lists on the left hand side, but decided to keep the approach as similar as possible. The altered line 129:
if "rdiff-backup" in ssh_original_command and "--server" in ssh_original_command and not 'minarca' in ssh_original_command: