Hi!
I'm running Android 13. I've used Magisk to root the device but the command
Code:
adb root
results in
Code:
adbd cannot run as root in production builds
I already tried "adbd Insecure v2.00.apk" but it fails with the message
Code:
Could not patch adbd !
Is there a way to fix this?
you can overlay /system/bin/adbd with magisk module. create new directory in /data/adb/modules and place your files
Code:
/data/adb/modules/my_module/system/bin/adbd
/data/adb/modules/my_module/module.prop
https://topjohnwu.github.io/Magisk/guides.html#magisk-modules
or escalate to privileged shell and stream file content over stdin/stdout (linux only)
Code:
adb shell "su -c 'dd bs=1m if=/dev/block/bootdevice/by-name/boot 2> /dev/null'" > boot.img
adb shell "su -c 'dd bs=1m of=/dev/block/bootdevice/by-name/boot'" < path/to/boot.img
alecxs said:
you can overlay /system/bin/adbd with magisk module. create new directory in /data/adb/modules and place your files
Code:
/data/adb/modules/my_module/system/bin/adbd
/data/adb/modules/my_module/module.prop
https://topjohnwu.github.io/Magisk/guides.html#magisk-modules
or escalate to privileged shell and stream file content over stdin/stdout (linux only)
Code:
adb shell "su -c 'dd bs=1m if=/dev/block/bootdevice/by-name/boot 2> /dev/null'" > boot.img
adb shell "su -c 'dd bs=1m of=/dev/block/bootdevice/by-name/boot'" < path/to/boot.img
Click to expand...
Click to collapse
Thank you very much for your reply.
How would method 1 work? I find a different binary of adbd that has the root feature enabled and overlay the original with it through a Magisk module?
mattdeox said:
I already tried "adbd Insecure v2.00.apk" but it fails with the message
Click to expand...
Click to collapse
you found already, just unzip the assets/adbd.21.png from apk
alecxs said:
you found already, just unzip the assets/adbd.21.png from apk
Click to expand...
Click to collapse
I checked the file you mentioned and it has those contents:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
What should I do with them?
mattdeox said:
. I've used Magisk to root the device but the command
Code:
adb root
results in
Code:
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Why do you need this?
WoKoschekk said:
Why do you need this?
Click to expand...
Click to collapse
I would like to do some automated testing on my device using Appium to check if my website works correctly.
As I understood, adb root is needed to do it properly.
just rename the file > adbd
/data/data/eu.chainfire.adbd/files/adbd.21.png: ELF executable, 32-bit LSB arm, static, stripped
mattdeox said:
I would like to do some automated testing on my device using Appium to check if my website works correctly.
As I understood, adb root is needed to do it properly.
Click to expand...
Click to collapse
Basically: ADB is a commandline tool which acts as a client-server programm. You send ADB commands (usually from a desktop PC, but also possible from a rooted mobile) as a client to the adbd (daemon) on another device. The adbd executes those commands on the other device as user:shell. If you want the adbd acts as user:root then you have to execute adb root. BUT it's not possible to grant the adbd root permissions on a stock ROM (production builds). Even if the other device is rooted with Magisk it's still a production build!
The only way to execute commands as root via ADB on another device is
Code:
adb shell
su
alecxs said:
just rename the file > adbd
/data/data/eu.chainfire.adbd/files/adbd.21.png: ELF executable, 32-bit LSB arm, static, stripped
Click to expand...
Click to collapse
I created the structure you recommended
Code:
/data/adb/modules/adbRoot/module.prop
/data/adb/modules/adbRoot/system/bin/adbd
I opened Magisk and could see the module enabled.
Then restarted adbd
Code:
setprop ctl.restart adbd
But there was still the error
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Then I found out on this page https://source.android.com/docs/core/ota/modular-system/adbd
that adbd moved on Android 13, supposedly to this location:
Code:
/apex/com.android.adbd/bin/adbd
Then I also created this file for the Magisk module
Code:
/data/adb/modules/adbRoot/system/apex/com.android.adbd/bin/adbd
Again, I restarted adb
Code:
setprop ctl.restart adbd
But the result still is the same
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Anything else I could do/something that is wrong?
WoKoschekk said:
Basically: ADB is a commandline tool which acts as a client-server programm. You send ADB commands (usually from a desktop PC, but also possible from a rooted mobile) as a client to the adbd (daemon) on another device. The adbd executes those commands on the other device as user:shell. If you want the adbd acts as user:root then you have to execute adb root. BUT it's not possible to grant the adbd root permissions on a stock ROM (production builds). Even if the other device is rooted with Magisk it's still a production build!
The only way to execute commands as root via ADB on another device is
Code:
adb shell
su
Click to expand...
Click to collapse
Thank you very much for your input.
Are you saying there is nothing that can be done by replacing the adbd file or the config?
Do you think the solution by alecxs to replace the binary is not working?
mattdeox said:
Thank you very much for your input.
Are you saying there is nothing that can be done by replacing the adbd file or the config?
Do you think the solution by alecxs to replace the binary is not working?
Click to expand...
Click to collapse
Still do not understand the reason. Assume the command adb root is successful. how to proceed then?
Here's what you need for adb root:
daemon/main.cpp - platform/system/adb - Git at Google
These criterias have to be met to execute adb root.
In case the adbd gets root permissions, then you keep the privileges to run:
Code:
adb disable-verity
enable-verity
sideload OTAPACKAGE
remount [-R]
unroot
(For further information see 'adb help')
All the other ADB commands don't require the adbd to be rooted.
the insecure adbd by @Chainfire according to this logcat requires some additional sepolicy rules and probably therefore does not work with magisk out of the box.
found some magisk modules, maybe one of these binaries work for android 13 if you place it system/apex
[MODULE] Insecure adbd for Pixel devices
Hi everyone, I made a simple module for my own needs and I figured I'd share it here as well. This module enables "insecure adbd" on Pixel devices, which allows you to restart adbd in root mode via "adb root" and push/pull to/from the /data...
forum.xda-developers.com
[MODULE] Debugging modules: ADB Root, SELinux Permissive, Enable Eng
These modules are not meant for everyday use. They are intended for debugging and modification of a firmware. They significantly lower security of your device while active and even could softbrick it. You've been warned. ADB Root Magisk Module...
forum.xda-developers.com
Do I understand correctly:
To use/install the patched adbd I need a device with root permissions. Otherwise it wouldn't be possible to copy the adbd to /system/bin and make it executable. Having that patched adbd in /system/bin, I'm able to use the command adb root which let's me execute ADB commands with root permissions.
Why not using
Code:
adb shell
su
? Why I need a adbd with root permissions on a rooted device?
@WoKoschekk most likely he don't need it. we don't know. but there are cases where it can be useful, for example
Code:
adb pull /dev/block/bootdevice/by-name/userdata
alecxs said:
@WoKoschekk most likely he don't need it. we don't know. but there are cases where it can be useful, for example
Code:
adb pull /dev/block/bootdevice/by-name/userdata
Click to expand...
Click to collapse
Apart from the fact that it's not possible to restore such an image (e.g. corrupted encryption) you have to copy 128GB (minus the system) or more via USB. There is a reason why TWRP saves the data as a TAR archive and splits it into 1GB chunks.
I know there are more examples for a rooted adbd. But it could all be done in a root shell, too.
TWRP is useful for backup only if encryption is supported, which is not the case for Samsung encryption. But for forensic and recovery of deleted files full partition image is required. on FBE that /dev/block/bootdevice/by-name/userdata is already decrypted during runtime. for FDE one must adb pull /dev/block/dm-0 or whatever is mounted /data of course. Restoring works fine btw. just some encryption related files (like locksettings.db) must deleted.
I have posted workaround for streaming partitions with su (refer to 2. method in post #2) but it does not work on windows (not even with dos2unix)
TWRP was only an example for how /data could be backed up. In the most cases you restore /data after a wipe or when /data gets formatted. Then you will have a conflict with the already established encryption. After /data gets formatted the system generates a new master key during the next boot. You can't decrypt an old encryption with that master key.
The partition mirrors ~/dm-0 and so on are based on AVB and the device-mapper layer.
alecxs said:
I have posted workaround for streaming partitions with su
Click to expand...
Click to collapse
Yes, I know the 'netcat' method. Of course it's better to have a desktop PC and its storage for large images like /data. Better than an external sd. But you could also use the device's shell to create tar files.
WoKoschekk said:
Then you will have a conflict with the already established encryption.
Click to expand...
Click to collapse
Nope. works fine, as the partition image does not contain any encryption at all. consider it's already decrypted in AFU state.
WoKoschekk said:
After /data gets formatted the system generates a new master key during the next boot. You can't decrypt an old encryption with that master key.
Click to expand...
Click to collapse
Yes. only for FBE, for FDE it's static key. But encryption type doesn't matter, it contains plain files - same as TWRP backup.
Related
Hi guys, i tried to root Bluestacks Apps Player Beta for Mac OS X on Windows by using a method similar to the one used to root BS for Windows.
But unfortunately i am not able to test the modded files as i do not actually own a Mac OS X device, and i am not familiar with the OS either.
So i am asking, any volunteer here willing to help me test this experimental modded files?
How to use
1) Download BlueStacks AppPlayer Beta .dmg for Mac OS X & install it.
2) Download modded files provided below, make sure the targeted version is same as your installed version.
3) Extract the downloaded zip and use the modded files to replace the following folders:
Code:
~/Library/BlueStacks App Player/Android/Root.sparsefs/
~/Library/BlueStacks App Player/Android/Prebundled.sparsefs/
~/Library/BlueStacks App Player/Android/Data.sparsefs/
~/Library/BlueStacks App Player/Android/SDCard.sparsefs/
Downloads & Changelogs:
Code:
[URL="http://goo.gl/wJYSR"][SIZE="3"]BSRoot_0.3.6.102d.zip[/SIZE][/URL] (99.88 MB, Pass: [COLOR="Red"][email protected][/COLOR], Last Update: [COLOR="Red"]03/04/2013[/COLOR])
~ Target: BlueStacks for Mac OS X v[URL="http://goo.gl/ILhtK"]0.3.6.102[/URL] Only (Released: 21/03/2013)
+ Allow /system rw
+ su (standalone/on the fly)
+ Google Play v3.10.14
+ Google Contacts/Calendar Sync
+ Flash Player v11.1
+ Holo Launcher v2.0.2 Free
+ Terminal Emulator v1.0.52 OS
- Most bloatware
Notes:
- By replacing above folders, your existing settings & data will be gone, you are advised to create a backup before trying the mod.
* Please note that all version prior to the 03/04/2013 update probably will not work, try the latest version.
* If you tried please at least COME BACK TO VOTE so that i can know how it goes. Thank you!
-Reserved-
I think this worked, still trying to find a way to test the "rooted-ness" of it. Do you know where bluestacks puts the apps it installs from the market? /data seems to be empty.
---------- Post added at 04:58 PM ---------- Previous post was at 04:41 PM ----------
typing su into terminal gets me a segmentation fault
SuperSu hangs or doesn't run.
ESFile Explorer can't use it's "root" features. (Test Fails)
efdisastet said:
I think this worked, still trying to find a way to test the "rooted-ness" of it. Do you know where bluestacks puts the apps it installs from the market? /data seems to be empty.
typing su into terminal gets me a segmentation fault
SuperSu hangs or doesn't run.
ESFile Explorer can't use it's "root" features. (Test Fails)
Click to expand...
Click to collapse
Hi, Thanks for the feedback.
Without SuperSU working properly, terminal is running as app user thus you will not be able to view contents of /data/ as the folder is owned by 'system'.
Not sure why SuperSU is not working. Anyway, I have updated the files to use Superuser 3.2 instead of SuperSU, now with the updated files,
Superuser can be uninstalled easily, and if the superuser still causing problem, try uninstall it & run su without the apk installed.
Appreciate if you can retry the new file & also provide me the output for 'mount'. Thank you.
codelover said:
Hi, Thanks for the feedback.
Without SuperSU working properly, terminal is running as app user thus you will not be able to view contents of /data/ as the folder is owned by 'system'.
Not sure why SuperSU is not working. Anyway, I have updated the files to use Superuser 3.2 instead of SuperSU, now with the updated files,
Superuser can be uninstalled easily, and if the superuser still causing problem, try uninstall it & run su without the apk installed.
Appreciate if you can retry the new file & also provide me the output for 'mount'. Thank you.
Click to expand...
Click to collapse
Superuser app opened, but then closed on its own before I could check the settings.
I cleared data and then it seemed to stay open, so that I can go through the settings.
here's the result of su (still Segmentation fault)
and then mount
(sorry that it's a picture, copy seems to be an option, but can't find a way to paste.)
why does xda resize the pictures so small?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Re: [Emulator][BlueStacks Beta for Mac] Getting root access - Testers wanted
Would love to try this, codelover, but am wondering if you are testing in your own environment first, or are you expecting us to QA it? Don't get me wrong... I really appreciate you taking the lead on this, I just need to understand what my effort and interest level need to be. Thanks.
Sent from my SAMSUNG-SGH-I317 using xda premium
efdisastet said:
Superuser app opened, but then closed on its own before I could check the settings.
I cleared data and then it seemed to stay open, so that I can go through the settings.
here's the result of su (still Segmentation fault)
and then mount
Click to expand...
Click to collapse
Thanks! Now i know that /system can be mounted rw, one step forward. Next step is to find a working copy of su then we are done.
Can you confirm the Segmentation fault still appear after the apk been removed/uninstalled? One more thing, can you test run su after cd to /sdcard?
Just checked the alpha root by @bitstra, looks like they faced the same problem with superuser apk, so they have su working alone without the apk, maybe i will get you a copy of the su to test.
Btw do you have adb for Mac? Might need it to push su to BS for testing.
meatlocker said:
Would love to try this, codelover, but am wondering if you are testing in your own environment first, or are you expecting us to QA it? Don't get me wrong... I really appreciate you taking the lead on this, I just need to understand what my effort and interest level need to be. Thanks.
Click to expand...
Click to collapse
Hi meatlocker, Thank you for your interest. The answer is no, i have no chance to test it because i do not actually own a Mac.
But i have been working with BS for Windows for months that i am pretty sure Mac version can be rooted too.
I am just trying to help, it's really up to Mac users effort if they really want to see it get rooted.
The more feedback the faster it can be done. If i got a Mac that would be easier since i got several test cases that i can run on my own.
For now, everything is based on my assumption.
codelover said:
Thanks! Now i know that /system can be mounted rw, one step forward. Next step is to find a working copy of su then we are done.
Can you confirm the Segmentation fault still appear after the apk been removed/uninstalled? One more thing, can you test run su after cd to /sdcard?
Just checked the alpha root by @bitstra, looks like they faced the same problem with superuser apk, so they have su working alone without the apk, maybe i will get you a copy of the su to test.
Btw do you have adb for Mac? Might need it to push su to BS for testing.
Click to expand...
Click to collapse
yup, I've got adb installed and it see bluestacks, haven't tried to run any commands or anything
still get the Segmentation Fault and never get a typical su request popup for any app.
uninstalled superuser.
tried su in terminal, still Segmentation fault
installed SuperSu from play store
same results... app didn't run very well... tried to update itself and failed.
uninstalled
installed superuser (3.1.3?) from the Play store
took some screenshots (looked kinda hopeful?)
still same errors in terminal, no access to /data
efdisastet said:
installed SuperSu from play store
same results... app didn't run very well... tried to update itself and failed.
uninstalled
installed superuser (3.1.3?) from the Play store
took some screenshots (looked kinda hopeful?)
still same errors in terminal, no access to /data
Click to expand...
Click to collapse
You cannot install Superuser/SuperSU directly from market because it will install an arm version of the binary instead of the x86 that we need.
Now we need to identify which su binary version works with BS for Mac.
Please download the attached su-test.zip that contains various versions of su, extract to adb folder and then run the following commands:
Code:
adb push su-test /data/local/tmp/
adb shell chmod 777 /data/local/tmp/su*
adb shell /data/local/tmp/su-3.1-x86 -v
adb shell /data/local/tmp/su-3.1.1-x86 -v
adb shell /data/local/tmp/su-3.2-x86 -v
adb shell /data/local/tmp/su-bin-3.1 -v
adb shell /data/local/tmp/su-1.25 -v
adb shell /data/local/tmp/su.x86 -v
adb shell /data/local/tmp/su.orig -v
* Also try to run above su without -v
We are expecting su to returns a version number or 'permission denied' message from a working copy, instead of segmentation fault.
Please let me know which version works. I think we can finalize this soon. Thank you again.
Re: [Emulator][BlueStacks Beta for Mac] Getting root access - Testers wanted
Also, how can we get into the contents of the Android disk image files on a Mac to extract android files, etc?
And how much space do we have in the simulated Android to install apps?
Code:
adb push su-test /data/local/tmp/
adb shell chmod 777 /data/local/tmp/su*
adb shell /data/local/tmp/su-3.1-x86 -v
[COLOR="Red"]returned 3.1[/COLOR]
adb shell /data/local/tmp/su-3.1.1-x86 -v
[COLOR="red"]returned Segmentation fault[/COLOR]
adb shell /data/local/tmp/su-3.2-x86 -v
[COLOR="red"]returned Segmentation fault[/COLOR]
adb shell /data/local/tmp/su-bin-3.1 -v
[COLOR="red"]hung[/COLOR]
adb shell /data/local/tmp/su-1.25 -v
[COLOR="red"]hung[/COLOR]
adb shell /data/local/tmp/su.x86 -v
[COLOR="red"]returned Segmentation fault[/COLOR]
adb shell /data/local/tmp/su.orig -v
[COLOR="red"]returned su: permission denied[/COLOR]
* Also try to run above su without -v
[COLOR="red"]same results as above except that I got Segmentation fault on the ones that hung with -v[/COLOR]
efdisastet said:
Code:
adb shell /data/local/tmp/su-3.1-x86 -v
[COLOR="Red"]returned 3.1[/COLOR]
.....
adb shell /data/local/tmp/su.orig -v
[COLOR="red"]returned su: permission denied[/COLOR]
Click to expand...
Click to collapse
Definately a good news! I will try to rebuild Root.sparsefs to include both working copies of su-3.1 & su.orig.
But if i am not mistaken su.orig only works alone thus not supporting Superuser apk for confirmation.
EDIT: Files updated, download HERE.
CHANGES: Using su.orig copy without any Superuser apk.
NOTE: Might need to replace all new .sparsefs files instead of just Root.sparsefs.
Kinda weird as all su in su-test can run in BS for Windows except su.orig that returned Seg. fault.
Anyway, hope to hear some good news soon.
I replaced the files and kill Bluestacks, then I re-open Bluestacks .... NOTHING HAPPENED, my data and apps still there, and NO ROOT. Why?
nudawa said:
I replaced the files and kill Bluestacks, then I re-open Bluestacks .... NOTHING HAPPENED, my data and apps still there, and NO ROOT. Why?
Click to expand...
Click to collapse
1) Make sure you are using the required version, as these rooted files only works for v0.3.6.102.
2) Once you have replaced Data & SDCard, non of your existing apps should remain; If the apps still there you probably did it wrong.
3) Make sure you close your Bluestacks before replacing those files.
* Please note that the 'rooted files' mentioned above are 4 folders that contains 2 files in each folder.
codelover said:
Definately a good news! I will try to rebuild Root.sparsefs to include both working copies of su-3.1 & su.orig.
But if i am not mistaken su.orig only works alone thus not supporting Superuser apk for confirmation.
EDIT: Files updated, download HERE.
CHANGES: Using su.orig copy without any Superuser apk.
NOTE: Might need to replace all new .sparsefs files instead of just Root.sparsefs.
Kinda weird as all su in su-test can run in BS for Windows except su.orig that returned Seg. fault.
Anyway, hope to hear some good news soon.
Click to expand...
Click to collapse
did you want me to run some more tests?
so far all I've done is load the new files, open terminal, and try su: got permission denied
efdisastet said:
did you want me to run some more tests?
so far all I've done is load the new files, open terminal, and try su: got permission denied
Click to expand...
Click to collapse
Have you tried executing 'su' from adb instead of Terminal?
I am not sure how the included su.orig from alpha should behave as i got segfault here on Windows.
Unlike the newer SuperSU that works without apk, the su-3.1-x86 that worked for you during the test needs superuser apk,
but non of the apks i tested here work with that binary (All hung), kinda weird, until we have a working su+apk, other apps cannot gain root.
So i was thinking maybe we should try other superuser app, like the opensource ClockworkMod Superuser since it support x86 too.
Please download the attached su to test, let's see whether this one still causing segfault or not.
Code:
adb push su /data/local/tmp/
adb shell chmod 777 /data/local/tmp/su
adb shell /data/local/tmp/su -v
As usual, we are expecting su to return some version info.
As i don't think it's a good idea to keep asking you to download & test a new 100M file for something unsure, i provide you an alternative:
By replacing with this modded initrd.img (~/Library/BlueStacks App Player/AppBundle/Contents/Android/initrd.img), if this work (hopefully), it will:
- Create the following public accessible folder if not exists: /data/root
- Create the following test files: /data/root/test
- Change ownership, group & permissions needed for su for all files found inside /data/root/ on every boot.
Click to expand...
Click to collapse
Once replaced initrd.img, reboot and if you see a new file /data/root/test and it's owned by root then you can proceed to the below tests, otherwise useless.
Code:
1) Install ClockworkMod [URL="https://play.google.com/store/apps/details?id=com.koushikdutta.superuser"]Superuser[/URL] or download [URL="http://download.clockworkmod.com/apks/Superuser.apk"]here[/URL].
2) adb push su /data/root/su
3) Restart Bluestacks to get the permissions needed by su.
4) Open terminal & type the following command: /data/root/su # Should get a prompt
* Note that you will be asked to update su binary but you won't be able to do so at the moment. leave that first.
If non of the above work i guess the only option is to test all su binaries and apks, which is very time-consuming.
But i guess i am to giving up instead as it's too hard for me to debug without actually owning a Mac to test it.
codelover said:
Have you tried executing 'su' from adb instead of Terminal?
Click to expand...
Click to collapse
tried running it from an adb shell, still permission denied
I am not sure how the included su.orig from alpha should behave as i got segfault here on Windows.
Unlike the newer SuperSU that works without apk, the su-3.1-x86 that worked for you during the test needs superuser apk,
but non of the apks i tested here work with that binary (All hung), kinda weird, until we have a working su+apk, other apps cannot gain root.
So i was thinking maybe we should try other superuser app, like the opensource ClockworkMod Superuser since it support x86 too.
Please download the attached su to test, let's see whether this one still causing segfault or not.
Code:
adb push su /data/local/tmp/
adb shell chmod 777 /data/local/tmp/su
adb shell /data/local/tmp/su -v
As usual, we are expecting su to return some version info.
Click to expand...
Click to collapse
tried this: segmentation fault
As i don't think it's a good idea to keep asking you to download & test a new 100M file for something unsure, i provide you an alternative:
By replacing with this modded initrd.img (~/Library/BlueStacks App Player/AppBundle/Contents/Android/initrd.img), if this work (hopefully), it will:
Once replaced initrd.img, reboot and if you see a new file /data/root/test and it's owned by root then you can proceed to the below tests, otherwise useless.
Code:
1) Install ClockworkMod [URL="https://play.google.com/store/apps/details?id=com.koushikdutta.superuser"]Superuser[/URL] or download [URL="http://download.clockworkmod.com/apks/Superuser.apk"]here[/URL].
2) adb push su /data/root/su
3) Restart Bluestacks to get the permissions needed by su.
4) Open terminal & type the following command: /data/root/su # Should get a prompt
* Note that you will be asked to update su binary but you won't be able to do so at the moment. leave that first.
If non of the above work i guess the only option is to test all su binaries and apks, which is very time-consuming.
But i guess i am to giving up instead as it's too hard for me to debug without actually owning a Mac to test it.
Click to expand...
Click to collapse
did all that. /data/root exists and seems writable (though trying to do an ls in /data still gives me permission denied)
but /data/root/su still gave me segmentation fault...
which version was that? Which versions did we get to give us a version number the other day?
efdisastet said:
tried running it from an adb shell, still permission denied
/data/root exists and seems writable (though trying to do an ls in /data still gives me permission denied) but /data/root/su still gave me segmentation fault...
which version was that? Which versions did we get to give us a version number the other day?
Click to expand...
Click to collapse
It was su-3.1-x86 that i got it from here but the site is down at the moment. You can still find the binary on my previous post, inside su-test.zip.
With that version i managed to get root with adb, but without a working apk you cannot gain root from other apps since it was designed to act like that.
But what makes me wonder is that the su.orig that worked without apk (anyone confirm?) on alpha supposed to work on this beta too.
Now that /data/root/ is working as expected, it's so much easier for you to test the binaries, just push to /data/root/ and reboot to get the required permissions.
codelover said:
It was su-3.1-x86 that i got it from here but the site is down at the moment. You can still find the binary on my previous post, inside su-test.zip.
With that version i managed to get root with adb, but without a working apk you cannot gain root from other apps since it was designed to act like that.
But what makes me wonder is that the su.orig that worked without apk (anyone confirm?) on alpha supposed to work on this beta too.
Now that /data/root/ is working as expected, it's so much easier for you to test the binaries, just push to /data/root/ and reboot to get the required permissions.
Click to expand...
Click to collapse
/data/root/ may be working as expected, but there still seems to be a "su" in the path somewhere, whose permissions are denied. Will that cause problems
I put the 3.1 file from the su-test folder into /data/root, restarted bluestacks, and then went to terminal, I've attached a screenshot of those results, including calling just "su" to note the difference
Maybe if I had a better handle on what we wanted all the permissions to be and where we wanted this executable su to be, and what su an app/apk like superuser tries to use, I could help more.
Disclaimer
Code:
Whatever you do, it's your decision and you do it on your own risk!
I am not responsible for bricks, any kind of damages, data loss or any other unwanted result!
Everything you do is done on YOUR OWN RESPONSIBILITY!
And I am also not responsible if you lose the chat with your crush.
You might want to transfer your internal storage such as /sdcard to your computer directly and compressed as fast as possible.
So here is how you do it (on linux using bash):
Reboot your phone into TWRP, connect your device to your computer, and run the following command:
Code:
adb shell mkfifo /bk.pipe && adb exec-out 'tar -cvap data/media/0 2>/bk.pipe' | dd of=sdcard.tar & adb shell cat /bk.pipe &
In this example your data (in this case /data/media/0) will be backed up to your computer into the file sdcard.tar.
Compression is done automatically and you will get a nice output on your terminal on which file is being backed up currently.
When everything is finished you should get a message similar to this on your terminal:
Code:
79692237+2 records in
79692238+0 records out
40802425856 bytes (41 GB, 38 GiB) copied, 3550,38 s, 11,5 MB/s
(On the result of this you can see that the speed is around 12 MB/s, means that 1 GB backups in less than 1 minute)
When you get that, it means that your backup has finished and you can safely remove the usb cable.
Note that you can do this with any directory on your device, so if you desire to back up /data, just write data instead of data/media/0.
Example of the resulting sdcard.tar file (opened on my computer):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Decompressing your data directly to your device might get a little trickier:
Code:
adb shell mkfifo /rst.pipe && adb push sdcard.tar /rst.pipe & adb shell 'cd /; cat /rst.pipe | tar -xv'
If that does not work, you can just extract the content of the tar file normally onto your computer and then copy the files over using adb push or copy the tar file to your phone and extract it using the following command:
Code:
adb push sdcard.tar /sdcard/sdcard.tar
adb shell 'cd /; tar -xvf /sdcard/sdcard.tar'
And that should do the job as well.
---
See also:
tar to pipe but keep -v verbose output separate from STDERR
Transferring binary data over ADB shell (ie fast file transfer using tar)
Compose and pipe a gzipped tar archive in one go
Bash tar and output to log file
GNU Tar
Encrypting and Compressing
How encrypt data/text stream instead of a file?
Post on my blog:
How to backup compressed data from your android device to your computer
Is it possible to do this with windows cmd?
Hmm, that looks really complicated. How about rsync instead?
(Note: This requires root and it requires rsync... It's present on CyanogenMod and probably other custom roms, but usually not on stock ROMs...)
Code:
1. Create rsync.conf:
[root]
path = /
read only = no
uid = root
gid = root
2. Upload the file to the phone
$ adb push rsync.conf /sdcard/
3. Restart adbd with root permissions
$ adb root
4. Set up TCP forwarding of the rsync daemon through adb
$ adb forward tcp:9873 tcp:873
5. Run the daemon on the phone
$ adb shell /system/xbin/rsync --daemon --config /sdcard/rsync.conf --no-detach
6. Copy files in both directions
rsync -v rsync://localhost:9873/root/
rsync --help
Edit: You can also run rsync via SSH, e.g. with the help of SSHdroid:
Code:
rsync -e "ssh -l root -p 2222" -v <phone-ip>:/
adbsync utility by @Renate NST is pretty perfect for this too. I've got a batch automation for Windows packaged up in my Odds and Ends thread but I'm sure it wouldn't be hard to get something similar setup for Linux.
Nice!
Is there a way to do this but instead of coping files, copy the raw data from the internal memory? So that I can recover deleted files from the device from the generated raw file.
Tarcis said:
Nice!
Is there a way to do this but instead of coping files, copy the raw data from the internal memory? So that I can recover deleted files from the device from the generated raw file.
Click to expand...
Click to collapse
Something like (run in the host console)
Code:
adb exec-out "cat <sdcard partition> 2>/dev/null" > sdcard.raw
Or
Code:
adb exec-out "dd if=<sdcard partition> bs=64k 2>/dev/null" > sdcard.raw
This works on Windows too.
Something like on the first post that works on Windows but without the progress report (which is what the FIFO is for):
Code:
adb exec-out "tar czf - /sdcard" > sdcard.tar.gz
adb exec-out is an undocumented adb command that works like adb shell but without creating a pseudoterminal thus it works with binary content.
Has it been confirmed that all files are backed up this way? Main issue I have when backing up via MTP is that not all files seem to be transferred properly e.g. Carbon/Helium backups missing the json file.
tech3475 said:
Has it been confirmed that all files are backed up this way? Main issue I have when backing up via MTP is that not all files seem to be transferred properly e.g. Carbon/Helium backups missing the json file.
Click to expand...
Click to collapse
As far as I know, tar backups all files recursively in the directory you specified. Hence that should work perfectly fine. I recommend to use TWRP 3+ for this, but you can also try it on android itself.
Tarcis said:
Nice!
Is there a way to do this but instead of coping files, copy the raw data from the internal memory? So that I can recover deleted files from the device from the generated raw file.
Click to expand...
Click to collapse
It depends on your device, but in general, you can transfer any binary data over exec-out in highspeed.
Code:
adb root
adb exec-out "dd if=/dev/block/mmcblk0" > mmcblk0.img
In this case it would copy the whole internal storage including all partitions and everything from 0 to end of your internal emmc to your computer.
On newer devices/systems you can also use the following to copy the single partitions (in this example /data) as raw image to your pc:
Code:
adb root
adb exec-out "dd if=/dev/block/bootdevice/by-name/userdata">userdata.img
Examples for partition names: system, data, userdata, cache, boot, LOGO, recovery, ...
If you want to compress all partitions separately into a tar archive, following command should do:
Code:
adb root && adb exec-out 'cd /dev/block/bootdevice/by-name && tar -ca ./' > allpartitions.tar
This would also work on windows.
char101 said:
Something like (run in the host console)
Code:
adb exec-out "cat <sdcard partition> 2>/dev/null" > sdcard.raw
Or
Code:
adb exec-out "dd if=<sdcard partition> bs=64k 2>/dev/null" > sdcard.raw
This works on Windows too.
Something like on the first post that works on Windows but without the progress report (which is what the FIFO is for):
Code:
adb exec-out "tar czf - /sdcard" > sdcard.tar.gz
adb exec-out is an undocumented adb command that works like adb shell but without creating a pseudoterminal thus it works with binary content.
Click to expand...
Click to collapse
xdvs23 said:
It depends on your device, but in general, you can transfer any binary data over exec-out in highspeed.
Code:
adb root
adb exec-out "dd if=/dev/block/mmcblk0" > mmcblk0.img
In this case it would copy the whole internal storage including all partitions and everything from 0 to end of your internal emmc to your computer.
On newer devices/systems you can also use the following to copy the single partitions (in this example /data) as raw image to your pc:
Code:
adb root
adb exec-out "dd if=/dev/block/bootdevice/by-name/userdata">userdata.img
Examples for partition names: system, data, userdata, cache, boot, LOGO, recovery, ...
If you want to compress all partitions separately into a tar archive, following command should do:
Code:
adb root && adb exec-out 'cd /dev/block/bootdevice/by-name && tar -ca ./' > allpartitions.tar
This would also work on windows.
Click to expand...
Click to collapse
Thank you so much for the commands, but I ran them on Windows, and I get no error, but the output file is 1kb.
I tried running on dos prompt, I´ll try again tomorrow on cygwin
thank but too hard for me
can i have another software to do this?
There are a few ways which you can make a Nandroid backup. The recommended way is to use a custom recovery to create one, and it’s the only way to restore from one. You should be able to use any custom recovery that offers Nandroid backup capabilities — if you don’t want to search around, the best choices are CWM and TWRP. Once you’ve flashed a custom recovery onto your device, you can boot into it and choose to create (or later on, restore from) a Nandroid backup. It’ll go through the process and create a backup file on your microSD card or other equivalent storage location.
Emma Tayler said:
There are a few ways which you can make a Nandroid backup. The recommended way is to use a custom recovery to create one, and it’s the only way to restore from one. You should be able to use any custom recovery that offers Nandroid backup capabilities — if you don’t want to search around, the best choices are CWM and TWRP. Once you’ve flashed a custom recovery onto your device, you can boot into it and choose to create (or later on, restore from) a Nandroid backup. It’ll go through the process and create a backup file on your microSD card or other equivalent storage location.
Click to expand...
Click to collapse
Then tell me how to create a nandroid backup from your internal storage (/sdcard or /data/media/0)
Tarcis said:
Thank you so much for the commands, but I ran them on Windows, and I get no error, but the output file is 1kb.
I tried running on dos prompt, I´ll try again tomorrow on cygwin
Click to expand...
Click to collapse
Then open the file using e.g. notepad and show me the contents. It could be an error message or something...
cuddas said:
thank but too hard for me
can i have another software to do this?
Click to expand...
Click to collapse
I'm actually making backup tools which you can then use to create backups easily, maybe I'll also make a program with a user interface for windows where you can do that much easier.
Of course I cant promise anything atm cuz I have some other things to do as well.
xdvs23 said:
Disclaimer
Code:
adb shell mkfifo /bk.pipe && adb exec-out 'tar -cvap data/media/0 2>/bk.pipe' | dd of=sdcard.tar & adb shell cat /bk.pipe &
Click to expand...
Click to collapse
replace with this one
Code:
adb shell mkfifo /bk.pipe && adb exec-out 'tar -cvap data/media/0 2>/bk.pipe' | dd of=sdcard.tar & adb shell cat /bk.pipe &
xdvs23 said:
Then open the file using e.g. notepad and show me the contents. It could be an error message or something...
Click to expand...
Click to collapse
good idea!
The files contained:
allpartitions.tar: /sbin/sh: syntax error: unterminated quoted string on one tr
mmcblk0.img: 0kb
sdcard.raw : /sbin/sh: syntax error: unexpected redirection
userdata:img: dd: can't open '/dev/block/bootdevice/by-name/userdata': No such file or directory
Does this help?
http://syedtahir16.blogspot.in/2014/11/the-ultimate-android-backup-solution.html
syedtahir16 said:
Does this help?
http://syedtahir16.blogspot.in/2014/11/the-ultimate-android-backup-solution.html
Click to expand...
Click to collapse
No, but thanks. The ideia is to be able to backup without being able to load the OS.
how to restore?
Ok so i got a zte quest 5 (z3351s) though qlink. Not the phone i wanted but it was one i could afford. And it works very well just can't run amazon music and other apps at the same time.
But the bloatware is unreal. Used to in my galaxy s3&s4 days i could root and delete all apps i didn't need. I know i can disable them but i want them gone completely.
Majisk didnt work
Kingoroot same even used pc.
I am hoping someone knows of a way i can root this phone or at least delete all the un needed apps for example i have Google maps go (came stock) i put the org google maps which is better plus offers sat view.
Edit i did some math and converting and the useless apps 11 out of 58 come out to 349.72mb which is a lot if your phone only has 16gb of space. Also note i don't have hardly anything.
Worst case i can Hotspot to my note10+ for multitasking but not sure of data limit.
@TexasPride
a phone's Android can get considered "rooted" as soon as in Android the SU-binary is present. Hence you at any time at your own can install the appropriate SU-binary onto your phone's Android by means of ADB.
I heard about adb methods but i haven't messed with it in forever since apk/ios apps came out
jwoegerbauer said:
@TexasPride
a phone's Android can get considered "rooted" as soon as in Android the SU-binary is present. Hence you at any time at your own can install the appropriate SU-binary onto your phone's Android by means of ADB.
Click to expand...
Click to collapse
Are you sure it will always work?
I tried this method of installing supersu: https://github.com/spff/install-supersu-via-adb
As a result, I got my phone eternally showing the boot logo and not booting.
Not a problem to re-flash stock ROM but it is an example that there in no universal way to install SU (or SuperSU) via adb.
If you could give a link to some other method how SU could be installed, I'll give it a try of course.
vp1117 said:
Are you sure it will always work?
I tried this method of installing supersu: https://github.com/spff/install-supersu-via-adb
As a result, I got my phone eternally showing the boot logo and not booting.
Not a problem to re-flash stock ROM but it is an example that there in no universal way to install SU (or SuperSU) via adb.
If you could give a link to some other method how SU could be installed, I'll give it a try of course.
Click to expand...
Click to collapse
I spoke of SU-binary and NOT of SuperSU installer package
Example:
Code:
adb devices
adb push <location-of-matching-su-binary-on-computer> /sdcard/Downloads/ 2>nul
adb shell "chmod 0777 /sdcard/Downloads/su"
Of course you can install SuperSU package by means of ADB and this even when device is booted into Stock Recovery: but this requires to make some mods to SuperSU zip.
TexasPride, sorry I stepped in your thread.
jwoegerbauer said:
I spoke of SU-binary and NOT of SuperSU installer package
Click to expand...
Click to collapse
I see. It is often mixed in numerous materials one can find in the net. Subject is SU-binary update, but the ultimate goal is to install supersu.
jwoegerbauer said:
Example:
Code:
adb devices
adb push <location-of-matching-su-binary-on-computer> /sdcard/Downloads/ 2>nul
adb shell "chmod 0777 /sdcard/Downloads/su"
Click to expand...
Click to collapse
What should be result of running this code? SU-binary located in Downloads with 777 permission? What is the practical sense/use of it?
What software/application would use SU in that location?
Sorry for my questions. I'm not arguing. I try to understand the idea.
jwoegerbauer said:
Of course you can install SuperSU package by means of ADB and this even when device is booted into Stock Recovery: but this requires to make some mods to SuperSU zip.
Click to expand...
Click to collapse
Somehow, with my almost zero knowledge of edify and linux command line I got the same conclusion: SuperSU zip has to be modified in order to install it via adb on devices that do not have TWRP for sideload. I failed to find any examples of SuperSU modding...
@vp1117
Answering your questions from last to first:
Installing SuperSU.zip via ADB
The SuperSU.zip doesn't come with an EDIFY coded script, but with an Android SHELL script - everyone who has knowledge of LINUX scripting can read / modify it.
Android comes with TAR-binary, but not ZIP-binary. Hence the SuperSu.zip must get repacked into SuperSU.tar thus it can get extracted on Phone. The contents of such a TAR-file would look as shown here
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Making use of SU-binary
The SU-binary ( ~110KB ) is nothing else then the root user, as known from LINUX.
Running in Android via ADB a command that requires super-user ( root ) rights is done as follows
Example:
Code:
adb devices
adb shell "/sdard/Downloads/su -c '<ommand-that-requires-root-here>'"
jwoegerbauer said:
Answering your questions from last to first:
Installing SuperSU.zip via ADB
The SuperSU.zip doesn't come with an EDIFY coded script, but with an Android SHELL script - everyone who has knowledge of LINUX scripting can read / modify it.
Android comes with TAR-binary, but not ZIP-binary. Hence the SuperSu.zip must get repacked into SuperSU.tar thus it can get extracted on Phone. The contents of such a TAR-file would look as shown here
Click to expand...
Click to collapse
OK. I guess, I can repack zip to tar.
Sorry for my silly question but why should I need to keep superSU as an archive? Could not I just upload all folders + update-binary.sh to the phone? I'm sure I can do it.
Am I right my next step would be running update-binary.sh (~60 KB) from <adb shell> command line?
jwoegerbauer said:
Making use of SU-binary
The SU-binary ( ~110KB ) is nothing else then the root user, as known from LINUX.
Running in Android via ADB a command that requires super-user ( root ) rights is done as follows
Example:
Code:
adb devices
adb shell "/sdard/Downloads/su -c '<ommand-that-requires-root-here>'"
Click to expand...
Click to collapse
Interestingly, I can execute all commands I need without having su-binary (~100 KB) uploaded to my phone. It is strange but I see #-prompt after I ran <adb shell>. This happens on my UNrooted phone, running stock ROM. I guess, it's a specifics of my phone, no need to try explain it.
I done failed trying to read i dont really understand linux all that well. But if anyone has any links so i can download it and try it
vp1117 said:
Sorry for my silly question but why should I need to keep superSU as an archive? Could not I just upload all folders + update-binary.sh to the phone? I'm sure I can do it.
Am I right my next step would be running update-binary.sh (~60 KB) from <adb shell> command line?
Click to expand...
Click to collapse
Of course it's your decision how you transfer the SuperSU package onto phone: many ways lead to Rome.
My decision was to push SuperSU package repacked as TAR-file onto phone, extract it there, and finally run the modified update-binary.sh when phone is booted into recovery mode:
Code:
adb shell "$(cat < %supersu_dir%/update-binary.sh); echo $?"
So I rebooted to stock recovery and then uploaded following from UPDATE-SuperSU-v2.82-20170528234214.zip package to my phone's folder /tmp:
/arm64
/common
/META-INF
update-binary.sh
Here is what I got:
Z:\android\adb>adb shell "$(cat < /tmp/update-binary.sh); echo $?"
127
/system/bin/sh: #!/sbin/sh: not found
And here's what I got running same command from # command line:
# $(cat < /tmp/update-binary.sh); echo $?
/system/bin/sh: #!/sbin/sh: not found
127
In response to # ls -al /sbin I get lots of lines one of them is as follows:
lrwxrwxrwx 1 root root 7 1970-01-01 00:00 sh -> busybox
I feel that I'm doing something wrong, but what exactly?
In attached txt-file I put some more details I got in command line.
jwoegerbauer said:
... and finally run the modified update-binary.sh when phone is booted into recovery mode:
Click to expand...
Click to collapse
Am I right the only modification needed is to rename update-binary to update-binary.sh ?
@vp1117
NO.
When I said modified then I didn't mean simply rename it: The contents of original update-binary file must be rewritten / deleted in some parts. Also, believe me, it makes sense to repack original SuperSU.zip to SuperSu.tar as I demonstrated above. Take also note that, if device's Android isn't rooted yet, the location for unpacked SuperSU mandatory must be /data/local/tmp.
BTW:
I can see BusyBox is installed on your device's Android. Take note that BusyBox by default comes with the SU-binary. Hence your device's Android is rooted! Wondering why you waste your time with trying to completely install SuperSU from scratch?
jwoegerbauer said:
Wondering why you waste your time with trying to completely install SuperSU from scratch?
Click to expand...
Click to collapse
Good question.
Probably, because I see this when phone restarts from recovery to normal android:
jwoegerbauer said:
Also, believe me, it makes sense to repack original SuperSU.zip to SuperSu.tar as I demonstrated above.
Click to expand...
Click to collapse
OK, no problem, I can re-pack zip into tar.
However, what you demonstrated above was a screenshot showing update-binary.sh being inside the tar. At the same time you don't tell how update-binary.sh must be amended. Is it OK?
TexasPride
I'm very sorry I put so much spam in your thread. Please forgive me. If I knew how to delete my posts here I would deleted them.
vp1117 said:
TexasPride
I'm very sorry I put so much spam in your thread. Please forgive me. If I knew how to delete my posts here I would deleted them.
Click to expand...
Click to collapse
Its ok, i dont mind at all.
@TexasPride
FYI: I no longer participate this hijacked thread.
So i am trying to make a simple shell script which will execute multiple ADB commands, here's what i have come up with.
#bin/sh
echo -------------------------------
echo Removing lockscreen ads...
echo -------------------------------
adb shell pm disable-user --user 0 com.amazon.kindle.kso
when i try to do, bash file.sh it just says bash is a unknown command, so what am i doing wrong?
ADB is a commandline tool to be run either on Windows OS, preferredly wrapped into a Windows CMD script, or in Android OS, preferredly wrapped into an Android shell script.
If you intend to run ADB commands in Android's terminal then a shell script would look like this
Code:
#!sbin/sh
ADB=/usr/bin/adb
"$ADB" shell "<COMMAND-HERE>"
jwoegerbauer said:
ADB is a commandline tool to be run either on Windows OS, preferredly wrapped into a Windows CMD script, or in Android OS, preferredly wrapped into an Android shell script.
If you intend to run ADB commands in Android's terminal then a shell script would look like this
Code:
#!sbin/sh
ADB=/usr/bin/adb
"$ADB" shell "<COMMAND-HERE>"
Click to expand...
Click to collapse
Okay, thank you. will try that right away
i could also use this in a windows batch file?(sorry bit of a noob about this )
ComputerTech312 said:
i could also use this in a windows batch file?(sorry bit of a noob about this )
Click to expand...
Click to collapse
If you'ld carefully read posts then you'll notice this question already get answered.
jwoegerbauer said:
If you'ld carefully read posts then you'll notice this question already get answered.
Click to expand...
Click to collapse
Apologies, i misread your post
What would the changes be to your code if it's a Windows CMD script? would changes to the path be required and such?
It really depends on what you're trying to do.
I wrote the following as a simple .bat file and ran it from my platform-tools directory on my Windows laptop:
@Echo Off
echo Checking for Devices.
adb devices
echo Is device present?
echo (Press Enter if yes, Ctrl+C or close Script if not)
pause
echo Rebooting to recovery.
adb reboot recovery
echo Waiting 30 seconds for reboot.
timeout /t 30
echo Checking for Devices.
adb devices
echo Is device present?
echo (Press Enter if yes, Ctrl+C or close Script if not)
pause
echo Decrypting Data in TWRP.
adb shell twrp decrypt ******
pause
Click to expand...
Click to collapse
And it does the following:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
ComputerTech312 said:
What would the changes be to your code if it's a Windows CMD script? would changes to the path be required and such?
Click to expand...
Click to collapse
An Android shell script and a Windows bash script ( including a Powerpoint script ) are in all aspects different with regards to coding, this because Android shell scripts are coded using Linux synthax.
BTW:
To not have to dance on 2 weddings I create my scripts mainly as pure Android shell scripts, which I copy from PC to Android device, and then start executing it from PC by means of ADB using a Windows bash script.
Example Windows bash script:
Code:
@echo off
adb devices
adb push <ANDROID-SCRIPT-PATH-ON-PC-HERE> /tmp
adb shell "chmod 0755 /tmp/<ANDROID-SCRIPT-NAME-HERE>"
adb shell "cd /tmp; $(<ANDROID-SCRIPT-NAME-HERE>);"
adb shell "rm -f /tmp/<ANDROID-SCRIPT-NAME-HERE>"
Deleted member 1890170 said:
An Android shell script and a Windows bash script ( including a Powerpoint script ) are in all aspects different with regards to coding, this because Android shell scripts are coded using Linux synthax.
BTW:
To not have to dance on 2 weddings I create my scripts mainly as pure Android shell scripts, which I copy from PC to Android device, and then start executing it from PC by means of ADB using a Windows bash script.
Example Windows bash script:
Code:
@echo off
adb devices
adb push <ANDROID-SCRIPT-PATH-ON-PC-HERE> /tmp
adb shell "chmod 0755 /tmp/<ANDROID-SCRIPT-NAME-HERE>"
adb shell "cd /tmp; $(<ANDROID-SCRIPT-NAME-HERE>);"
adb shell "rm -f /tmp/<ANDROID-SCRIPT-NAME-HERE>"
Click to expand...
Click to collapse
I am doing similar adb commands but from a bash script on a PC connected only via wifi to android box.
FYI, unlike a phone these Android 11 devices are not recognized by Windows11 when connected via a USB cable.
Commands I issue are things like
$ADB_CMD shell pm uninstall org.courville.nova
Before I can use these varous ADB commands I have to
(1) manually add the box to my wifi (via a mini-keyboard attached to android box)
(2) figure out which IP it was assigned by my router
(3) update my script with the correct IP to it can issue all the $ADB_CMD = eg. "../ADB -s 192.168.123:5555"
(4) run the script
I would like to skip steps 1..3, so the idea of running a similar script on the android box is very attractive.
(1) prepare a usb thumbdrive with a script, aps, ... and plug it into the android device
(2) use the filemanager on the device to execute the script
(3) done (ie. never have to connect to wifi).
What do you suggest doing?
I assumed by the nature of it's name "bridge" that ADB is meant to be run over a connection?
Ideally I would like to install nothing on the android device but I would not mind if a script installed some apk from the thumbdrive and then de-installed it.
The device is rooted.
Can you actually get some shell prompt on Android? or does it require an app to be installed.
I saw references to /usr/bin/sh I have no idea how to start one
Thank you for helping out.
Short answer: use
SH Script Runner for Android - APK Download
Download SH Script Runner apk 1.10 for Android. Bash script runner and shell command executor with superuser functionality.
apkpure.com
app to run scripts on Android device without the need of ADB
.
xXx yYy said:
.
xXx yYy said:
Short answer: use
SH Script Runner for Android - APK Download
Download SH Script Runner apk 1.10 for Android. Bash script runner and shell command executor with superuser functionality.
apkpure.com
app to run scripts on Android device without the need of ADB
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So I downloaded SH Script Runner_v1.10_apkpure.com.apk onto a thumbdrive
I insert it into the android device I have to install it manually?
can you provide a sample script.sh that would run the equivalent of I can take it from there
$ADB_CMD shell pm uninstall org.courville.nova
...
I went ahead and installed the SH Script Runner it looks like it's designed to create/manage several scripts. I am not sure I understand yet it's flow.
When accessing the upper-right menu ... "open local script" It does not appear to let me browse other than internal /sdcard IOW, it does not seem to list my connected thumbdrive like this simple FileManager or X-plore would.
Once I understand the syntax of this script.sh I will convert my current make.sh and take it over the android device.
I do all my script editing on a PC with VScode editor.
Thank you for your guidance.
SH Script Runner is both a script editor and script executor, means write your code into this editor and run the script.
Example:
Code:
pm uninstall org.courville.nova
adb root
I have already tried the following command, but it says:
adbd cannot run as root in production builds
xracerx123 said:
adb root
I have already tried the following command, but it says:
adbd cannot run as root in production builds
Click to expand...
Click to collapse
Uh.. What are you trying to do?
Are you trying to emulate a Pixel 6a on your computer, or do you want to have root privileges on your device?
I want to have write permission on /system/bin and /system/xbin, this is for the purpose of me importing nano into the devices. My main goal is to have a bashrc alias and and make it easy for me to edit files in the system.
xracerx123 said:
I want to have write permission on /system/bin and /system/xbin, this is for the purpose of me importing nano into the devices. My main goal is to have a bashrc alias and and make it easy for me to edit files in the system.
Click to expand...
Click to collapse
You'll have to look into rooting then. I suggest you use Magisk. There are many guides on xda (specifically for this device too).
Even magisk won't overcome that error, because at the end of the day, it is a production build.
But that doesn't mean you can't use root! You just can't call "adb root".
Code:
adb shell
$ su
# <-- do stuff as root
# exit
$
xracerx123 said:
I want to have write permission on /system/bin and /system/xbin, this is for the purpose of me importing nano into the devices. My main goal is to have a bashrc alias and and make it easy for me to edit files in the system.
Click to expand...
Click to collapse
Just to be clear, even if you have root, you can't easily write to the system partition. The system partition is mounted as read-only and to get around that you'd need several steps like a modified super partition, and potentially have verity/verification disabled.
Your best bet you be to use Magisk, and either use the Magisk mirror partitions to add nano, or use the Magisk nano module (https://github.com/Magisk-Modules-Repo/nano-ndk)
96carboard said:
Even magisk won't overcome that error, because at the end of the day, it is a production build.
But that doesn't mean you can't use root! You just can't call "adb root".
Code:
adb shell
$ su
# <-- do stuff as root
# exit
$
Click to expand...
Click to collapse
You can use Termux, or any other terminal emulator, type 'su', allow superuser privileges, and do stuff as root.
craigacgomez said:
Just to be clear, even if you have root, you can't easily write to the system partition. The system partition is mounted as read-only and to get around that you'd need several steps like a modified super partition, and potentially have verity/verification disabled.
Your best bet you be to use Magisk, and either use the Magisk mirror partitions to add nano, or use the Magisk nano module (https://github.com/Magisk-Modules-Repo/nano-ndk)
Click to expand...
Click to collapse
Btw, how do I install nano-ndk? There is no release on the GitHub page and when I try to download the .zip file and install, it say fail.
[ Error writing /etc/mkshrc: Read-only file system ]
How do I go about editing this when it is a read only file system
Ok I have successfully added nano, now how do I edit the following file to add alias
Lada333 said:
You can use Termux, or any other terminal emulator, type 'su', allow superuser privileges, and do stuff as root.
Click to expand...
Click to collapse
That's what I said in the message you quoted. There is no need to repeat it.
96carboard said:
That's what I said in the message you quoted. There is no need to repeat it.
Click to expand...
Click to collapse
You never really mentioned where you suggest them use that bit of code you provided, nor have you suggested they use a terminal emulator (where they can obtain root privileges), but alright.
Lada333 said:
You never really mentioned where you suggest them use that bit of code you provided, nor have you suggested they use a terminal emulator (where they can obtain root privileges), but alright.
Click to expand...
Click to collapse
Terminal emulator application is irrelevant. OP was asking about ADB specifically.
hope you are aware that if you modify /system you can't ota update anymore
see this https://topjohnwu.github.io/Magisk/ota.html
96carboard said:
Even magisk won't overcome that error, because at the end of the day, it is a production build.
But that doesn't mean you can't use root! You just can't call "adb root".
Click to expand...
Click to collapse
You CAN...but this can only be done in engineering and debug builds.
adb root restarts adbd with root permissions.
There is a way around this; use an elevated shell to write ro.debuggable=1 to /system/build.prop, /system/default.prop, or /data/local.prop
If you want adb shell to automatically start with root, add ro.secure=0