[GUIDE] How to edit fstab.qcom if you don't have permission (or any other file) - Xiaomi Mi A2 Lite Guides, News, & Discussion

I have some troubles with editing fstab.qcom from forceencrypt to encryptable, because system says that editing of this file is denied.
So, how to edit, then?
1. Turn off the phone
2. Boot into TWRP recovery
3. Mount System.
4. On PC ADB type
Code:
adb pull /vendor/etc/fstab.qcom
5. You will have fstab.qcom file in adb folder
6. Edit something in this file to whatever you want - like forceencrypt to encryptable. Save it.
7. Push the fstab.qcom into mobile by typing this
Code:
adb push fstab.qcom /vendor/etc
8.Voila, you have rewrited fstab.qcom file!
9. Now, you can reboot the phone.
For me it worked, I hope it helps to someone.

ondraczsk said:
I have some troubles with editing fstab.qcom from forceencrypt to encryptable, because system says that editing of this file is denied.
So, how to edit, then?
1. Turn off the phone
2. Boot into TWRP recovery
3. Mount System.
4. On PC ADB type
Code:
adb pull /vendor/etc/fstab.qcom
5. You will have fstab.qcom file in adb folder
6. Edit something in this file to whatever you want - like forceencrypt to encryptable. Save it.
7. Push the fstab.qcom into mobile by typing this
Code:
adb push fstab.qcom /vendor/etc
8.Voila, you have rewrited fstab.qcom file!
9. Now, you can reboot the phone.
For me it worked, I hope it helps to someone.
Click to expand...
Click to collapse
I have rooted NSTV device with Android11, when I connect my external HDD (ext4 formatted) to it, the device notify me the HHD not supported.
I can mount the HDD successfully:
Code:
mount -w -t ext4 UUID=89087942-e2b5-4f4a-99d7-9818559c6844 /mnt/media_rw
The root privileged file manager apps can read & write to HDD (Root-Explorer or Solid-Explorer)
But I can't open my movies through the VLC, MxPlayer... apps (logcat is: Access denied), also I tried to 'chown & chmod' but I'm not success.
Can you help me to solve my problem please?!

@mrhamed I had a similar issue in android 11 smartphone. My sd card had ext4 fs and bind mounts to it in /sdcard were 'invisible' to apps, due to inaccessible selinux context and permission errors. From this stackexchange post, I did the following to access its files from apps.
You need bindfs cli program. I use termux, so installing bindfs is very easy. If you can't get termux on your tv, cross-compile bindfs for your tv or compile it statically from source or search for pre-compiled binaries.
Mount your external HDD as you did, but use a different directory other than /mnt/media_rw since android mounts external storage devices there, to avoid possible data loss:
Code:
# mkdir /drive
# mount -w -t ext4 UUID=89087942-e2b5-4f4a-99d7-9818559c6844 /drive
Create any directory where you will bind-mount drive in /storage/emulated/0/:
Code:
$ mkdir /storage/emulated/0/HDD
The owner and group of files when bind-mounting must be root (0) and everybody (was 9997 in my case). Now bind-mount /drive to /mnt/runtime/full/emulated/0/HDD:
Code:
# bindfs --ctime-from-mtime --xattr-none --direct-io --resolve-symlinks --create-for-group=10261 --create-for-user=10261 --create-with-perms=u+rwD:go+rD:fugo-X --force-user=0 --force-group=9997 --chmod-ignore --chgrp-ignore --chown-ignore --perms=ug+rwD:fugo-X:o-rwD /drive /mnt/runtime/full/emulated/0/HDD
Bindfs options don't have to be the same though. 10261 can be any uid. The android media provider module sets up the rest of the emulated storage views like read and write for you. That's all. Write speed to HDD folder won't be the same as writing directly to /drive; was slower in my case.
Apps that use the android media API to know which media files are in your storage will not detect the files in HDD until a media scan is done. Again I used termux for the media scan: termux-media-scan, but this process of media scanning and extraction turned out to be too battery intensive because I have very many songs, so I stopped scanning. I searched for apps that scan for media themselves like MX Player or VLC.

Related

[TUTORIAL] Install applications into SD Card for Samsung Galaxy 5 (i5500)

DISCLAIMER: DO THIS AT YOUR OWN RISK. I AM NOT RESPONSIBLE IF YOU BRICK / RUIN YOUR PHONE IN ANY WAY.
Hi Everyone,
I have some good news for the owners of Samsung Galaxy 5 (i5500) Smartphones.
Doing some research on Google and reading about efforts from other people who could install applications on SD card on other android phones, I was able to develop a method to install application into SD card for the Galaxy 5. Better yet, you won't even need a custom Rom.
Before I get into the specifcs let me state that the following steps are manual and no application is provided to automate the process, so advanced computer skill is required and some knowledge of unix/linux is a plus.
Here we go: PLEASE READ THE WHOLE THING BEFORE YOU START. I MAY HAVE OMMITED SOME COMMANDS OUT OF LACK OF ATTENTION.
1) You'll need to root your phone. There is a lot of guides about this available, just google for it. I've used the SuperOneClick Root to do this.
2) Partition your sd card like this: 1 - FAT, 2 - Linux ext2. Again, there is a lot of guides about this on the net, just google again. I've used Paragon Partition Manager 2010 to lower the size of my FAT partition, leaving a 550MB unallocated space at the end of the card. Then I formatted this space as ext2 in linux, using ubuntu live CD. Most guides around there recommends that you keep this partition between 500~750MB, so I didn’t try with greater sizes. Also, i kept my partition 1 as FAT 16, but FAT 32 might actually work too, try that if you want and post me a reply.
3) Download Titanium Backup (or another app backup tool) from market and backup your applications. You may need to restore your applications to correct some permission problems that may occur after completing this guide.
4) Install busybox. BusyBox is a software application that provides many standard Unix tools, which are not available on stock android. You can get a copy of busybox by clicking on “problems?” button on Titanium Backup main window. It will get installed on /data/data/com.keramidas.TitaniumBackup/files.
5) If you still don’t have Android SDK installed on your PC, download and install it from Google. You’ll need ADB (Android Debug Bridge), which is included in the SDK, to proceed. Now open a shell connection with your device by typing:
Code:
adb shell
Just keep in mind that you MUST be logged as root. Root command prompt is recognized by the # character. If you don’t have root type the ‘su’ command. If even with ‘su’ you couldn’t get root, please review step 1.
6) Create ‘sd’ folder int /system:
Code:
cd /system
mkdir sd
7) Mount ext2 partition into /system/sd
Code:
mount -t ext2 /dev/block/mmcblk0p2 /system/sd
8) Create a folder to store the applications into ext2 partition:
Code:
cd /system/sd
mkdir app
9) Copy busybox to /system/bin
Code:
cat /data/data/com.keramidas.TitaniumBackup/files/busybox > /system/bin/busybox
chmod 755 /system/bin/busybox
10) Copy your applications to ext2 partition:
Code:
busybox cp /data/app/* /system/sd/app/
11) Change permissions of copied applications:
Code:
cd /system/sd/app
chown system.system *
chmod 644 *
12) Now comes the tricky part: making Android mount your new partition at boot time. All the hard work would be useless if Android discarded the mount points every time we restarted our phones. To do this we’ll need to create 2 scripts and store then into /system/etc. Obviously the scripts should be started by init.rc and need to run as root. Fortunately Android’s init.rc have a gap that makes this possible. The scripts are named install-recovery.sh and init-sd2.sh.
install-recovery.sh content:
Code:
#!/system/bin/sh
/system/etc/init-sd2.sh&
init-sd2.sh content:
Code:
#!/system/bin/sh
MYLOG=/data/install-recovery.log
echo "$(date) Starting install-recovery.sh" > $MYLOG
echo "$(date) Waiting SD to become ready..." >> $MYLOG
sleep 10
mount -t ext2 /dev/block/mmcblk0p2 /system/sd 1>>$MYLOG 2>>$MYLOG
mount -o bind /system/sd/app /data/app 1>>$MYLOG 2>>$MYLOG
mount >> $MYLOG
echo "$(date) Finishing install-recovery.sh" >> $MYLOG
If you plan to edit this files on windows I recommend a tool that is capable of keeping UNIX file format, just like notepad++ free tool.
13) After placing the scripts, change their permissions:
Code:
cd /system/etc
chmod 555 install-recovery.sh
chmod 555 init-sd2.sh
14) Rename the default application folder. If everything works fine you can remove this later to save space:
Code:
cd /data
mv app app_old
mkdir app
chown system.system app
chmod 755 app
15) Restart your phone and cross your fingers
16) If you have problems with your widgets don’t worry. You just need to remove then from your homescreen and add again.
17) Check if your applications are running as they should. Restore backups you’ve made with Titanium Backup for the applications showing problems.
18) If your partition didn’t mount at boot, check log file at /data/install-recovery.log
19) From now on your new applications will be installed on your SD Card. You can modify the scripts to store other folders from /data into the ext2 partition as needed. I’ve been running my applications from SD Card for a week now without any problems or bugs.
20) If you can’t make it work, post your question here and I will try to help you out.
21) Donations are welcomed, just drop some money into my paypal account. Just kidding
Good luck and cya!
can this script use for moving /data/data to EXT2?
if can, from where i should start type the script?
i'm still newbie on this
so i'm alittle bit confused, i hope you can help me and sorry for my bad english
i'm already succes from step 1 to step 11
but i'm little confused at step 12
can you explain how to make the script?
should i make those 2 script via notepad++ and then copy it to /system/sd and then continue to step 13?
or should i just type everything on step 12 after step 11 in cmd prompt?
the problem is, if i make the script from notepad++ the android system will just discard my mount point when i restart my phone
and if i just type everything on the step 12 in comand prompt, when i'm type chmod 555 install-recovery.sh and chmod 555 init-sd2.sh like in the step 13, it always say that install-recovery.sh and init-sd2.sh file is not found?
so what should i do?
i'm stuck on step 12
step 12, type it on notepad++ and then you have to change the extension of the file with .sh, after that copied the 2 files to /system/etc
andikasuhendar said:
step 12, type it on notepad++ and then you have to change the extension of the file with .sh, after that copied the 2 files to /system/etc
Click to expand...
Click to collapse
i've already done that
but when i make the script via notepad ++, i'm already make the save type become .sh, so isn't it just the same?
but when i reboot the phone it's still not working
But how to copy this two script files to system/etc??? it's saying permision denied..
But how to copy this two script files to system/etc??? it's saying permision denied..
Click to expand...
Click to collapse
I'm use root explorer to move it to system/etc
The script can be moved but it still doesn't work at all :-(
-------------------------------------
Sent via the XDA Tapatalk App
And i can't move them even with root explorer.. i don't get what i'm doing wrong (
@agus
about the scripts, u can check with root explorer, try to view the script and make sure it was the exact same from the script above, coz i experience the same problem for the first time i try this. if u sure that the script are same then try to execute it using root explorer and then go to titanium backup and see if there is there is another storage (usually there is internal and SD card only).
@stasic
use the root explorer to copy the script to /system/etc, don't forget to change the root explorer option from R/O to R/W, this option should be on top of the page, just touch it to change from R/O to R/W.
andikasuhendar said:
@agus
about the scripts, u can check with root explorer, try to view the script and make sure it was the exact same from the script above, coz i experience the same problem for the first time i try this. if u sure that the script are same then try to execute it using root explorer and then go to titanium backup and see if there is there is another storage (usually there is internal and SD card only).
@stasic
use the root explorer to copy the script to /system/etc, don't forget to change the root explorer option from R/O to R/W, this option should be on top of the page, just touch it to change from R/O to R/W.
Click to expand...
Click to collapse
veeeerrrryyyyyyyyy biiiiiiigggggggggggg thaaaaaaannnnnkkkkkssssss brrroooo
you was right, after i check the script via root explorer, the script was not the same, after i fix it, everything works like a charm
in a step 2... how to change linux ext2???
any software can change from FAT to ext2???
I've changed root explorer option to R/W and still no luck..
@agus
sama2 bro AKA ur welcome bro, have fun with the app2sd hehehe
@nima
search on google, how to format EXT2, if i correct u can use paragon partition for windows user, but if u use macintosh u can just go to disk utility and make partition with EXT2 format
@stasic
go to the /system/etc and see if it already R/W or still R/O
It's written that R/W but when I copy and paste still nothing happens..
thx guy.... i must try it
andikasuhendar said:
@stasic
go to the /system/etc and see if it already R/W or still R/O
Click to expand...
Click to collapse
i've rooted my g5 using superoneclick
but i still have R/O in /system/etc
when i tap R/O on the screen, i wont changed to R/W
what should i do?
maaf inggris nya acak2an
@siap
siapakahaku said:
i've rooted my g5 using superoneclick
but i still have R/O in /system/etc
when i tap R/O on the screen, i wont changed to R/W
what should i do?
maaf inggris nya acak2an
Click to expand...
Click to collapse
In your PC command prompt execute:
Code:
adb shell
Make sure you are loged in as root and in ADB SHELL try this:
Code:
mount -o rw,remount /dev/stl12 /system
Then execute:
Code:
mount
If your mount result has a line like the one bellow, with the rw set, you'll be able to copy the files.
Code:
/dev/stl12 /system rfs rw,vfat,llw,check=no,gid/uid/rwx,iocharset=utf8 0 0
@stasic
stas1c said:
It's written that R/W but when I copy and paste still nothing happens..
Click to expand...
Click to collapse
Try the same thing I posted above. I don't have Root Explorer installed here, so you should be able to finish this guide without it.
stuck in step 2
cant mkdir....
Hi, nice guide!
I succeded with this the first time I tried but now I have changed to a larger sd card and I can't get it to work.
The log file says that it failed to mount the mmcblk0p2 folder, and now when I check it doesn't even exist. What should I do?
Hope I can get help.. thankful for response. /Mattefacit

[GUIDE] How to mount ext4 formatted MicroSD card on Android 4.2.2 Phone/Tablet.

Why?
MicroSD cards are traditionally formatted using ExFAT filesystem. The trouble is that while universally compatible, ExFAT is rather primitive filesystem prone to data loss, and poor speed. Linux ext4 on the contrary is highly reliable and very fast.
Trouble is that, and I quote, "Android supports devices with external storage, which is defined to be a case-insensitive and permissionless filesystem." (see http://source.android.com/devices/tech/storage/)
Well that pretty much narrows it down to dumb stuff like ExFAT.
Note: As of JB (Android 4.1) default umask is 077, which means that files created by apps on the ext4 formatted SD card will only be readable by the same apps, unless you manually update permissions. See this thread for more: http://forum.xda-developers.com/showthread.php?t=889471&page=5​
The good news is that Android has Linux at its core, which naturally supports ext4, and actually all of the internal storage is (or will be in near future) formatted this way. The design limitation mentioned above is somewhat artificial and is enforced by
restricted functionality of funky little daemon, called vold. The sole purpose of vold is not monitor external storage,
detect filesystem on it, mount it as specified in /etc/vold.fstab (or vold.xxx in Android 4.3), and then report to the Volume Manager.Volume Manager in turn notifies the MTP application, and all other apps, displays icons and handles rest of user-visible stuff.
Stock Android vold only supports ExFAT/vfat filesystem. It has been improved in Cyanogenmod to support ext4 and NTFS filesystems, but for those of us stuck with OEM Android this goodness in unavailable. In my experience simply re-building vold from CM as part of AOSP,
while yields an executable, this executable results in a boot loop for an unclear reason.
All hope lost seemingly, yet there is a silver lining.
Silver Lining?
If MicroSD card is mounted manually in the way that vold can see it, re-running vold will properly report it to the Volume Manager and it will be recognized and utilized by apps.
In theory this is easy to accomplish on any rooted device, in practice there are a number of obstacles:
On a locked device, it is not possible to update init script to run the commands at system bootup.
Since Android 4.2, mount propagation no longer work (as described here http://forum.xda-developers.com/showthread.php?p=36889027),
so if sdcard is mounted in terminal, vold will still not see it. Hence the mount operation has to be done in adb.
Furthermore in Android 4.2.2, running adb on localhost is broken as a result of it loosing its private key.
See here https://code.google.com/p/android/issues/detail?id=48126 for more.
The solution?
Pre-requisites:
Rooted device (don't have to be unlocked) with USB debugging enabled.
MicroSD card formatted as ext4 (inserted)
Terminal app, such as Android Terminal Emulator https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en
Familiarity with adb.
Step 1 - Fix adb localhost.
Open terminal and type the commands:
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
HOME=/sdcard adb start-server
adb connect localhost
adb -s localhost:5555 shell
exit
stop adbd
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
Step 2 - Install scripts.
Please note that the script msd2.sh has to be modified if your device uses different partition names.
To get list of partition names available run command:
Code:
adb shell cat /proc/partitions
There are 3 (very simple) scripts:
sd.sh is just a convenience so that you don't have to type su everytime.
It calls msd1.sh which takes care of starting localhost adb in a reliable way.
It then executes msd2.sh in adb shell, which actually does the mounting trickery.
To install scripts, download the zip file below, open terminal, unzip the archive and change into msd directory.
Then connect your phone to your PC and run the following commands:
Code:
adb push sd.sh /sdcard/sd.sh
adb push msd1.sh /sdcard/msd1.sh
adb push msd2.sh /sdcard/msd2.sh
adb shell
su
mount -o rw,remount /system
cp sd.sh /system/xbin/
cp msd1.sh /system/xbin/
cp msd2.sh /system/xbin/
chmod 755 /system/xbin/*.sh
mount -o ro,remount /system
exit
exit
Step 3 - Profit.
In terminal app run command:
Code:
sd.sh
There will be some messages in notifications bar and then you will be asked if it is ok to restart MTP application. Click Ok.
That should be it.
Note that this last command will have to be executed every time device reboots (see obstacle #1).
You can automate it using Script Manager app from marketplace. In this case, ask Script Manager to run msd1.sh instead, marking it as Root script.
Disclaimers
I've developed and tested this procedure on Samsung Galaxy S4 Active phone from ATT.
Should work for any other Android 4.2 device.
The steps outlined are non-destructive if done properly and should not affect any other functionality, yet obviously I do not assume any responsibility for you damaging your device in the process.
It is a good idea to read the linked articles before performing the procedure, to get a better understanding of what is actually going on.
Motorola Droid 4 (xt894)
Hello!
if you have a Motorola Droid 4 you need to change the third row in "msd2.sh" from
"mount -t ext4 /dev/block/mmcblk1p1 /storage/extSdCard && sleep 5 && /system/bin/vold" to
"mount -t ext4 /dev/block/mmcblk0p1 /storage/sdcard1 && sleep 5 && /system/bin/vold"
in order to get it to work, thanks for the guide!
Best Regards
/ Rasmus
It works well on TW based MIUI
It works well on TW based MIUI, so many many thanks!!!
But I still have the permission problems mentioned.
AOSP based MIUI is ext4 compatibile out of the box, and without permission problems.
This trick is amazing, but the permission issue make it useless ...
I can not shot a picture and than have to manually change the permission of tehf ile in order to view it on the gallery ...
Is there a definititive solution?
My lg l3 e400..sd card not mounted
to sashavasco:
sir, pls help configuring my phone...the codes u've given at the top part seems to work accordingly..but after when i entered the command
"cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys"
it says: "no such file or directory"
can you point out the problem of the device plss...
i appriciate your response..
my phone s LG L3 E400..CYANOGENMOD 9..external sd wont mount on my device
sashavasko said:
Why?
Step 1 - Fix adb localhost.
Open terminal and type the commands:
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
HOME=/sdcard adb start-server
adb connect localhost
adb -s localhost:5555 shell
exit
stop adbd
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
Click to expand...
Click to collapse
I am getting an error here: adb -s localhost:5555 shell stating device offline. I've done this 6 times now, and it's always the same error
Galaxy S4 i337 NC1 Rooted
kevp75 said:
I am getting an error here: adb -s localhost:5555 shell stating device offline. I've done this 6 times now, and it's always the same error
Galaxy S4 i337 NC1 Rooted
Click to expand...
Click to collapse
the same for me...
same error "unable to connect to local host:5555"
rooted Asus memo-7 build ME173X_US_user_4.2.404152_20140714 release-keys. But thanks for the heads up on Cyanogenmod.
>>If MicroSD card is mounted manually in the way that vold can see it, re-running vold will properly report it to the Volume Manager and it will be recognized and utilized by apps.
Re-running vold crashes it ("Segmentation fault") if sdcard is already mounted in ext4. If not, it restarts gracefully.
Stock android 4.4.2. AFAIK, vold must inform userspace stuff that sdcard is available, without it, android do not see any sdcard at all...
What can be done here?
p.s. Is there anywhere patched or recompiled vold which supports ext4?
Gigionaytor said:
the same for me...
Click to expand...
Click to collapse
same here too. Please help.
ZeroBubble said:
same here too. Please help.
Click to expand...
Click to collapse
Same error!
I had to modify terminal commands a bit to allow me to connect properly. Only moving the "start adbd" command down because the key needed to be appended to "adb_keys" before starting the service back up.
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
HOME=/sdcard adb start-server
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
adb connect localhost
adb -s localhost:5555 shell
exit
I'm also still dealing with the "msd1.sh" script execution consistently asking about my fingerprint and not remembering it. If I don't press "continue" quick enough it claims the resource is busy, which prompted me to also change the msd1.sh script sleep from 2 to 5. I have gotten the notification that msd2.sh has been elevated, which seems like it ran, but my partition still doesn't get mounted, even though I've got the right one from the /proc/partitions output.
Another note, because I had BusyBox installed, I needed to prepend "busybox" (no quotes) to the mount command in the msd2.sh or else that wouldn't work either.
Anyone have thoughts?
I followed DemisesAngel suggestion. There was no error this time but nothing happens when running any of the 3 scripts. I tried mmcblk1 and mmcblk1p1, also changed microsd path to match, /MicroSD, but nothing works. Even with manual ext4 mount command ...
Clicking mount in settings still results in incompatible storage and file explorer shows no sdcard.
Edit: Set permissions, script will run but nothing mounts unsupported file system ...
Error directory already exist
I folllow the steps but i.think I meaaes up.
When u run through DemiseAngel scripts
At:
car /sdcard/.android/adbkey.pub >> /
Error:tmp-mkish:cant create /:Is a directory
To I attempt to find and rm it, or would that mess something up
Rca RCT677W22
I dont know if this thread is closed but I have one simple question, can I somehow partition sdcard and have a little space for music and other stuff, and to use ext4 partition alongside with this, lets say "visible" partition ( I mean on windows).
WrathBand said:
I dont know if this thread is closed but I have one simple question, can I somehow partition sdcard and have a little space for music and other stuff, and to use ext4 partition alongside with this, lets say "visible" partition ( I mean on windows).
Click to expand...
Click to collapse
First, I have been able to create a formatted partition of less than the full size of an SD card. I did this because my Android seems to have issues with anything larger than 16GB and all I had lying around was a 64GB. I did not try to do anything with the remaining space. Maybe it could work, maybe not. I would have my doubts.
Second, thanks for this discussion. Here is what "kind of" works on my Android 5.1 TV computer:
su -mm -c mount -t ext4 -o noatime /dev/block/mmcblk0p1 /storage/sdcard1 && sleep 5 && /system/bin/vold
chown -R root:sdcard_r /storage/sdcard1
chmod 771 /storage/sdcard1
I say "kind of" because this is still not seen as a true, external storage card by Android or file manager apps (and the like). However, all apps can read/write/traverse the folder tree and do what they need to. You do NOT have to be root except to do this. As things stand for me now, I have to re-issue this upon every re-start of Android. But using Tasker makes this pretty easy to accomplish.
long as a problem remains so do this thread ! . Well i am on 7.x and wonder if the op would post a method or even approach for getting a
Code:
ext4
partitioned sdcard so that vold is well aware of that and will mount sdcardfs on that giving all apps access to the partitions. I have 3 of these on my card .
Is there a method to auto mount ext4 partition on external SD that works on lineageOS 17.1 on S4 i9506?

Is it necessary to umount sdcard1 before running fsck_msdos

QSTN1: Is it necessary to umount sdcard1 before running fsck_msdos?
By doing so seems to break and remove some HomeScreen icons on some OS's where certain Apps have been 'Moved to SDcard'.
QSTN2: Does newer versions of Android OS (ie 5.0.2+) natively and automatically run fsck and fsck_msdos at boot-time on your FAT formatted plugin micro-SD card, or is it an add-on specific from various OEMs?
Most of you are probably very familiar with Windows ChkDsk.exe C: /f to repair damaged/corrupted SDcards.
You may have found that by removing your SDcard from your Android device and running ChkDsk under Windows, that you solved a lag problem with your Android device. By running ChkDsk on your SDcard, maybe prompted for you to 'Convert lost chains to files', and by fixing that, fixed my lag problem.
You may also have found that sometimes that's not enough, and you need to copy your whole SDcard over to a Windows folder, reformat your SDcard as FAT (same as it was before) and copied your data back. That certainly has been the case on one of my older and slower Android 10" tablets that some Apps like 'Screenshot Ultimate Pro' by 'Ice Cold Apps', as great as it is, sometimes corrupts my SDcard when I'm tapping around too fast.
Instead of having to take the SDcard out of my tablet each time I detected this problem, I needed to run fsck_msdos on the tablet itself, so I went through the motions and finally created a HomeScreen icon, where one single click will repair the SDcard and I could then get on with business.
TIP1: I've successfully created a HomeScreen icon using SManager by devwom by placing the following script under a 'scripts' folder I created under the default Home directory of SManager.
I also made sure that the script file had the appropriate (FULL) rights and that under Advanced, I made my 'Scripts' folder, SManager's Home-base.
My preferred location to place shell (.sh) scripts for SManager (Script Manager) by devwom:
/data/data/os.tools.scriptmanager/Scripts/
I used SMWidgets by devwom to create the HomeScreen icon for the script.
#!/system/bin/sh
# scr_FsCk_MsDos_on_MoXT1068_sdcard1.sh
# umount /dev/block/vold/179:65
fsck_msdos -y /dev/block/vold/179:65
echo .........
echo : Done! :
echo .........
NOTE: You can see in the script above, that I've commented out the umount command which seems to work whether or not the SDcard has been dismounted or not.
This is my main question I need answering, as around the traps, I see conflicting reports about dismounting first and I'd rather not have to do that if all works by leaving the SDcard mounted during fsck_msdos.
Thanks.
Hi, If I do this per adb shell as su I get the following error:
Code:
1|herolte:/ # fsck_msdos -y /dev/block/vold/public:179,1
fsck_msdos -y /dev/block/vold/public:179,1
stlog : disable(No such file or directory)
begin(dev:/dev/block/vold/public:179,1)
** fsck_msdos for samsung-mod version 1.1.1
** /dev/block/vold/public:179,1
exFAT signature in boot block: unsuported
end(ret:2, stderr:0, dev:/dev/block/vold/public:179,1), stat(dirs:(0/0), files:0)
Any advice please!

"No such file or directory" if tried run binary file in TWRP

I need to run a binary file, dalvikvm which located in /system/bin from TWRP terminal, but no matter what, it says, "No such file or directory found", and then I found that this is link file located another directory, I cd'd there and tried, but still the same result
I can be able to run the same file in Termux without any issues
Can anybody please help me on this?
Thanks
Hi, I think you need to mount the system partition before being able to access it. It's not mounted by default on TWRP, but when the phone is on it is (otherwise Android wouldn't work)
If you need help on how to mount partitions on TWRP, ring me (or google it, it's actually pretty simple)
Raiz said:
Hi, I think you need to mount the system partition before being able to access it. It's not mounted by default on TWRP, but when the phone is on it is (otherwise Android wouldn't work)
If you need help on how to mount partitions on TWRP, ring me (or google it, it's actually pretty simple)
Click to expand...
Click to collapse
Thanks for replying, it wasn't mounted at first, so I had mounted, still it didn't work, while some of the files in bin do work, some don't.
Then I copied the file to /sdcard and /tmp, and tried execute from these folders, still
Well, if when you're free, can you confirm if it's running on yours?
File: /system/bin/dalvikvm
Thanks once again
mizzunet said:
Thanks for replying, it wasn't mounted at first, so I had mounted, still it didn't work,
...
Thanks once again
Click to expand...
Click to collapse
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Raiz said:
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Click to expand...
Click to collapse
I looked into it.
I had no opt folder in root directory. So I made one, and moved dalvikvm to there and tried execute this time, it said permission denied, so I gave it chmod 755. But after that, it says "there no such file or directory".
Well, do you telegram account, so I could contact you there.
Thanks
Raiz said:
I didn't found it inside, but it may be because I'm not rooted.
While searching around I've found this :
No such file or directory while running dalvikvm
I built AOSP Android and push the dalvik virtual machine in my device just to see if my built dalvik vm runs properly. I pushed it my device /opt directory but when I run dalvikvm, I get the error...
stackoverflow.com
It might get you out of trouble
Click to expand...
Click to collapse
And even "file" binary, it says, there no file.
mizzunet said:
I looked into it.
I had no opt folder in root directory. So I made one, and moved dalvikvm to there and tried execute this time, it said permission denied, so I gave it chmod 755. But after that, it says "there no such file or directory".
Well, do you telegram account, so I could contact you there.
Thanks
Click to expand...
Click to collapse
This is really curious, tbh I'm not an expert around that subject, idk what's wrong with this binary...
Hopefully someone who knows more may help you with that. Have a nice day
This is because the binary you are trying to execute was compiled to run in the Android context, but you're trying to execute it in the TWRP one. Each binary has a path to a linker used during execution. The problem is that it refers to a linker that doesn't exist in TWRP.
Suppose we want to execte a binary file and obviously we can't:
Bash:
x00h:/ # /system/bin/awk
/sbin/sh: /system/bin/awk: No such file or directory
Let's take a look to its linker:
Bash:
x00h:/ # strings /system/bin/awk | head -n 1
/system/bin/linker64
Then, you will actually discover that it's sym linked to a linker that is available only when Android is running:
Bash:
x00h:/ # ls -ald /system/bin/linker64
lrwxr-xr-x 1 root shell 38 2009-01-01 00:00 /system/bin/linker64 -> /apex/com.android.runtime/bin/linker64
Since TWRP comes with its linker in /sbin/linker64, we can sym link it to /system/bin/linker64.
So, the hack:
Bash:
x00h:/ # mkdir -p /apex/com.android.runtime/bin/
x00h:/ # ln -s /sbin/linker /apex/com.android.runtime/bin/linker
x00h:/ # ln -s /sbin/linker64 /apex/com.android.runtime/bin/linker64
Retry, and it works:
Bash:
x00h:/ # /system/bin/awk
usage: /system/bin/awk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]
Pray to God the TWRP's linker will be compatible and do the job (most binaries works fine), but sometimes you may get CANNOT LINK EXECUTABLE.

[HELP] Internal Storage not accessible a.k.a How to clear com.android.providers.media.MediaApplication data

Hi,
Since a few days I'm unable to see any data in my phone via gallery or file manager or any application, and I'm unable to save any data to internal storage. (example: I'm able to use whatsapp for texting, but I can't receive/send any audio/picture and I can't access the old ones).
And I keep getting this error message:"com.android.providers.media.MediaApplication keeps stopping."
I don't know if that's what causing it or if that's just a consequence of not being able to access internal storage.
I can still see all the used storage from settings though.
Phone has unlocked bootloader, but no root/custom rom/recovery.
I saw other Oneplus users started getting the same error these days... (I have a Oneplus 6, but others have different models like Oneplus Nord).
Someone resolved by wiping system and they were able to retrieve storage content and functionality, but they lost apps data, I'm trying to find another way since I have an unlocked bootloader.
An user on stackoverflow suggested I should clean the com.android.providers.media.MediaApplication app data to regenerate the database, but I couldn't figure out how to do it
I tried cleaning media and media.module packages (not media.MediaApplication) from adb but no luck even if successful.
I tried removing "com.android.providers.media" (not media.MediaApplication, I couldn't find that one) folder from data/data with twrp file manager but no luck...
Is there a way to specifically clean "com.android.providers.media.MediaApplication"?
If anyone has any other suggestion on things to try, post it here please.
Thank you in advance
you wrote you already did successfully - obviously that is not the cause. my suspect is broken encryption (you will figure out from recovery.log)
encrypted files look like this +NiZZaTrs3RFzYegpkEk if encryption is not the reason, it could be symlinks messed up. in android enable usb-debugging and check from adb shell.
(repeat this for each result)
Code:
readlink /sdcard
readlink ...
in TWRP recovery check for files like /data/system/uiderrors.txt
/data/log
(don't know exact names) you can adb pull files to PC and inspect with wordpad or Notepad++
last but no least you can capture logcat during boot for further analysis
Code:
adb logcat > logcat.txt
if you're going to factory reset device, install Magisk from TWRP and backup apps to usb flash drive with Migrate-NG beforehand. copy all your pictures + backups to PC
Code:
adb pull -a /sdcard
if you can't install Migrate or can't get usb-otg to work, get a backup to PC at least, I can tell you how to restore single apps from it later (ignore the confirmation request "WARNING adb backup is deprecated... Now Unlock your device and confirm...")
Code:
adb backup --twrp --compress data
alecxs said:
encrypted files look like this +NiZZaTrs3RFzYegpkEk if encryption is not the reason, it could be symlinks messed up. in android enable usb-debugging and check from adb shell.
(repeat this for each result)
Code:
readlink /sdcard
readlink ...
in TWRP recovery check for files like /data/system/uiderrors.txt
/data/log
(don't know exact names) you can adb pull files to PC and inspect with wordpad or Notepad++
last but no least you can capture logcat during boot for further analysis
Code:
adb logcat > logcat.txt
if you're going to factory reset device, install Magisk from TWRP and backup apps to usb flash drive with Migrate-NG beforehand. copy all your pictures + backups to PC
Code:
adb pull -a /sdcard
if you can't install Migrate or can't get usb-otg to work, get a backup to PC at least, I can tell you how to restore single apps from it later (ignore the confirmation request "WARNING adb backup is deprecated... Now Unlock your device and confirm...")
Code:
adb backup --twrp --compress data
Click to expand...
Click to collapse
Hi @alecxs , I really hope you are still active on this forum...
Probably you won't remember this discussion from back in the days (This was the previous part of our exchange if you would like to refresh your memory).
In the end I ended up using my phone in that state for more than one year with the plan of changing phone soon and not have to deal with the wipe and restoration on the same device (if that's not procrastination.... ).
Well, last week I dropped the phone and the screen died. I bought a pixel 7 as a replacement but now I would like to try to save the data of just a few apps. Most important one being Whatsapp, I don't really care about the rest...
So basically:
-the screen is dead but touch is still working and I was able to get scrcpy to work so I can still use it as a "normal' phone from my computer, so that shouldn't be an impediment.
-as previously stated the phone is not able to access internal storage, but I'm able to access it in recovery mode through adb so pulling files should not be an issue.
-I'm able to install and update apks through adb install.
-whatsapp was not able to execute backups during this year since it could not access internal storage, so I have only old ones.
-bootloader is unlocked, I have twrp but no root.
I still need to try your suggestion above, but wanted to ask this before cause maybe you have a different suggestion to extract a single app. Also, I don't really know how migrate works but if it saves the backup on the internal storage I think that's not gonna work cause every app that needs to save something (that isn't data) doesn't work.
Isn't there a way to just copy the data folder of the app on the new phone to transfer data (like what happens for mac apps)?
Thank you in advance
0xCuter said:
-as previously stated the phone is not able to access internal storage, but I'm able to access it in recovery mode through adb so pulling files should not be an issue.
Click to expand...
Click to collapse
yes, if that is true all fine, you can run the Migrate_EMERGENCY_FLASHABLE.zip from recovery and restore app data on other device with Migrate
alecxs said:
yes, if that is true all fine, you can run the Migrate_EMERGENCY_FLASHABLE.zip from recovery and restore app data on other device with Migrate
Click to expand...
Click to collapse
Hey, it's me again... So, I rooted my new phone and I found the emergency_flashable.zip in the migrate thread, now I just need to flash it, but I cannot use scrcpy in recovery mode to see the screen. I guess there is a way to flash the zip from adb without the need to use the screen, but better to ask since I don't want to do stupid stuff...
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
alecxs said:
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
Click to expand...
Click to collapse
One thing I forgot to ask: do I need to root my old phone as well or is twrp sufficient?
And to root I would just need to flash Magisk the same way I would flash the emergency flashable.zip right? Or can I just "twrp install [magisk_package]" without going into the shell?
No need to root old phone, TWRP already provides root access for backup purposes. the new phone should be rooted by flashing magisk patched boot.img because the TWRP install method is deprecated. I know I gave only short hints, so don't hesitate to ask for more detailed instructions in case you don't know what to do for some specific step...
alecxs said:
No need to root old phone, TWRP already provides root access for backup purposes. the new phone should be rooted by flashing magisk patched boot.img because the TWRP install method is deprecated. I know I gave only short hints, so don't hesitate to ask for more detailed instructions in case you don't know what to do for some specific step...
Click to expand...
Click to collapse
Thank You... Yes, the new phone is rooted.
One thing that's not needed for the process but I wanted to understand is: Is there a specific reason why we "twrp install" from shell or could in theory be possible to flash the zip file directly from pc storage?
0xCuter said:
or could in theory be possible to flash the zip file directly from pc storage?
Click to expand...
Click to collapse
the reason is, the backup is created locally in the same directory where the zip file is. never tried sideload but I guess it would try to store in /tmp which is RAM.
alecxs said:
yes, you can do it from adb. best is MicroSD Card as target directory. copy the zip into the target directory, mount data system vendor product, then install zip. on the first trial it will fail because packages.list needed. but it will create one you can edit. delete unwanted packages before second trial. you can repeat as often you want, existing backups won't created twice.
Code:
adb push Migrate_EMERGENCY_FLASHABLE.zip /sdcard
adb shell
# mount /system_root
# mount /system
# mount /vendor
# mount /product
# mount /external_sd
# mkdir /external_sd/Migrate
# cd /external_sd/Migrate
# mv /sdcard/Migrate_EMERGENCY_FLASHABLE.zip .
# twrp install ./Migrate_EMERGENCY_FLASHABLE.zip
# exit
adb pull /external_sd/Migrate/packages.list
edit the file with editor and push it back
https://twrp.me/faq/openrecoveryscript.html
Click to expand...
Click to collapse
I'm trying and when I do "mount /system" from the shell I get this:
mount: '/system' not in fstab
Click to expand...
Click to collapse
Is it normal?
it's either /system_root or /system so one of it will fail. I just listed both.
alecxs said:
it's either /system_root or /system so one of it will fail. I just listed both.
Click to expand...
Click to collapse
I suspected that... is it the same for product and external_sd?
Only system_root and vendor went through
/external_sd is the mount point for MicroSD Card, it may have a different name like /sdcard1 or something. if you have enough disk space on /data, no need for external SD.
/product is maybe not needed, just running with /system_root + /vendor is fine.
alecxs said:
/external_sd is the mount point for MicroSD Card, it may have a different name like /sdcard1 or something. if you have enough disk space on /data, no need for external SD.
/product is maybe not needed, just running with /system_root + /vendor is fine.
Click to expand...
Click to collapse
There is no external MicroSD on Oneplus 6... can I put the migrate folder in /sdcard?
Also, I think I should delete some stuff from storage to make space, since I already pulled it on the pc
/sdcard = /data/media can be used. you can split the packages.list file into few parts so it fits in remaining disk space.
alecxs said:
/sdcard = /data/media can be used. you can split the packages.list file into few parts so it fits in remaining disk space.
Click to expand...
Click to collapse
I tried the install and I get this, even though the zip file is in the same folder I'm in (it even autocompletes from terminal)
OnePlus6:/sdcard/Migrate # ls
Migrate_EMERGENCY_FLASHABLE.zip
OnePlus6:/sdcard/Migrate # twrp install Migrate_EMERGENCY_FLASHABLE.zip
Unable to locate zip file 'Migrate_EMERGENCY_FLASHABLE.zip'.
Installing zip file 'Migrate_EMERGENCY_FLASHABLE.zip'
Error installing zip file 'Migrate_EMERGENCY_FLASHABLE.zip'
Done processing script file
Click to expand...
Click to collapse
make sure you give a path to zip file on install, like ./ or full path. it will fail on first execution. check if packages.list was created successfully.
alecxs said:
on the first trial it will fail because packages.list needed. but it will create one you can edit.
Click to expand...
Click to collapse
you can always pull recovery.log afterwards to see what's going on.
Code:
adb pull /tmp/recovery.log
alecxs said:
make sure you give a path to zip file on install, like ./ or full path. it will fail on first execution. check if packages.list was created successfully.
you can always pull recovery.log afterwards to see what's going on.
Code:
adb pull /tmp/recovery.log
[/cod
[/QUOTE]
Click to expand...
Click to collapse
It launched with the full path. I didn't edit the package.list file and I launched it again.
I got a lot of "migrate.sh: failed:..." and just a few "migrate.sh: finish:..." mostly for system apps, but honestly I really only need to backup whatsapp...
...
Click to expand...
Click to collapse
migrate.sh: failed: com.intsig.lic.camscanner
migrate.sh: failed: com.android.theme.icon_pack.ci
migrate.sh: failed: com.google.android.apps.restor
migrate.sh: 397x packages failed / 0x already exist
# MIGRATE_STATUS: backup finished (27/424)
# DONE.
#
# exiting script
#
# # # # # # # # # # # # # # # # # # # # # # # # # #
Updater process ended with ERROR: 1
I:Install took 69 second(s).
Error installing zip file 'sdcard/Migrate/Migrate_EMERGENCY_FLASHABLE.zip'
Done processing script file
Click to expand...
Click to collapse
These are the things that have been backed up:
OnePlus6:/sdcard/Migrate # ls
Backup_android Backup_com.google.android.networkstack
Backup_com.android.bluetooth Backup_com.google.android.packageinstaller
Backup_com.android.cellbroadcastreceiver Backup_com.oneplus.screenshot
Backup_com.android.emergency Backup_com.qualcomm.qti.cne
Backup_com.android.inputdevices Backup_com.qualcomm.qti.poweroffalarm
Backup_com.android.location.fused Backup_com.qualcomm.qti.smq
Backup_com.android.phone Backup_com.qualcomm.qti.uceShimService
Backup_com.android.providers.blockednumber Backup_org.ifaa.aidl.manager
Backup_com.android.providers.settings Backup_se.dirac.acs
Backup_com.android.providers.telephony Backup_vendor.qti.hardware.cacert.server
Backup_com.android.proxyhandler Migrate_EMERGENCY_FLASHABLE.zip
Backup_com.android.server.telecom backup_app_and_data.sh
Backup_com.android.settings busybox
Backup_com.android.shell migrate.log
Backup_com.android.stk migrate.sh
Backup_com.android.systemui packages.list
Backup_com.google.android.ext.shared readme.txt
Click to expand...
Click to collapse

Categories

Resources