Backup fails on Android: Permission denied for `.android_secure/`

Hi,

I’m trying to backup my Android phone with Kopia from within Termux.

Note:

You have to install proot in termux (pkg install proot) and then run kopia using

termux-chroot kopia

to get dns to work when using a network target as repo.

Backing up the internal “sdcard” (/storage/emulated/0) works as expected but when I try to create a snapshot for my external sdcard (/storage/0000-0000) the task fails with the following error:

ERROR: upload error: unable to stat directory entry ".android_secure": lstat /storage/0000-0000/.android_secure: permission denied

Listing the directory reveals:

$ ls -laF
ls: cannot access '.android_secure': Permission denied
total 44416
--- snip ---
drwxr-xr-x 23 root everybody   131072 May 26 11:49  ./
drwxr-xr-x  6 root root           120 May 26 01:44  ../
d?????????  ? ?    ?                ?            ?  .android_secure/
--- snip ---
drwxr-xr-x  5 root everybody   131072 Mar 16 08:57  DCIM/
drwxr-xr-x 10 root everybody   131072 May 18 08:08  Downloads/
--- snip ---

I tried to ignore this.android_secure directory using a .kopiaignore file on the sdcard and using the ignore rules in the policy. I also tried to ignore file-, directory- and unknown errors but I just can’t get it to work.

It seems like Kopia fails not during the actual backup but maybe while scanning the filesystem.

Is there anything else I can do?

I encountered a similar problem with a different filesystem: my solution was to grant read access to the directory for the user that kopia is running as. Kopia appears to check directories before ignoring them, and in some cases hard-fails when it cannot stat the directory, even if ignoreDirectoryErrors is true.

- nickersonm