mount -o bind valid for root only. Users do not see the mounts - Android Q&A, Help & Troubleshooting

Hi,
My device is on 4.4.4:
I did the following as root
mount -o bind /system/test /sdcard/test
As root user, command mount returns the following
Code:
/dev/block/mmcblk0p12 /storage/sdcard0/test ext4 ro,seclabel,relatime,user_xattr,barrier=1,data=ordered 0 0
However, a normal user do not see the mount points being applied at all.
i.e. doing mount as a normal user does not return
Code:
/dev/block/mmcblk0p12 /storage/sdcard0/test ext4 ro,seclabel,relatime,user_xattr,barrier=1,data=ordered 0 0
How to make it such that normal user would see the mount options executed by root?
Edited:
I used an app called Folder Mount (requires root)
doing mount it returns the following for both normal user and root user:
Code:
/dev/block/mmcblk0p12 /mnt/media_rw/sdcard0/UCDownloads/cache/com.UCMobile.intl/httpCache ext4 ro,seclabel,noatime,nodiratime,user_xattr,barrier=1,data=ordered 0 0
So it looks like mounting with this app does propagate the mount options to also the normal user and not just root user. How do I achieve this?
Edited 2:
Another observation:
Running the exact same command
mount -o bind /system/test /sdcard/test
on another device (4.4.4) works. Now this looks like a device specific issue (but still, folder mount works on the original device). I would really appreciate it if someone know a little about what could possibly be the reason here and share it here.
Thank you.

Related

app2sd should working

see here
http://forum.xda-developers.com/showthread.php?t=804574
has anyone got this to work?
I had. But it doesn't work properly (at least for me).
Anyway you had to modify little things to make it work, the best way to try it is to launch the script line by line.
First you have to change this line:
Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
in:
Code:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
this is because the filesystem on the mini is different, you can see it by yourself launching "mount" or "df" at the prompt:
Code:
# busybox df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 84844 12 84832 0% /dev
tmpfs 4096 0 4096 0% /sqlite_stmt_journals
/dev/block/mtdblock0 210944 193648 17296 92% /system
/dev/block/mtdblock3 216832 140380 76452 65% /data
/dev/block/mtdblock1 51200 2068 49132 4% /cache
df: /data/DxDrm/fuse: Permission denied
/dev/block//vold/179:1
7223360 4086208 3137152 57% /sdcard
Anyway, when you finish all the steps and you do the reboot you don't see any light (blue or violet) simply because the script mount_iso.sh is NOT run at boottime.
(I did many tests and by now I think so)
This can lead to a big problem because the /data/app is linked to the directory /system/sd/app that doesn't exist (it's the script mount_iso.sh that mounts that dir); the risk in this case is a bricked phone (for me it was rebooting continuosly).
I made /system/sd/app a permanent dir with a limited set of apps so the phone can boot regularly, after the boot i run manually the mount_iso.sh script and all my apps on the SD go online.
By this way I can start ADW and some widget regularly but some others widgets stop working (i.e. beautiful widget).
Is it only me the script isn't run at boottime or someone else can confirm this on the X10 mini <pro>?
Is it possible to run the script at boottime in some other way?
Good testing to you
i have an idea
can anyone of you guys ceck out wat habens if you add a bootscript to
/system/drm/DxDrm/init_drm.rc
/system/etc/hw_config.sh
anyone check this please
now it should working please check it out
i can't test it

[Q] How to change SDCARD automount options?

I converted my card to ext4 and need to change the default mount options. Right now they are:
Code:
/dev/block/vold/179:33 /mnt/media_rw/sdcard1 ext4 rw,dirsync,context=u:object_r:sdcard_external:s0,nosuid,nodev,noexec,noatime 0 0
/dev/fuse /storage/sdcard1 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
But I need to replace it with
Code:
/dev/block/vold/179:33 /storage/sdcard1 ext4 rw,noatime,nosuid,nodev wait
So far, everything I tried failed:
- Editing fstab.qcom is useless because it is being recreated at each boot.
- adding a umount/mount init script
Code:
#!/system/bin/sh
VOLD="$(mount | grep -E -o -m 1 ".{0,0}179:.{0,2}")"
sleep 8
su
umount /storage/sdcard1
umount /mnt/media_rw/sdcard1
mount -rw -t ext4 -o noatime,nosuid,nodev /dev/block/vold/$VOLD /storage/sdcard1
is also useless, because although it works, it only kicks in AFTER the system is already on the desktop, which is too late.
This is all on Android 4.3.1 (but it's the same story with 4.4)
Why I want to do it?
Because although ext4 sdcard is mounted fine with read and write, the system does not see it as external anymore. As a result, many, many apps just won't work claiming there is no sdcard in the system. Even DiskUsage app does not see it.
I suppose this is because it is mounted either with FUSE or remounted directly as ext4 too late (after the system completed boot).
Any ideas?

How to auto mount cleanly a partiton on boot

I have a second partition on my SDCARD at /dev/block/mmcblk1p2, all I want to do is ensure that it is always mounted as /storage/sdcard0/mount seems simple I can do it in 5 second on Linux, on Android, it seems impossible I can try to add a hack, but that is lost every-time I update the ROM. There has to be some simple way to do it, that I'm missing. The best I have is to load up a terminal emulated su to root and run: mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount
Now in theory, the following would work but for 2 things:
mkdir /storage/sdcard0/mount
su - root -c 'mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount'
But for the fact the Android's su does not understand -c so that is out. as well as the fact that non-root users (u0_a216 in my case) can not access /storage/sdcard0.
All I want is a simple way to ensure that this is always mounted where I want it when I need it, yet this simple task is nearly impossible it appears on Android, so why is that?
The issue here is that the fat32 partition does not support large files so I need a separate partition that does such as ext4, in reality if the external sdcard could just be ext4 there would be no issues, and it would be faster, but that is Android for you.
Any suggestions?
Thanks,
ERIC
Insert mount script to init.d folder...
via XDA Premium
Ok, I have this mostly working with juicessh and tasker now for now
I have 2 shell scripts:
mountDev.sh:
Code:
mkdir /storage/sdcard2
chmod 777 /storage/sdcard2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
umountDev.sh
Code:
umount /storage/sdcard2
rmdir /storage/sdcard2
In Tasker I have 2 tasks defined:
I'm using the JuiceSSH plugin to open a terminal to localhost I then execute:
To Mount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
To umount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
I then created 2 icons, 1 for each operation on the home screen. I also created a Device Boot event to automatically execute and mount the task.
This works, mostly, however even though it is root, sometimes I get errors such as /storage/ is readonly, which makes no sense since it could create the directory at boot, but can not remove the directory later on, since it is readonly. Its a minor thing currently, but annoying.
The benefit of this is it is easy to transfer between ROM images and devices without worrying about it being wiped out every-time I update. In theory it also works without init.d support being enabled. Down side is it you need Tasker and the JuiceSSH plug-in so it costs money.
Hope this helps others.
ERIC

z5c e5823 - Fixing Boot Loop after doing mkswap on mmcblk0p*

First, I apologize if I am writing a duplicate thread. If so, please link it.
As part of my Android-hobby-experiments with a rooted Sony Xperia Z5 Compact e5823 with Android MarshMallow, I attempted to use a partition of my external microSD card as swap area but ended up in a boot loop after reboot.
I have two partitions on the microSD card. One is fat32 and the other one is linux-swap. Both partitions were made under Debian using GParted, at different timepoints.
If I remember well, I did the following on a terminal emulator:
Code:
$ su
# mkswap /dev/block/mmcblk0p2
# swapon /dev/block/mmcblk0p2
(here I got an error. something like "Invalid argument".)
# free -m
I saw no improvement, so then I did:
Code:
$ su
# mkswap /dev/block/mmcblk0p3
# swapon /dev/block/mmcblk0p3
(here I got the same error.)
# free -m
(no improvement)
# exit
$ exit
Device was working normal after this.
Hours later, I reboot the phone (the camera sometimes crashes/freezes after taking a pic, so I took a pic, screen froze, took a screenshot, and rebooted). Then I reached a boot loop.
The screen showes the Sony Xperia logo, then the screen attempts to load the "powered-by.-ndroid-animation" but instead there is a black screen and a blinking red LED (4 times). The screen is then gray and the show repeats. I turned off the phone by opening it and disconnecting the battery
Then I took the microSD card out and the SIM card aswell. I swiched on the phone and the bootloop continued. :silly:
I can enter fastboot-mode (volume up + USB connection). Which I now use to switch off the phone instead of opening and disconnecting the battery :cyclops:.
Luckily, the device on fastboot-mode is listed the under Debian by the command
Code:
$ fastboot devices -l
, so I believe in hope to fix this boot loop w/o (re)flashing a ROM
It is also possible to run a custom recovery. I have run TWRP3.0 from this post and nilezon's version from this posts using the command
Code:
$ fastboot boot recovery.img
At the very beginning of the console of the recoveries there is an error:
Code:
Updating partition details . . .
Failed to mount '/lta-label' (No such device)
. . . done
Full SELinux support is present.
MTP Enabled
--- Update ---
I used the terminal using TWRP3.0 to read the file
Code:
/etc/fstab
and it looks as follows
Code:
/dev/block/mmcblk0p43 /system ext4 rw 0 0
/dev/block/mmcblk0p42 /data ext4 rw 0 0
/dev/block/mmcblk0p41 /cache ext4 rw 0 0
/external_sd vfat rw 0 0
/usb-otg vfat rw 0 0
/dev/block/mmcblk0p3 /firmware vfat rw 0 0
/dev/block/mmcblk0p38 /appslog ext4 rw 0 0
/dev/block/mmcblk0p40 /oem ext4 rw 0 0
/dev/block/mmcblk0p31 /persist ext4 rw 0 0
/dev/block/mmcblk0p2 /lta-label swap rw 0 0
/dev/block/mmcblk0p39 /diag ext4 rw 0 0
I decided to comment out
Code:
/dev/block/mmcblk0p2 /lta-label swap rw 0 0
and reboot. Boot loop persists in the same way and at the console of the recovery there is still, at the very beginning,
Code:
Failed to mount '/lta-label' (No such device)
I rechecked the
Code:
/etc/fstab
file and my modification was gone.
--- Update 2 ---
Today After connecting the SD card with a microSD-USB-adapter Debian shows the following error:
Code:
Error mounting /dev/sdb1 at /media/user/4C25-AD09: Command-line `mount -t "vfat" -o
"uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush" "/dev/sdb1"
"/media/jk/4C25-AD09"' exited with non-zero exit status 32: mount: /dev/sdb1: can't read superblock
Still, both partitions are recognized by GParted. "/dev/sdb1" is the fat32-partition. "/dev/sdb2" is the swap-partition. I can't access the first . . .
so I am stuck. dou you guys have any suggestion about what to try next?

Symbolic link (symlink) with rooted Android 10

Hi. Everyone knows that FB app saves its downloaded images in DCIM folder. At the same time, Google Photo doesn't allow to select subfolders elegible to media auto-backup. So my idea is to create a symbolic link between that Facebook subfolder and another one on different location, and so properly save photos and videos on a different folder.
There's any way to do it? I found different procedures on different site but nothing seems to work (btw, i don't know is a procedure fault or an android 10 fault), naturally using Magisk root permissions.
peppe1996 said:
Hi. Everyone knows that FB app saves its downloaded images in DCIM folder. At the same time, Google Photo doesn't allow to select subfolders elegible to media auto-backup. So my idea is to create a symbolic link between that Facebook subfolder and another one on different location, and so properly save photos and videos on a different folder.
There's any way to do it? I found different procedures on different site but nothing seems to work (btw, i don't know is a procedure fault or an android 10 fault), naturally using Magisk root permissions.
Click to expand...
Click to collapse
When you download a photo from within the Facebook app, it is stored in DCIM/Facebook. When you launch the Gallery app, the image shows up right under "Photos". Also in the gallery app if you click on the "COLLECTIONS" tab, it shows up there under "Camera".
FYI: Creating a symlink basically doesn't require Android is got rooted, unless you want to create symlinks in Android's /system partition.
I think it's really easy to create symlinks on Android.
Example:
Code:
adb devices
adb shell "mkdir -p /data/DCIM-Facebook 2>/dev/null"
adb shell "cp -a /DCIM/Facebook /data/DCIM-Facebook"
adb shell "rm -rf /DCIM/Facebook"
adb shell "ln -sf /data/DCIM-Facebook /DCIM/Facebook"
adb shell "ls -l /DCIM/Facebook"
jwoegerbauer said:
When you download a photo from within the Facebook app, it is stored in DCIM/Facebook. When you launch the Gallery app, the image shows up right under "Photos". Also in the gallery app if you click on the "COLLECTIONS" tab, it shows up there under "Camera".
FYI: Creating a symlink basically doesn't require Android is got rooted, unless you want to create symlinks in Android's /system partition.
I think it's really easy to create symlinks on Android.
Example:
Code:
adb devices
adb shell "mkdir -p /data/DCIM-Facebook 2>/dev/null"
adb shell "cp -a /DCIM/Facebook /data/DCIM-Facebook"
adb shell "rm -rf /DCIM/Facebook"
adb shell "ln -sf /data/DCIM-Facebook /DCIM/Facebook"
adb shell "ls -l /DCIM/Facebook"
Click to expand...
Click to collapse
Thanks for the answer man. I tried your procedure and this is what happened https://ibb.co/py7mkfK
This is the classic error that i had with other procedures.
@peppe1996
My fault was to NOT tell you that symlinks only are possible on partitions that support it, means their filesystem is either ext2 or ext3 or ext4 or yaffs2.
Internal sdcard /storage/emulated/0 where folder DCIM resides has filesystem /dev/fuse. Hence my script example was totally wrong.
Sorry for this.
jwoegerbauer said:
@peppe1996
My fault was to NOT tell you that symlinks only are possible on partitions that support it, means their filesystem is either ext2 or ext3 or ext4 or yaffs2.
Internal sdcard /storage/emulated/0 where folder DCIM resides has filesystem /dev/fuse. Hence my script example was totally wrong.
Sorry for this.
Click to expand...
Click to collapse
NP man. So can I do nothing about?
@peppe1996
IMHO an alternative is to create a so-called bind mount. A bind mount is an alternate view of a directory tree. Classically, mounting creates a view of a storage device as a directory tree. A bind mount instead takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is immediately reflected on the other side, since the two views show the same data.
Example pseudo code:
Code:
mount -o bind /some/where /else/where
In your case this should problemfree work because both /sdcard/DCIM/Facebook and /sdcard/Pictures have the same filesystem.
FYI: mount command by default is available in any Android version.
IMPORTANT: Such a bind mount isn't persistent: you have to get it created everytime when Android boots up. That in turn requires to have an init.d script what does the job.
jwoegerbauer said:
@peppe1996
IMHO an alternative is to create a so-called bind mount. A bind mount is an alternate view of a directory tree. Classically, mounting creates a view of a storage device as a directory tree. A bind mount instead takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is immediately reflected on the other side, since the two views show the same data.
Example pseudo code:
Code:
mount -o bind /some/where /else/where
In your case this should problemfree work because both /sdcard/DCIM/Facebook and /sdcard/Pictures have the same filesystem.
FYI: mount command by default is available in any Android version.
IMPORTANT: Such a bind mount isn't persistent: you have to get it created everytime when Android boots up. That in turn requires to have an init.d script what does the job.
Click to expand...
Click to collapse
Thanks mate for tips, but i think this is not i need for my scope. If I'll have the same file tree in both path, Facebook images must remain in the original folder and Google Photo will upload them. If i can preserve some file to be binded, I could try to insert a .nomedia file in DCIM/Facebook. So, DCIM/Facebook will be hidden to Google Photo and i can continue to see Facebook downloaded images in Pictures folder (on the contrary, also .nomedia will be copied and also Pictures/Facebook will be not visible on Google Photo).
@peppe1996
IMHO an alternative is to create a so-called bind mount. A bind mount is an alternate view of a directory tree. Classically, mounting creates a view of a storage device as a directory tree. A bind mount instead takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is immediately reflected on the other side, since the two views show the same data.
Example pseudo code:
Code:
mount -o bind /some/where /else/where
In your case this should problemfree work because both /sdcard/DCIM/Facebook and /sdcard/Pictures have the same filesystem.
FYI: mount command by default is available in any Android version.
IMPORTANT: Such a bind mount isn't persistent: you have to get it created everytime when Android boots up. That in turn requires to have an init.d script what does the job.
Click to expand...
Click to collapse
Hello, i just bring this here up again because i have a similar problem.
I tryed your command and it passed without errors. But without the wished effect.
Code:
:/ # mount -o bind /storage/231A-1B1B/DCIM /storage/emulated/0/DCIM
This is the output of "mount"
Code:
:/ # mount <
rootfs on / type rootfs (ro,seclabel,relatime)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=891960k,nr_inodes=163101,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
none on /dev/memcg type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
none on /dev/cpuctl type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
none on /dev/bfqio type cgroup (rw,relatime,bfqio)
adb on /dev/usb-ffs/adb type functionfs (rw,relatime)
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)
tmpfs on /mnt type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=891960k,nr_inodes=163101,mode=755,gid=1000)
/dev/block/vold/public:179,65 on /mnt/media_rw/9FE1-FB0F type exfat (rw,dirsync,nosuid,nodev,noexec,noatime,fs=exfat,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=utf8,namecase=0,symlink=0,bps=512,errors=remount-ro)
/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)
/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)
/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)
/dev/block/mmcblk0p23 on /system type ext4 (ro,seclabel,relatime,discard)
none on /acct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
none on /config type configfs (rw,nosuid,nodev,noexec,relatime)
/dev/block/mmcblk0p24 on /cache type ext4 (rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,data=ordered)
/dev/block/mmcblk0p25 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,noauto_da_alloc,data=ordered)
tmpfs on /sbin type tmpfs (rw,seclabel,relatime,size=891960k,nr_inodes=163101,mode=755)
/sbin/.magisk/block/cache on /sbin/.magisk/mirror/cache type ext4 (rw,seclabel,relatime,noauto_da_alloc,data=ordered)
/sbin/.magisk/block/system on /sbin/.magisk/mirror/system type ext4 (ro,seclabel,relatime,discard)
/sbin/.magisk/block/data on /sbin/.magisk/mirror/data type ext4 (rw,seclabel,relatime,noauto_da_alloc,data=ordered)
/sbin/.magisk/block/data on /sbin/.magisk/modules type ext4 (rw,seclabel,relatime,noauto_da_alloc,data=ordered)
tmpfs on /storage type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=891960k,nr_inodes=163101,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)
tmpfs on /storage/self type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=891960k,nr_inodes=163101,mode=755,gid=1000)
/dev/block/vold/public:179,97 on /mnt/media_rw/231A-1B1B type vfat (rw,dirsync,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=utf8,shortname=mixed,utf8,errors=remount-ro)
/mnt/media_rw/231A-1B1B on /mnt/runtime/default/231A-1B1B type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6)
/mnt/media_rw/231A-1B1B on /mnt/runtime/read/231A-1B1B type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/231A-1B1B on /mnt/runtime/write/231A-1B1B type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/231A-1B1B on /storage/231A-1B1B type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
/mnt/media_rw/231A-1B1B on /storage/emulated/0/DCIM type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18)
The last line appears after i try to mount the folder. Does anybody k ow what goes wrong here?
Marco

Categories

Resources