Install APK Without Fully Booting Device - Android Q&A, Help & Troubleshooting

Is there a way to install APK's from any of the bootloader menus? I can install through ADB if the device is fully booted & I have enabled USB Debugging. Is that the only way?
If that IS the only way, is there a way to reset the device's "first boot" attribute back to true after the first boot, so that the manufacturer's setup software runs on the next boot?

get into recovery,run adb,type "adb install app.apk /data/app/app.apk" for installing as user app,or type "adb install app.apk /system/app/app.apk" to install as system app..
Sent from my LT18i

Awesome, I don't understand but I will try it!

If you have shell connection to the STB
Put the apk on an SD card
You must have busybox too (some devices have the applet)
while in bootloader busybox install ApkPath/ApkName /data/app/ApkName
so the first path is the sd card

Related

[Q] Install apps to sd by default on Non Rooted Phone

Hi,
I have a Spice Mi-270 dual sim android 2.2 phone.Searching on the internet I came across an article where the procedure for installing the apps by default to sdcard is possible for non rooted phones.I tried it but when I type "adb devices" I get a blank list under list of devices attached.My phone came with the usb drivers, I have installed that.Tried installing Google USB driver package,revision 4.When the phone is plugged in get the message on the phone "USB Debugging started".Windows device manager shows "Android Phone" > Android Composite ADB Interface.Still my device is not detected with the "adb devices" command.I am using winxp pro sp3 32bit.Please Guide!
(If I have posted in the wrong section please inform me where to post)
I probably won't be helping. But on my un-rooted HTC Sensation i just have an app called app2sd. After i installed an app, if it's supported, i copy it to sd card.
Can't you just use that and save the hassle?
try this apps2sd
I have already installed the apps2sd but as said one can move the apps to sd if and only if supported by the app.Besides Android 2.2 by default provides the option to supported apps.How do I change the default install path to sd without rooting?
sounds like u need to root it and add the a2sd+ scripts OR root, install rom with a2sd+ and partition sd card accordingly.
do0b said:
sounds like u need to root it and add the a2sd+ scripts OR root, install rom with a2sd+ and partition sd card accordingly.
Click to expand...
Click to collapse
Sorry doOb but I am not looking at rooting my phone but use the option
adb shell pm setInstallLocation 2.
Why not root your phone? At the end or the day you still can unroot it. It's not like you flash to a different Rom and lost your stock Rom.
As far as I know your running froyo you already have move app to SD at the manage application in setting. There are free market app that can help you to move apps to SD with simple clicks without going to setting with the slow loading.
I'm afraid there are no default to app to SD unless you root your Rom and flash a2sd script like darktermor to make the whole process default. Better still, you also need to partition your card with an ext partition for it to work.
By the way... You should be able to adb shell your phone with a proper setup from your pc. You need to look for adb shell howto.
Sounds like your doing it from the wrong folder at cmd if your using windows. Try start cmd from the folder with adb.exe or set your system path to include the folder with adb.exe. I'm not with a pc now, I can't direct you. You have to look for it on what I mean.
By the way, can you also post the link for the article you found?
I have friends that can't root their phone. E.g HTC wildfire s
Sent from my HTC Legend using XDA App
darryl_co said:
Hi,
I have a Spice Mi-270 dual sim android 2.2 phone.Searching on the internet I came across an article where the procedure for installing the apps by default to sdcard is possible for non rooted phones.I tried it but when I type "adb devices" I get a blank list under list of devices attached.My phone came with the usb drivers, I have installed that.Tried installing Google USB driver package,revision 4.When the phone is plugged in get the message on the phone "USB Debugging started".Windows device manager shows "Android Phone" > Android Composite ADB Interface.Still my device is not detected with the "adb devices" command.I am using winxp pro sp3 32bit.Please Guide!
(If I have posted in the wrong section please inform me where to post)
Click to expand...
Click to collapse
Sounds like the original issue was the pc not seeing the device....I know this may be elementary, but do you have it in "charge only" mode and not in the disk drive mode?
"Sounds like your doing it from the wrong folder at cmd if your using windows. Try start cmd from the folder with adb.exe or set your system path to include the folder with adb.exe." - pysionx
I am starting cmd from the folder with adb.exe that laocated in platform-tools.If I was not doing so I would get the error " 'adb' is not recognized as an internal or external command operable program or batch file." and on typing adb devices in the cmd prompt I would not get the answer "list of devices"
pysionx - "By the way, can you also post the link for the article you found?"
Unfortunately no as this is my first post I am not allowed by the administrator to do so.Please Check out the attachment.Sorry for giving you the trouble to download attachment.
pfroyjr - "Sounds like the original issue was the pc not seeing the device"
If the pc does not see the device how do I get in Windows device manager showing "Android Phone" > Android Composite ADB Interface.
pfroyjr - "I know this may be elementary, but do you have it in "charge only" mode and not in the disk drive mode?"
I do not have it in "charge only" mode but in the disk drive mode, USB debugging started is the message received in the notification area.
But this causes hw to crash!
root_toor said:
But this causes hw to crash!
Click to expand...
Click to collapse
I sorry but I did not understand. what causes hardware to crash?
Google "Spice driver" I'll find a link if you can't. Windows is odd with its drivers sometimes. I remember the first time I ever used SDK I had to remove the default drivers and install the one from HTC but recently just installing the driver was good enough and I've only used adb and not the SDK. just a suggestion.
Sent from my HTC Glacier using xda premium
EDIT: I forgot which posting I was replying to, sorry....
I found THIS which sounds like it's an issue with the phone and maybe not the same Android OS that everyone else has....just what I read. Happy Googling my friend. Sounds like it's a cool device, just not quite up to par with adb.
I do have the drivers of my mobile Spice Mi-270 which was shipped along with the phone. The drivers files are of similar names with that of the google usb drivers for android except for the file versions.
Thanks pfroyjr for the link.It seems it is the problem with the phone itself as I am not the only one facing the problem with adb comand.
darryl_co said:
I do have the drivers of my mobile Spice Mi-270 which was shipped along with the phone. The drivers files are of similar names with that of the google usb drivers for android except for the file versions.
Thanks pfroyjr for the link.It seems it is the problem with the phone itself as I am not the only one facing the problem with adb comand.
Click to expand...
Click to collapse
Best advice is stay active searching for an answer...someone will eventually figure it out
I think it can be done with the help of adb .
Just run command from the folder having adb.exe file after connecting your phone in USB Debugging Mode.
"adb shell pm setInstallLocation 2"
YOu can change it to default by the following command.
"adb shell pm setInstallLocation 0"
Type the commands without quotes....
Hope it helps!!!
darryl_co said:
I have already installed the apps2sd but as said one can move the apps to sd if and only if supported by the app.Besides Android 2.2 by default provides the option to supported apps.How do I change the default install path to sd without rooting?
Click to expand...
Click to collapse
Hey try this adb command from the directory having adb.exe file after connecting your phone to your pc by enabling USB Debugging Mode on it.
adb shell pm setInstallLocation 2
You can change it back to default by this command ..
adb shell pm setInstallLocation 0
Hope it helps you ...
yagya said:
Hey try this adb command from the directory having adb.exe file after connecting your phone to your pc by enabling USB Debugging Mode on it.
adb shell pm setInstallLocation 2
You can change it back to default by this command ..
adb shell pm setInstallLocation 0
Hope it helps you ...
Click to expand...
Click to collapse
when I type "adb devices" I get a blank list under list of devices attached.When my phone is not listed how would the adb shell pm setInstallLocation command work ?
but The pc does see the device and I get in Windows device manager showing "Android Phone" > Android Composite ADB Interface.
Try to install universal root/z4root/any other rooting app and shell commander in your phone then root your device temporarily (temporary root means root will be removed when you reboot)with universal root asn then in shell commander type the commands
su
pm SetInstallLocation 2
and then you can unroot your phone
Also if you want to change back do the same but change 2(externel) to 0(auto)
Hope it helped you!!!
---------- Post added at 09:34 PM ---------- Previous post was at 09:33 PM ----------
Try to install universal root/z4root/any other rooting app and shell commander in your phone then root your device temporarily (temporary root means root will be removed when you reboot)with universal root asn then in shell commander type the commands
su
pm SetInstallLocation 2
and then you can unroot your phone
Also if you want to change back do the same but change 2(externel) to 0(auto)
Hope it helped you!!!
yagya said:
Try to install universal root/z4root/any other rooting app and shell commander in your phone then root your device temporarily (temporary root means root will be removed when you reboot)with universal root asn then in shell commander type the commands
su
pm SetInstallLocation 2
and then you can unroot your phone
Also if you want to change back do the same but change 2(externel) to 0(auto)
Hope it helped you!!!)
Click to expand...
Click to collapse
I installed universal androot and rooted the phone.
Instead of shell commander I installed Move2SD Enabler.The move2sd had three radio buttons Auto, Internal and External.Initially it displayed the radio button on Auto.I selected External and clicked apply.Now it shows External.Then I unrooted the phone.In Apps2SD I found many apps that were listed under phone only under movable apps.Few questions do arise
1.If I restore to factory defaults will the installation to external storage be resetted?
2.Whenever I Install new apps it gets installed in the phones internal storage and the I have to move to sd.Why is that so?
3.Even after moving to the sd some amount remains in the phone internal storage.why?
4.Can I check using shell commander if the install location has changed? what is the command? Do I have to root the phone again to use the command?
darryl_co said:
I installed universal androot and rooted the phone.
Instead of shell commander I installed Move2SD Enabler.The move2sd had three radio buttons Auto, Internal and External.Initially it displayed the radio button on Auto.I selected External and clicked apply.Now it shows External.Then I unrooted the phone.In Apps2SD I found many apps that were listed under phone only under movable apps.Few questions do arise
1.If I restore to factory defaults will the installation to external storage be resetted?
2.Whenever I Install new apps it gets installed in the phones internal storage and the I have to move to sd.Why is that so?
3.Even after moving to the sd some amount remains in the phone internal storage.why?
4.Can I check using shell commander if the install location has changed? what is the command? Do I have to root the phone again to use the command?
Click to expand...
Click to collapse
Restoring factory default settings will reset default install location to auto.
Since you used move to sd enabler it only makes all apps movable to sd but doesn't move them automatically.
System apps and Those apps that don't support app to sd by default can't be completely moved to sd card
Yes, you can check using shell commander but you need to riot you phone to use the command.
pm getInstallLocation
(returns default install location)
pm setInstallLocation 2
(installs app direct to external storage)
Sent from my GT-S5570 using XDA Premium App

Please Help

my phone wont go past HTC starting screen.
How can i flash stock att rom ?
I am stuck. suggestions appreciated.
Why won't it? What did you do to get to this state? What did you flash?
The more details you give...the more likely someone will be able to help you!
well i have unlocked bootloader.
i flashed one mod for extended power menu and after that my phone wont go past HTC one screen so i wiped and did factory reset still phone wont boot.
I went in to recovery menu and formated system and now i dont know how to flash stock rom.
varuun said:
well i have unlocked bootloader.
i flashed one mod for extended power menu and after that my phone wont go past HTC one screen so i wiped and did factory reset still phone wont boot.
I went in to recovery menu and formated system and now i dont know how to flash stock rom.
Click to expand...
Click to collapse
Here is all you need to know.
HTC One FAQ
I take it you did not make a NAND backup?? Always advised to make a BU before flashing anything!
What recovery did you install?
shawman said:
Here is all you need to know.
HTC One FAQ
Click to expand...
Click to collapse
Somehow i can not access USB storage so in this case how can i put rom into internal storage?
varuun said:
Somehow i can not access USB storage so in this case how can i put rom into internal storage?
Click to expand...
Click to collapse
ADB Sideload it. Here's the stock Deodexed ROM I used when I had that problem.
Download a ROM that you want to flash. Use ADB Sideload method.
Have a recovery installed on your device that supports ADB sideload like TWRP 2.3 or higher.
Set the device into ADB sideload mode. In TWRP you do this by going to Advanced then ADB Sideload.
From the command line, type adb sideload /path/to/rom.zip (e.g., adb sideload C:/ADB/[name of ROM].zip...or open the command prompt when in your adb folder; in Windows 7, go to your adb folder on your pc...use shift and right-click, open command window here...then just type
adb sideload [name of ROM].zip)
The file will be copied to your device to whatever the current storage location is that you have selected in the mount page. It will always be placed in the root of that storage location and named sideload.zip (e.g. /sdcard/sideload.zip) and it will automatically delete / overwrite any existing sideload.zip you may have on your device. As soon as the file is copied to your device, it will automatically be installed. When the install is finished you will be presented with a reboot system button so that you can reboot to test your zip.
wmg316 said:
Download a ROM that you want to flash. Use ADB Sideload method.
Have a recovery installed on your device that supports ADB sideload like TWRP 2.3 or higher.
Set the device into ADB sideload mode. In TWRP you do this by going to Advanced then ADB Sideload.
From the command line, type adb sideload /path/to/rom.zip (e.g., adb sideload C:/ADB/[name of ROM].zip...or open the command prompt when in your adb folder; in Windows 7, go to your adb folder on your pc...use shift and right-click, open command window here...then just type
adb sideload [name of ROM].zip)
The file will be copied to your device to whatever the current storage location is that you have selected in the mount page. It will always be placed in the root of that storage location and named sideload.zip (e.g. /sdcard/sideload.zip) and it will automatically delete / overwrite any existing sideload.zip you may have on your device. As soon as the file is copied to your device, it will automatically be installed. When the install is finished you will be presented with a reboot system button so that you can reboot to test your zip.
Click to expand...
Click to collapse
..... Is that..... Mike G.??? You're an Android Guy too!
That's me! Who is this?
wmg316 said:
That's me! Who is this?
Click to expand...
Click to collapse
Josh S. from Landmark
Small world!!
wmg316 said:
Small world!!
Click to expand...
Click to collapse
No kidding.
P.S TrickDroid is a pretty sweet ROM.
Hi
I am doing as you said but i am getting attached screen. its not working for me.
wmg316 said:
Download a ROM that you want to flash. Use ADB Sideload method.
Have a recovery installed on your device that supports ADB sideload like TWRP 2.3 or higher.
Set the device into ADB sideload mode. In TWRP you do this by going to Advanced then ADB Sideload.
From the command line, type adb sideload /path/to/rom.zip (e.g., adb sideload C:/ADB/[name of ROM].zip...or open the command prompt when in your adb folder; in Windows 7, go to your adb folder on your pc...use shift and right-click, open command window here...then just type
adb sideload [name of ROM].zip)
The file will be copied to your device to whatever the current storage location is that you have selected in the mount page. It will always be placed in the root of that storage location and named sideload.zip (e.g. /sdcard/sideload.zip) and it will automatically delete / overwrite any existing sideload.zip you may have on your device. As soon as the file is copied to your device, it will automatically be installed. When the install is finished you will be presented with a reboot system button so that you can reboot to test your zip.
Click to expand...
Click to collapse
Do you have TWRP recovery?
If so, did you boot device to recovery?
If so, did you then select Advanced, ADB Sideload...then swipe to start?
THEN...run the command adb sideload One_1.29.401.13_deodexed.zip
EDIT:
ADB Sideload does not work until you are in recovery, and select and run adb sideload within recovery.
Also, if you get device not recognized...run:
adb kill-server
adb start-server
then try adb sideload again...
i have clockworkmod recovery v6.0.3.1
I booted into recovery then selected install zip from sideload. but its not working as it suppose to. Am i doing something wrong?
varuun said:
i have clockworkmod recovery v6.0.3.1
I booted into recovery then selected install zip from sideload. but its not working as it suppose to. Am i doing something wrong?
Click to expand...
Click to collapse
"Fastboot erase cache"
when i checked log in to recovery its says that"failed to open adb driver control:no such file or directory"
and when i type adb devices it says
"
C:\fastboot>adb devices
List of devices attached
HT348W900356 host
"
Any clue?
I don't use CWM, so don't know anything about it. Try buying a USB-OTG cable, get a USB stick (USB flash drive) and put the ROM on the USB stick, connect USB stick to phone and mount USB-OTG in recovery. Flash from that. That's the only other thing I can think of.
Sent from my HTC One using Tapatalk 2
varuun said:
when i checked log in to recovery its says that"failed to open adb driver control:no such file or directory"
and when i type adb devices it says
"
C:\fastboot>adb devices
List of devices attached
HT348W900356 host
"
Any clue?
Click to expand...
Click to collapse
Do you have HTC Sync Manager installed? Do you have all the HTC Drivers?

[Q] Semi-bricked hdx

So...some mistake in update-script with setperm on stock slot and now I have a device:
- device is turning on
- clean, pure unregistered stock firmware
- adb work (pull/push)
- adb shell/install doesn't work (bin/sh not found)
- adb backup/restore doesn't work
- i have no safestrap (its missing after unsuccessful flashing)
- com.amazon.dcp.apk renamed, so future ota doesnt help
- wifi bluetooth doesn't work (no mac-address)
- I can copy files to/from sdcard
- i have su and daemonsu in /xbin (maybe....)
Any method to install apk ? Something like "file:///sdcard.1apk" like other android device, or maybe through silk debugging I could make same html-code to access sdcard? or fastboot flashing something to restore to stock. If I could install safestrap or es file explorer its would be great...
Thanks. Sorry my English.
./adb install mypackage.apk
on linux or
adb install mypackage.apk
on windows
dieter_m said:
./adb install mypackage.apk
on linux or
adb install mypackage.apk
on windows
Click to expand...
Click to collapse
As a note and just to clear it up a little, should someone find this while researching. When i was looking for this command and found the answer elsewhere, it wasn't quite clear on where the APK was taken from. It's from the system you issue the command from, not the device where you want the APK to be installed.
So for example. If you have the APK on your harddrive (D:\) in windows, you would issue this command in the command line:
adb install D:\APK_to_be_installed.apk
Adb install doesn't work, I already write this.

Bypass secure USB debugging prompt on phone with broken screen

Hello everyone,
I have a Samsung Galaxy S II (I9100) with Cyanogenmod 11 (Snapshot M12) installed. Recently I dropped my phone and the screen was completely shattered. The display does not work, neither does the touch. However, the phone works fine as I can turn it on and connect it via USB to my computer and access the data on my internal memory. Although USB debugging is enabled on my phone, I am unable to do anything because the computer isn't authorised i.e. I cannot press "OK" on the authentication prompt that I would have otherwise normally seen on the screen (screenshot attached). Is there any way to bypass this prompt or a workaround for it? I basically need to get a Nandroid backup of my phone and then factory reset it.
P.S.: I tried to access my phone via a program called "Android Control" but apparently it is practically useless without the debugging privileges.
Thanks.
Solved!
This guide assumes that USB debugging was enabled on your device before you broke it. You can enable USB debugging via recovery using:
Code:
adb shell
echo "persist.service.adb.enable=1" >>/system/build.prop
echo "persist.service.debuggable=1" >>/system/build.prop
echo "persist.sys.usb.config=mass_storage,adb" >>/system/build.prop"
reboot
After digging through various threads I finally managed to bypass the secure USB prompt on my Galaxy SII with a shattered screen.
For this method to work you need another device running Android 4.4.2 or above with USB debugging enabled and the same computer authorised from that device i.e. connect that device to your computer and press "OK" on the authorisation prompt that appears on screen for secure USB debugging. Let us call this device the "authorised device".
"adb_keys" is the file we need from the authorised device which is located in /data/misc/adb/
Normally you must be rooted to take the adb_keys file from the device using "Root explorer" or "ES File Explorer" but I will assume that the authorised device is unrooted. You don't need to root it. However, if your authorised device is rooted then simply copy the adb_keys file on your computer and jump directly to Step 5.
Steps:
Connect the authorised device to your computer using USB (debugging enabled) and open a command prompt with administrator privileges.
To get the "adb_keys" file, use this command:
adb pull /data/misc/adb/adb_keys <destination path>/adb_keys
For example:
adb pull /data/misc/adb/adb_keys c:/adb_keys
The above command will save the adb_keys file to the root of your C: drive. You can change the destination folder to your liking. Now the job of the authorised device is done. You can disconnect it and disable USB debugging.
Once you get a copy of adb_keys, reboot the phone with the broken screen into recovery.
Now connect the broken phone to the computer using USB.
We need to copy the adb_keys file to the broken device. Use the command below:
adb push <file location> /data/misc/adb
For example:
adb push c:/adb_keys /data/misc/adb
After the file is copied, reboot your device using "adb reboot" and voila! You can now use adb shell.
Special thanks to torankusu for this post which helped me compile this guide.
Check out this thread by k.janku1 if you want to have full control over your device even with a broken screen (requires Java Runtime Environment and Visual C++ redistributable). This tool lets you use your device through your Windows PC even if your touchscreen doesn't work or you can't see anything.
P.S.: My broken device was a Samsung Galaxy SII running Cyanogenmod 11 (M12) and my authorised device was an unrooted Moto G running stock ROM.
Thanks man.
I'm (noob) trying to follow the guide which exactly fits my situation.
Status : Broken SGS7 screen with USB debugging enabled but cannot accept the computer
SGS4 backup phone where i extracted the adb_key
both are not rooted and running stock OS
Unfortunately i get stuck between step 6/7... When i reboot to recovery mode the windows does not recognize neither of the phones when conneted to USB. Therefore i cannot run the ADB command and copy the key on my broken phone (SGS7).
i can choose the "aply update From ADB" and then the computer recognizes the phone and i can find it in ADB devices "sideload" but here i cannot use the command "adb push....."
Ii've tried updating drivers googled alot, but without luck...
what am i missing?
input very appreciated
I too am a noob who was trying to follow this guide, which also exactly fit my situation. My status was a broken Sony Xperia screen with USB debugging enabled, but I was unable to click on the "accept" button whenever I hooked my phone up to my PC. I extracted a working adb_key from my new Asus ZooXS phone; neither phone is rooted, and both are running stock Android OS.
Unfortunately, I got stuck right between Steps 7 & 8; Windows did not allow me to use the ADB Push command to copy the key onto my broken Sony Xperia. I could Pull the key from my Asus using ADB just fine, but not the other way around.
I did eventually find an alternative solution: I used an OTG device & hooked up a mouse to my Sony Xperia so that I could get past the broken screen issues & navigate to Settings > Bluetooth. I then borrowed a Bluetooth Mouse & "discovered" it with my broken Sony Xperia. I could then unplug the OTG device & re-connect my phone to my PC via USB, & then click on the screen using the Bluetooth Mouse to "accept" my computer as always being authorized to perform USB debugging. Afterwards, I was able to use Helium backup to pull off most of my important data from my phone.
Hope this helps others who are running into the same problem....
i don't get it - authorizing adb via adb
The steps maq_ posted helped me rescue my data from my broken OP3. Combined with the information from here: https://stackoverflow.com/questions...b-rsa-key-with-broken-touch-screen-on-android which indicates the files between the computer (running adb) and the key file you copy to /data/misc/adb should "match" with each other. Indeed, you might need to have been bootloader unlocked (with a custom recovery) to use adb push to copy the adb_keys file to your broken phone. For me, since my broken phone was rooted I used a terminal emulator with the 'su' command (after successfully getting the file onto my broken phone) to copy the file over to /data/misc/adb.
Some tips that might help newbs before following maq_'s steps: First, re-install another copy of adb (remember the path you installed to on your PC). Second, erase contents of c:\Users\$name\.android\ (which contains existing keys generated by adb). Third, run adb kill-server to make sure other instances of adb don't confuse things.
maq_ said:
This guide assumes that USB debugging was enabled on your device before you broke it. You can enable USB debugging via recovery using:
After digging through various threads I finally managed to bypass the secure USB prompt on my Galaxy SII with a shattered screen.
For this method to work you need another device running Android 4.4.2 or above with USB debugging enabled and the same computer authorised from that device i.e. connect that device to your computer and press "OK" on the authorisation prompt that appears on screen for secure USB debugging. Let us call this device the "authorised device".
"adb_keys" is the file we need from the authorised device which is located in /data/misc/adb/
Normally you must be rooted to take the adb_keys file from the device using "Root explorer" or "ES File Explorer" but I will assume that the authorised device is unrooted. You don't need to root it. However, if your authorised device is rooted then simply copy the adb_keys file on your computer and jump directly to Step 5.
Steps:
Connect the authorised device to your computer using USB (debugging enabled) and open a command prompt with administrator privileges.
To get the "adb_keys" file, use this command:
adb pull /data/misc/adb/adb_keys <destination path>/adb_keys
For example:
adb pull /data/misc/adb/adb_keys c:/adb_keys
The above command will save the adb_keys file to the root of your C: drive. You can change the destination folder to your liking. Now the job of the authorised device is done. You can disconnect it and disable USB debugging.
Once you get a copy of adb_keys, reboot the phone with the broken screen into recovery.
Now connect the broken phone to the computer using USB.
We need to copy the adb_keys file to the broken device. Use the command below:
adb push <file location> /data/misc/adb
For example:
adb push c:/adb_keys /data/misc/adb
After the file is copied, reboot your device using "adb reboot" and voila! You can now use adb shell.
Special thanks to torankusu for this post which helped me compile this guide.
Check out this thread by k.janku1 if you want to have full control over your device even with a broken screen (requires Java Runtime Environment and Visual C++ redistributable). This tool lets you use your device through your Windows PC even if your touchscreen doesn't work or you can't see anything.
P.S.: My broken device was a Samsung Galaxy SII running Cyanogenmod 11 (M12) and my authorised device was an unrooted Moto G running stock ROM.
Click to expand...
Click to collapse
Thanks for clarifying TWRP and UNLOCKED bootloader is required.
TWRP is not available for some devices. Luckily i found a ported recovery.img for my broken tablet. Unfortunately adb shows device as offline in TWRP, adb does not work in recovery.
I finally managed installing adbkey.pub via script. does not work on dm-verity, KNOX enabled or locked devices!
1. install ODIN (Samsung) or SPFLASH tool (MTK)
2. get the firmware for your device (fw.updato.com)
3. unpack system.img
4. add your own shell script (backdoor) to /system/etc/init.d, /system/etc/install-recovery.sh or whatever
5. repack your custom system.img
6. flash system.img
7. copy RSA Key to /sdcard via MTP
My (backdoor) shell script was a watchdog looking for another shell script on /sdcard. The second shell script was copying adbkey.pub from /sdcard to /data partition. This worked without root because init scripts run with root permissions on boot.
With this method i was able to backup userdata from my broken tablet via adb. TWRP has adb backup option too, in case touch screen is broken.
I will explain in detail on request.
edit: for experts only: instead of flashing whole system.img, you can do slight modification using Tarek Galal inception Utility via ODIN, for example "Place your adb keys, configure USB debugging"
edit2: most recent version of that backdoor script can be found here
https://forum.xda-developers.com/showthread.php?t=4111923
my touch is broken and i cant select usb authorization as ok... device is not rooted...
device name is sony z3...
i have another device with 4.4 and with that device i made a backup of drm keys... now what should i do?
sorry if english is bad... helpwill be really appriciated....
hello, i have te same problem with my huawei p smart. does this work for huawei to?
no, but you can connect OTG keyboard and unlock screen. that should unlock MTP you can at least transfer pictures. even Monitor via MHL/HDMI is possible for some devices
https://dtmedia.tech/list-of-mhl-compatible-phones
speedin said:
I'm (noob) trying to follow the guide which exactly fits my situation.
Status : Broken SGS7 screen with USB debugging enabled but cannot accept the computer
SGS4 backup phone where i extracted the adb_key
both are not rooted and running stock OS
Unfortunately i get stuck between step 6/7... When i reboot to recovery mode the windows does not recognize neither of the phones when conneted to USB. Therefore i cannot run the ADB command and copy the key on my broken phone (SGS7).
i can choose the "aply update From ADB" and then the computer recognizes the phone and i can find it in ADB devices "sideload" but here i cannot use the command "adb push....."
Ii've tried updating drivers googled alot, but without luck...
what am i missing?
input very appreciated
Click to expand...
Click to collapse
Hi
I have the same connection impact when I use adb command too. Is there any solution for this situation?
Thank you.
aIecxs said:
Thanks for clarifying TWRP and UNLOCKED bootloader is required.
TWRP is not available for some devices. Luckily i found a ported recovery.img for my broken tablet. Unfortunately adb shows device as offline in TWRP, adb does not work in recovery.
I finally managed installing adbkey.pub via script. does not work on dm-verity, KNOX enabled or locked devices!
1. install ODIN (Samsung) or SPFLASH tool (MTK)
2. get the firmware for your device (fw.updato.com)
3. unpack system.img
4. add your own shell script (backdoor) to /system/etc/init.d, /system/etc/install-recovery.sh or whatever
5. repack your custom system.img
6. flash system.img
7. copy RSA Key to /sdcard via MTP
My (backdoor) shell script was a watchdog looking for another shell script on /sdcard. The second shell script was copying adbkey.pub from /sdcard to /data partition. This worked without root because init scripts run with root permissions on boot.
With this method i was able to backup userdata from my broken tablet via adb. TWRP has adb backup option too, in case touch screen is broken.
I will explain in detail on request.
edit: for experts only: instead of flashing whole system.img, you can do slight modification using Tarek Galal inception Utility via ODIN, for example "Place your adb keys, configure USB debugging"
Click to expand...
Click to collapse
ThanK You Senior for posting the solution.
Can you please help me in this.
I am using mediatek device
Didn't find /system/etc/init.d
Didn't find /system/etc/install-recovery.sh
But found "" install-recovery.sh "" inside /system/bin folder
Now do i have to only paste the your given rsa_copy.sh scrip in this file?
and paste the pub_keys from authorize device to /sdcard/
That method will most likely fail because dm-verity deny booting if any modifications detected. You can however patch boot.img with Magisk (to disable dm-verity). What android version/mediatek device you have?
Yes you can replace install-recovery.sh or add line
Code:
/system/bin/sh /path/to/rsa_copy
/system/bin/sh /path/to/99userinit_daemon
But I do not recommend this method any longer, modifications in /system should be avoided. Instead you could simply disable RSA authorization and enable usb-debugging in default.prop
https://forum.xda-developers.com/showthread.php?t=1867446
I recommend AIK it is capable of re-signing AVBv1-signed boot.img
I have android 7
mt6753
init.d is n't here
placing code inside install-recovery.sh didn't work because it runs with root privileges
now i am trying to cp /system/adbkey.pub /data/misc/adb/adb_keys
and tring to modify boot.img
aIecxs said:
That method will most likely fail because dm-verity deny booting if any modifications detected. You can however patch boot.img with Magisk (to disable dm-verity). What android version/mediatek device you have?
Yes you can replace install-recovery.sh or add line
Code:
/system/bin/sh /path/to/rsa_copy
/system/bin/sh /path/to/99userinit_daemon
But I do not recommend this method any longer, modifications in /system should be avoided. Instead you could simply disable RSA authorization and enable usb-debugging in default.prop
https://forum.xda-developers.com/showthread.php?t=1867446
I recommend AIK it is capable of re-signing AVBv1-signed boot.img
Click to expand...
Click to collapse
Senior Help. (I am extra noob)
I also noticed data folder inside boot.img can I directly put " adb" folder here?
no. data directory is just mount point. no longer required to place adb_keys, just edit default.prop with Notepad++
aIecxs said:
no. data directory is just mount point. no longer required to place adb_keys, just edit default.prop with Notepad++
Click to expand...
Click to collapse
I attempted this trick with working phone's boot.img (working img) but even after repacking boot.img without edits phone stuck/hangs on boot (without animation)
Recommend me a good tool for unpacking and repacking boot.img with guide.
(I already tried with android kitchen on Linux (This one's boot.img make phone report after boot animation) and unpack/repack Tool on windows ( http://www.mediafire.com/file/nvo2popw26k4mit/IMG_Extractor_2.0.rar/file) and this one's boot.img doesn't boot phone to boot animation and hangs on initial logo)
I tried this on other working phone
@osm0sis may have a look into boot.img can you upload please?
aIecxs said:
no. data directory is just mount point. no longer required to place adb_keys, just edit default.prop with Notepad++
Click to expand...
Click to collapse
I attempted this trick with working phone's boot.img (working img) but even after repacking boot.img without edits phone stuck/hangs on boot (without animation)
Recommend me a good tool for unpacking and repacking boot.img with guide.
(I already tried with android kitchen on Linux (This one's boot.img make phone report after boot animation) and unpack/repack Tool on windows ( http://www.mediafire.com/file/nvo2popw26k4mit/IMG_Extractor_2.0.rar/file) and this one's boot.img doesn't boot phone to boot animation and hangs on initial logo)
aIecxs said:
@osm0sis may have a look into boot.img can you upload please?
Click to expand...
Click to collapse
Yes please,
LT700 is for testing purpose workig phone.
Both phones are almost from the same manufacturer (Note: but different models) Even unmodified repacked file does make phone boot success.
Uploading both stock and magisk patched working images of both phone

ADB on bricked devices

Hello
My tablet is soft bricked so i want to apply update from ADB but it keep saying "E: Failed to open driver control. Permission denied"
My tablet is: Lenovo TB-X605F
I tried everything to repair this tablet but nothing work
Please help me
XX_MRBEAN_XX said:
Hello
My tablet is soft bricked so i want to apply update from ADB but it keep saying "E: Failed to open driver control. Permission denied"
My tablet is: Lenovo TB-X605F
I tried everything to repair this tablet but nothing work
Please help me
Click to expand...
Click to collapse
Do you have a custom recovery installed to sideload a stock/custom ROM flash able zip? You won't be able to use stock recovery for flashing. Usually ADB isn't accessable unless set in the default.prop file
@XX_MRBEAN_XX
What ADB subcommand returns that error?
Typically "Permission Denied" is returned when a subcommand gets invoked that only works on a R/W-mounted device or requires ROOT.
jwoegerbauer said:
@XX_MRBEAN_XX
What ADB subcommand returns that error?
Typically "Permission Denied" is returned when a subcommand gets invoked that only works on a R/W-mounted device or requires ROOT.
Click to expand...
Click to collapse
In recovery menu, i select "apply update from ADB"
Beforce i connect my tablet to my pc it's say "E: failed to open driver control. Permission denied" Stopping adb
And my tablet is not recognized in adv devices
XX_MRBEAN_XX said:
In recovery menu, i select "apply update from ADB"
Beforce i connect my tablet to my pc it's say "E: failed to open driver control. Permission denied" Stopping adb
And my tablet is not recognized in adv devices
Click to expand...
Click to collapse
That's NOT an ADB subcommand, but an option offered by your tablet's Recovery Menu.
Take note that ADB consists of three components
A client, which runs on your desktop computer
A server, which runs as a background process on your desktop machine. It manages communication between the client and the daemon running on the Android-powered device
A daemon, which runs as a background process on the Android device. FYI: That automatically gets started when device boots up if enabled in Android's system settings - keyword: system file named build.prop, there settings ro.secure=0 & ro.debuggable=1.
My advice: Download from Lenovo's website the USB-driver that matches your tablet and install it: never use any other USB-driver !
jwoegerbauer said:
That's NOT an ADB subcommand, but an option offered by your tablet's Recovery Menu.
Take note that ADB consists of three components
A client, which runs on your desktop computer
A server, which runs as a background process on your desktop machine. It manages communication between the client and the daemon running on the Android-powered device
A daemon, which runs as a background process on the Android device. FYI: That automatically gets started when device boots up if enabled in Android's system settings - keyword: system file named build.prop, there settings ro.secure=0 & ro.debuggable=1.
My advice: Download from Lenovo's website the USB-driver that matches your tablet and install it: never use any other USB-driver !
Click to expand...
Click to collapse
Okay i'll try that !
By the way, my tablet can have a microSD , can i put a zip in the microSD and flash it ? ??
XX_MRBEAN_XX said:
Okay i'll try that !
By the way, my tablet can have a microSD , can i put a zip in the microSD and flash it ? ??
Click to expand...
Click to collapse
Yes, but stock recovery may fail unless it accepts test-key signed zips. If not then you'll need a custom recovery that allows to do so or to disable a signature check
That or if your bootloader is unlocked you can modify the recovery file to replace /res/keys with a test-key one and use stock recovery to flash test-signed files
XX_MRBEAN_XX said:
By the way, my tablet can have a microSD , can i put a zip in the microSD and flash it ? ??
Click to expand...
Click to collapse
Using ADB sideload, you can easily sideload any signed and/or unsigned ROM and any signed and/or unsigned MOD zip files: no need for any external SD-card. IMHO that's the most convenient method.
Code:
adb devices
adb sideload <PATH-TO-ZIP-FILE>

Categories

Resources