Here's how to do it:
On Backblaze B2, create an application key that cannot delete files:
b2 create-key --bucket MyBucket MyKeyName listBuckets,listFiles,readFiles,writeFiles
Setup the backup so that it uses that key and does not attempt to delete old backup files. For example, in
duplicity, do not use
duply, do not use
To delete old backups, set custom lifecycle settings on the bucket; for example, set lines beginning with
duplicity-full to be hidden after 360 days and deleted after another 360; and so on for files beginning with
B2 does not actually provide any functionality to "delete a file". Each time you replace the same file, it keeps its history, so a file can have "versions"—the most recent one is normally the one you need. What B2 provides is functionality for "hiding" a file. When you hide a file, you are actually recording in the file's history that the file was "deleted", you kind of add a new file version which is the hidden, or deleted, file.
Except for that, B2 also provides functionality to actually delete file versions. A user who does not have the deleteFiles permission actually does have permission to hide files, but not to delete file versions.
It seems to me that duplicity's
remove-... functionality should be implemented by hiding files. (It would then be up to the bucket's configuration to actually delete these hidden file versions after some amount of time.) However duplicity's B2's backend doesn't do this; what it does is to actually delete file versions.