Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Though granted storage permission file created not visible from Android #89

Closed
573 opened this issue Oct 2, 2020 · 15 comments
Closed

Comments

@573
Copy link
Contributor

573 commented Oct 2, 2020

I have permitted nix storage access in Android settings.
When I touch /sdcard/test in nix and try to view test in Android's Files app it is not there.
In nix I can see the created file though.
I also restarted my device just in case, no change.

@t184256
Copy link
Collaborator

t184256 commented Oct 2, 2020

Weird, I tried that and I see the file with my file manager (Amaze).

@573
Copy link
Contributor Author

573 commented Oct 3, 2020

@t184256 even with Amaze, no luck , file still not visible.
Are there debugging options ?

@t184256
Copy link
Collaborator

t184256 commented Oct 3, 2020

Debugging options for what?.. I can try to help troubleshooting it, I guess.

Does it work the other way? Create a directory in a file manager, do you see it there? What are the permissions of the file you've created with nix-on-droid? (Ideally viewed with ls -l and ls -lZ after su in a recovery session)

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

I see all files from inside nix, i. e. the created one:

-rw-rw---- 1 root 9997 ? 5 Oct 3 09:53 test

with recovery session do you mean that I restart my device in recovery mode ?

thanks for helping me troubleshoot this.

@t184256
Copy link
Collaborator

t184256 commented Oct 4, 2020

I meant exiting all Nix-on-Droid sessions and running a Nix (failsafe shell) one.

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

-rw-rw---- 1 root everybody u:object_r:sdcardfs:s0 5 2020-10-03 11:53 test

(output of ls -lZ /sdcard/)

@t184256
Copy link
Collaborator

t184256 commented Oct 4, 2020

Any differences for files created inside and outside of Nix-on-Droid?

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

Screenshot_20201004-171427
created this file in Amaze.
It is not visible in failsafe session.

1|:/data/data/com.termux.nix/files/home $
ls -lZ /sdcard/test2
ls: /sdcard/test2: No such file or directory

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

Hold on I guess /sdcard is just the wrong device or link name:

1|:/data/data/com.termux.nix/files/home $
ls /storage/9016-4EF8/test2
/storage/9016-4EF8/test2

Using /storage/9016-4EF8 works but only in this direction: created outside nix, read inside nix.

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

other direction:

1|:/data/data/com.termux.nix/files/home $
touch /storage/9016-4EF8/test3
touch: '/storage/9016-4EF8/test3': Permission denied

1|:/data/data/com.termux.nix/files/home $
ls -lZ /storage/9016-4EF8/
ls: /storage/9016-4EF8//.android_secure: Permission denied
total 168800
drwxr-xr-x 2 root everybody u:object_r:sdcardfs:s0 32768 2020-07-13 18:07 Alarms

@t184256
Copy link
Collaborator

t184256 commented Oct 4, 2020

OK, now I have only two ideas. 1) Android >9 does storage isolation in some way I've never witnessed myself. 2) you're using some tricky fs-level 'combined storage' and discovered ways to write to different backing devices. What is mounted where?

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

Regarding 2) I do hope I am not ;)

/dev/root on / type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=1385168k,nr_inodes=346292,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
none on /dev/cpuctl type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
none on /dev/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,noprefix,release_agent=/sbin/cpuset_release_agent)
none on /dev/memcg type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
none on /dev/freezer type cgroup (rw,relatime,freezer)
proc on /proc type proc (rw,relatime,gid=3009,hidepid=2)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,seclabel,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,seclabel,relatime)
pstore on /sys/fs/pstore type pstore (rw,seclabel,nosuid,nodev,noexec,relatime)
none on /sys/kernel/config type configfs (rw,relatime)
tmpfs on /mnt type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1385168k,nr_inodes=346292,mode=755,gid=1000)
tmpfs on /mnt/sde type tmpfs (rw,seclabel,relatime,size=1385168k,nr_inodes=346292,mode=700)
/dev/block/mmcblk0p5 on /mnt/vendor/cpefs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version)
/dev/block/mmcblk0p3 on /mnt/vendor/efs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version)
/data/knox/secure_fs/enc_media on /mnt/shell/enc_emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1000,fsgid=1000,gid=9997,multiuser,derive_gid,default_normal,reserved=20MB)
/data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal,reserved=20MB,unshared_obb)
/data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid,default_normal,reserved=20MB,unshared_obb)
/data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal,reserved=20MB,unshared_obb)
/data/media on /mnt/runtime/full/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal,reserved=20MB,unshared_obb)
/dev/block/vold/public:179,33 on /mnt/media_rw/9016-4EF8 type sdfat (rw,nosuid,nodev,noexec,noatime,fs=vfat:32,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,utf8,shortname=winnt,namecase=0,delay,smart,ausize=32768,adj_hid,adj_req,symlink=0,bps=512,errors=remount-ro)
/dev/block/vold/public:179,33 on /mnt/secure/asec type sdfat (rw,nosuid,nodev,noexec,noatime,fs=vfat:32,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,utf8,shortname=winnt,namecase=0,delay,smart,ausize=32768,adj_hid,adj_req,symlink=0,bps=512,errors=remount-ro)
/mnt/media_rw/9016-4EF8 on /mnt/runtime/default/9016-4EF8 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6,nocache)
/mnt/media_rw/9016-4EF8 on /mnt/runtime/read/9016-4EF8 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18,nocache)
/mnt/media_rw/9016-4EF8 on /mnt/runtime/write/9016-4EF8 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18,nocache)
/mnt/media_rw/9016-4EF8 on /mnt/runtime/full/9016-4EF8 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=7,nocache)
tmpfs on /apex type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1385168k,nr_inodes=346292,mode=755)
/dev/root on /apex/com.android.tzdata@290000000 type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.tzdata type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.runtime@1 type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.runtime type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.media@290000000 type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.media type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.media.swcodec@290000000 type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.media.swcodec type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.conscrypt@290000000 type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.conscrypt type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.resolv@290000000 type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/root on /apex/com.android.resolv type ext4 (ro,seclabel,nodev,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/etc/permissions type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/etc/permissions type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/etc/sysconfig type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/etc/sysconfig type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/omc/DBT/etc/permissions type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-1 on /product/omc/DBT/etc/sysconfig type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
/dev/block/dm-2 on /vendor type ext4 (ro,seclabel,relatime,block_validity,discard,delalloc,barrier,user_xattr,acl,i_version)
none on /acct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
none on /config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/block/mmcblk0p29 on /omr type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version)
/dev/block/mmcblk0p28 on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version)
/dev/block/mmcblk0p32 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
/dev/block/mmcblk0p4 on /efs type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,i_version)
tmpfs on /storage type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1385168k,nr_inodes=346292,mode=755,gid=1000)
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal,reserved=20MB,unshared_obb)
/mnt/media_rw/9016-4EF8 on /storage/9016-4EF8 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18,nocache)
tmpfs on /storage/self type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1385168k,nr_inodes=346292,mode=755,gid=1000)
s -lZ /storage/9016-4EF8/ <

@573
Copy link
Contributor Author

573 commented Oct 4, 2020

that's a lot of spam for some mount command I guess.

@t184256
Copy link
Collaborator

t184256 commented Oct 4, 2020

Mmm, yeah, the amount of magic going on here is beyond me. My device has it much simpler.

You seem to have /mnt/media_rw/9016-4EF8 as the backing storage for /storage/9016-4EF8 and /sdcard, and then sdcardfs might impose some per-app isolation I guess? And the /mnt/runtime/{default,read,write,full}/{emulated,9016-4EF8} sounds fun as well.

I suggest starting with Termux first to determine the correct writable sdcard location first, it should be much more popular and much more documented, might even have a wizard command to set it up or something. And when you find one that works, then proceed with testing it with Nix-on-Droid.

@573
Copy link
Contributor Author

573 commented Oct 5, 2020

I wanted to add that I can touch /mnt/sdcard/test3 in the non-failsafe, regular nix session and see the created file from outside although it's location is mapped to "internal storage" by Android (in Files app I see <internal storage>/test3).
Thus I'd say it definitely works from nix-on-droid's side.

@573 573 closed this as completed Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants