How can i mount a folder in sdcard? - Magisk

Hi,
I want to backup my phone to my pc. Due to insufficient storage space, I decide to mount a sshfs folder to sdcard directory, and then, select the mounted folder as backup target.
The sshfs utility works good, and I can access the mounted directory with "adb shell".
But all apps can not detect the newly mounted directory. They just works on the old directory.
It seems like there are two folders bind on same path. The old one is on the original internal storage, and the new one is on the ssh remote server.
For example, if I mount the sshfs to `/sdcard/backup`, the "ES File Explorer" will just see the old folder in `/sdcard/backup`. If i create a file using "ES File Explorer", then it is done successful. The "ES File Explorer" can read and edit it, and other apps works too. But I can not see the newly created file using "adb shell". And the file does not shown in the remote server. If I umount /sdcard/backup, then the newly created file can be listed using "ls" in "adb shell".
And when the sshfs mounted, if I create the file using "touch" command in "adb shell", then the file appears on the remote server.
I have noticed that there are a lot of "sdcard" paths, so I may mount the sshfs to a wrong path. But I have tried these paths, none of them works:
```
/storage/emulated/0/backup
/data/media/0/backup
/sdcard/backup
```
Then, I uninstalled magisk, and try mount sshfs to `/storage/emulated/0/backup`. This time, all apps can detect the sshfs, all created files can be sent to remote server.
I have compared the mountpoint before and after enable magisk, it seems that magisk introduce a lot of mountpoint from `/dev/.d***/`. So am i mount the sshfs to a wrong path when magisk enabled?
And how can i mount to a right path?
OS: Android 11
Magisk: 23.0
Thank you!

Related

ADB Shell not working, but my N1 isn't bricked

I wanted to use USB Tunnel to share my PC's internet connection with the phone, but I got the error:
Code:
- exec '/system/bin/sh' failed: No such file or directory (2) -
I tried to install other APK's through ADB and they also failed, so I googled this error and I saw that the main issue is a failing ADB Shell. I tried to open Shell and I got the same error. The difference between me and the other users is that my phone is booting as usual, USB Mass Storage works, the phone is detected by fastboot- and adb devices commands and everything is working as intended, except for installing APKs through ADB/opening Shell.
Here is my phone's current config:
MeDroidMod 1.4.4 w/ HWA
Latest Tiamat kernel
TexasICE HBOOT w/ 210/8/218 partition layout
4GB microSD card...I don't know the filesystem but it's definitely NOT ext4, so there's not A2SD for me (I think it's FAT or FAT32)
ClockWorkMod Recovery
gnexus47 said:
I wanted to use USB Tunnel to share my PC's internet connection with the phone, but I got the error:
Code:
- exec '/system/bin/sh' failed: No such file or directory (2) -
I tried to install other APK's through ADB and they also failed, so I googled this error and I saw that the main issue is a failing ADB Shell. I tried to open Shell and I got the same error. The difference between me and the other users is that my phone is booting as usual, USB Mass Storage works, the phone is detected by fastboot- and adb devices commands and everything is working as intended, except for installing APKs through ADB/opening Shell.
Here is my phone's current config:
MeDroidMod 1.4.4 w/ HWA
Latest Tiamat kernel
TexasICE HBOOT w/ 210/8/218 partition layout
4GB microSD card...I don't know the filesystem but it's definitely NOT ext4, so there's not A2SD for me (I think it's FAT or FAT32)
ClockWorkMod Recovery
Click to expand...
Click to collapse
Which adb commands did you use? Can you list the commands here that you had used? It could be that you didn't issue su command to get superuser rights?
you don't need to be in Shell to push apk
put the apk on your C: drive
open command window and navigate to the folder you have adb/fastboot in--normally tools of your sdk
then:
type adb devices--then
1. adb remount
2. adb push C:/CalendarGoogle.apk /system/app/CalendarGoogle.apk
3. adb push C:/CalendarProvider.apk /system/app/CalendarProvider.apk
4. adb shell
7. chmod 777 system/app/CalendarGoogle.apk
11. chmod 777 system/app/CalendarProvider.apk
12. exit
13. Reboot
use the apk name of whatever you are flashing in place of mine and your chmod may not be exactly like mine--
ADB Shell
rugmankc said:
you don't need to be in Shell to push apk
put the apk on your C: drive
open command window and navigate to the folder you have adb/fastboot in--normally tools of your sdk
then:
type adb devices--then
1. adb remount
2. adb push C:/CalendarGoogle.apk /system/app/CalendarGoogle.apk
3. adb push C:/CalendarProvider.apk /system/app/CalendarProvider.apk
4. adb shell
7. chmod 777 system/app/CalendarGoogle.apk
11. chmod 777 system/app/CalendarProvider.apk
12. exit
13. Reboot
use the apk name of whatever you are flashing in place of mine and your chmod may not be exactly like mine--
Click to expand...
Click to collapse
I don't use ADB Shell to push APK's. That's just another thing which doesn't work.
@taodan: I only use: adb install xxxxx.apk.
A work around is to mount the sdcard and drag and drop the apks to the sdcard. Then install using your favorite file manager.
evilkorn said:
A work around is to mount the sdcard and drag and drop the apks to the sdcard. Then install using your favorite file manager.
Click to expand...
Click to collapse
that will work too, i've used root explorer to copy paste from sdcard to correct file location. prefer adb. set your permissions after
did you try adb remount first, not sure if that would help
what i was saying is you don't need to type adb shell. assuming you are doing this from a pc command terminal window.
you can use the commands I gave above to push apk. i think when you push it copies apk to phone leaving apk on pc also. install actually moves it to phone--as i understand it
here is some links and info that might help.*
http://www.talkandroid.com/guides/beginner/install-apk-files-on-android/#.T2-cdaJST3U
http://www.brighthub.com/mobile/google-android/articles/37151.aspx
also, have you ever had luck installing/pushing apk's. you may not have the correct environmental path on pc or are typing incorrect path in your command line
you can google environmental path editing for android and get examples of how to do it--i am not even sure mine is set right since I still have to type the full path in command window to use adb
sorry if this is old news just trying to find your problem

[Q] Cannot access certain roms on my rooted htc one

Hello guys, i have a bit of a problem here.
Earlier last August I had a family friend root my HTC One for me, load up a few roms, and told me to test some out. Months and months later, I have some knowledge of ADB, test out tons of roms, and love my phone.
The issue is I STILL have these 3 roms on my phone, and I cannot for the life of me get rid of them!
now it's hard to explain exactly whats up, but I will do my best!
In recovery, which is currently CWM v 6.0.4.6, I hit -> install zip, choose zip from /sdcard and at the very bottom of the list I have
ARHD 12, Trickdroid, and ViperOne
I can NEVER find these with any explorer, cannot search for them, or find them anywhere on my device. Does anyone have any idea what I can do?
Also to help clarify, if I download a rom in say google chrome, I need to hit /0/ after I hit "choose zip from /sdcard" in order to find it under downloads.
Any help would be awesome. Sorry if this is in the wrong area, I don't post often.
katsock said:
In recovery, which is currently CWM v 6.0.4.6, I hit -> install zip, choose zip from /sdcard and at the very bottom of the list I have
ARHD 12, Trickdroid, and ViperOne
I can NEVER find these with any explorer, cannot search for them, or find them anywhere on my device. Does anyone have any idea what I can do?
Click to expand...
Click to collapse
I think the files are located in /data/media. You can find them with a root explorer (if not running as root, /data will just appear empty). Or you can use ADB (not a terminal emulator on your phone, that won't work). To see these files, you type:
Code:
adb shell ls /mnt/shell/emulated
To delete a file, you type:
Code:
adb shell rm "/mnt/shell/emulated/Some-Rom.zip"
FYI, /sdcard another directory, which links to another directory, etc., with the final location being /data/media/0. Most file-type data is stored in /data/media, but the files outside "0" aren't meant to be accessed directly. But since we still need access at times for various reasons, if you're using the ADB shell, you can see the contents of this folder by using the "magic" path "/mnt/shell/emulated".
fenstre said:
I think the files are located in /data/media. You can find them with a root explorer (if not running as root, /data will just appear empty). Or you can use ADB (not a terminal emulator on your phone, that won't work). To see these files, you type:
Code:
adb shell ls /mnt/shell/emulated
To delete a file, you type:
Code:
adb shell rm "/mnt/shell/emulated/Some-Rom.zip"
FYI, /sdcard another directory, which links to another directory, etc., with the final location being /data/media/0. Most file-type data is stored in /data/media, but the files outside "0" aren't meant to be accessed directly. But since we still need access at times for various reasons, if you're using the ADB shell, you can see the contents of this folder by using the "magic" path "/mnt/shell/emulated".
Click to expand...
Click to collapse
Thanks so much! it was in data/media! thank god I could stop going through each and every folder. I just got about 3 gigs back that I thought were filled up forever!

Huawei P9 doesn't show root folder in file explorer

When I go to the "/" folder in any file explorer, there's nothing inside it. And when I type "sh /" or "ls" in Terminal Emulator it says "Permission denied". (Android 7, EMUI 5)
The phone is not rooted.
But my P8, even when it wasn't rooted, was able to show the root folder in file explorer and achieve the "sh /" or "ls" commands. Can I somehow check the root folder without rooting my phone?
Sorry for my bad English
Without root permissions you can only see few like ls storage, or sdcard, mnt
Or, you can see the root fron TWRP (half way to rooting the phone)

ANY apk or file that can bind folders?

As ive written in my past posts, using exagear (windows emulator based on wine), before I try to give that one su and read external sd and make final attempts to read more than 1 folder... im trying to bind folders. from terminal on phone. I did it with ADB and usb connected to PC with bindfs, I make a bind between Download\ and folder on external SD card, it is read by Exagear as it sees the External folder instead of the actual Download folder. But the moment I disconnect from PC or disable ADB debugging, the bind is lost, Download folder even disappears, have to reboot to restore folder.
Im using Magisk to give any such app su. So I give SU to terminal emulator apk and when I perform the same bindfs command it binds the 2 folders but only in the terminal. If I browse the folders with file explorer I won't see the External SD folder when going to Download'\ and neither will the exagear (unlike when done from ADB). So I need to bind them when away from PC, so I can 'see'the external sd
Tried FolderMount apk, few others, commands, which one works to properly bind as can be seen in all apps or particular? My final stop will be to try reverse engineer and see if su will allow exagear to see more than 1 folder (it only sees Download folder)
FBind Magisk module: (read last pages)
https://forum.xda-developers.com/apps/magisk/module-magic-folder-binder-t3621814
Rclone Mount Magisk module (on repository). Check the use of rclone with local storage.
Also the apps Apps2sd (by Vicky Bonick, see thread on XDA), Folder Mount, Luc* Pat* (ignore the piracy side of it, it has some nice other features) and maybe others can bind folders (may not work fine on some Android versions).
Ok I try fbind module, how do I use it? i installed the module in Magisk 20.4 and now i need the correct syntax. I tried
PHP:
fbind <external sd path> storage/emulated/0/download>
andit throws me into the menu
1) non_media_to_external 5) documentation
2) media_to_external 6) all_commands
3) obb_to_external 7) exit_wizard
4) troubleshooting 8) boot_log
--> OPTION <enter>:
Which one to do what I want /mnt/media_rw/MD6H-KDY5/My\ Folder /mnt/runtime/write/emulated/0/download
where the first folder is a folder on external sd that has to be mounted as download folder
ALSO I cant remove something, I created mnt/runtime/read/emulated/0/mnt/media_rw/MD6H-KDY5/My Folder and mnt/runtime/read/emulated/0/mnt/runtime/write/emulated/0/download
(oops partially solved this as explained here by enabling core only module in Magisk manager, reboot phone then they can be deleted). But then they are back if i allow fbind modules.. Final solution was to put (overwrite) some empty config.txt in data/adb/fbind and then I can delete the folders, it seems to read it from there. So no need to switch to Core only in magisk or uninstall the fbind.
It is why I need to do this correctly to not make a mess
OK did it with bindfs as I explain in other thread and important to do is in Magisk Settings in Mount Namespace Mode set it to Global, then use ScanMediaPlz apk or without it, reboot phone and retry again command in Terminal and see if external SD content will be on the Download folder

Question How to get full backup of sdcard?

Previously I could just plug my phone into my computer and run "adb pull -a /sdcard ." (Android 8) But that command doesn't work anymore now that I have a Pixel 5a with Android 11, it's filled with errors, such as:
Code:
adb: error: failed to copy '/sdcard/Android/data/com.alltrails.alltrails/files/tiles/tile_cache.db-wal' to './sdcard/Android/data/com.alltrails.alltrails/files/tiles/tile_cache.db-wal': remote open failed: Permission denied
This is some random app file, and I'm sure there are others too with weird permissions which cause adb to quit as soon as it has the error.
I've read that I could use a command like this:
Code:
adb exec-out "tar -ch sdcard | gzip" > sdcard_backup.tar.gz
but this just produces a corrupted archive because "tar" can't read all of the files either and so the error messages get inserted into the archive.
Any other ideas to simply get a full backup of /sdcard? Thanks
scarlion said:
Previously I could just plug my phone into my computer and run "adb pull -a /sdcard ." (Android 8) But that command doesn't work anymore now that I have a Pixel 5a with Android 11, it's filled with errors, such as:
Code:
adb: error: failed to copy '/sdcard/Android/data/com.alltrails.alltrails/files/tiles/tile_cache.db-wal' to './sdcard/Android/data/com.alltrails.alltrails/files/tiles/tile_cache.db-wal': remote open failed: Permission denied
This is some random app file, and I'm sure there are others too with weird permissions which cause adb to quit as soon as it has the error.
I've read that I could use a command like this:
Code:
adb exec-out "tar -ch sdcard | gzip" > sdcard_backup.tar.gz
but this just produces a corrupted archive because "tar" can't read all of the files either and so the error messages get inserted into the archive.
Any other ideas to simply get a full backup of /sdcard? Thanks
Click to expand...
Click to collapse
I'm guessing that you're not rooted. That means that you probably won't be able to access most (if not all) of Android/data due to scoped storage restrictions.
If you change the tar command to
tar -chzf sdcard_backup.tar.gz sdcard
you should at least split out the errors from the data. The z option tells tar to compress the output using gzip. No need to explicitly pipe it through an external gzip program. f tells it that the next string is the output file name.
For the full tar manual see
GNU tar 1.34
GNU tar 1.34
www.gnu.org
A good file explorer should be able to get access to the restricted directories so you could use that to copy the data from there. I'm not sure about restoring in this case though since permissions may not be properly preserved.
If you are rooted then you can use tar to grab everything. There are options to preserve permissions but I would use the /data/media/0 path for that (path may not be correct. I'm going by memory since I'm not currently rooted and can't see the necessary directory structures).
I'll follow up here eventually once I do root, hopefully in a few days.

Categories

Resources