Failed restic backup run in proot returns exit code 0


I just ran restic check on my restic repo and noticed that my automatic backup script didn’t fail while this was running, despite the repo being locked exclusively. After taking a closer look, it turned out that the backup had failed with the expected error message (“Fatal: unable to create lock in backend: repository is already locked exclusively by PID 56385 on localhost by root (UID 0, GID 0)”), but the exit code was 0.

The command I am running (as root) is essentially the following:
proot -b /some_directory/:/to_backup restic -r rclone:backend:/repo backup /to_backup -v
For some reason, that returns 0 when run on a exclusively locked repo. Now when I remove the proot and just run sudo restic ...., it returns 1.

I am baffled by this, and I’m not sure whether this is an issue with restic or proot. I am using restic 0.15.2 and proot 5.4.0. I would be very grateful for some help.


Edit: I should add that proot doesn’t always return 0 in this setup. For instance, it correctly returns 1 when restic fails to backup because the network is down.

If restic complains about a locked repository, then it can never return exit code 0. Thus the problem must be related to proot.