Disable system packages [ADB - Android 13] - General Questions and Answers

Hi...
I made the very bad mistake of updating my Oppo Reno 6 5G to ColorOS 13...
There is no possibility to downgrade and moreover some packages can no longer be uninstalled or disabled via ADB.
For example, if I wanted to uninstall/disable com.oplus.ota to avoid further updates, the ADB commands that worked until yesterday would no longer work...
Es:
shell pm uninstall --user 0 com.oplus.ota
Failure [DELETE_FAILED_INTERNAL_ERROR]
shell pm disable-user --user 0 com.oplus.ota
Package com.oplus.ota new state: default
shell pm disable com.oplus.ota
[Error]:failed to disable com.oplus.ota
Anyone has a solution? Thanks....

Is the mentioned file listed as package?
Code:
adb devices
adb shell "pm list packages -s"
If not then you can't use pm cmd to operate on this file.

jwoegerbauer said:
Is the mentioned file listed as package?
Code:
adb devices
adb shell "pm list packages -s"
If not then you can't use pm cmd to operate on this file.
Click to expand...
Click to collapse
Yes the package is in the list! However both the disable and the uninstall give the error...

If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"

jwoegerbauer said:
If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"
Click to expand...
Click to collapse
Thank you for the info... My phone is not routed unfortunately...
I want to downgrade it but i can't... :-(

jwoegerbauer said:
If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"
Click to expand...
Click to collapse
hallo, i've been using this method from a2.3 to a11 to uninstall system apps, but this method is not useable with a11 in a TWRP shell, so i'm curious, are these steps still works correctly in a13? in a system shell or TWRP shell?

The code excerpt printed above is meant to be run via ADB as
Code:
adb shell 'su -c "mount -o rw,remount -t auto /system"'

Related

ADB prompt question

I'm having some trouble with the mount command. More specifically when trying to mount the system without going into shell. It worked fine on 2.1, but on 2.2 I get an error. The command I'm typing is:
./adb shell mount -t rfs -o remount,rw /dev/block/stl9 /system
The error I get is:
mount: Operation not permitted
However, when I go into shell su, and just type the mount command, it works fine. I need to get the mount command to work outside of shell for a bash script that I am writing. If I enter shell in the script, the script does not finish executing, and I cannot enter commands into the adb shell prompt. Any idea?
I have a Samsung Fascinate running EB01 and the phone has been rooted. I'm also doing this on a mac.
Thanks.
Braydon525 said:
I'm having some trouble with the mount command. More specifically when trying to mount the system without going into shell. It worked fine on 2.1, but on 2.2 I get an error. The command I'm typing is:
./adb shell mount -t rfs -o remount,rw /dev/block/stl9 /system
The error I get is:
mount: Operation not permitted
However, when I go into shell su, and just type the mount command, it works fine. I need to get the mount command to work outside of shell for a bash script that I am writing. If I enter shell in the script, the script does not finish executing, and I cannot enter commands into the adb shell prompt. Any idea?
I have a Samsung Fascinate running EB01 and the phone has been rooted. I'm also doing this on a mac.
Thanks.
Click to expand...
Click to collapse
Hi, what does the following output?
adb shell id
Also, what about just
adb remount
- jc
JimmyChingala said:
Hi, what does the following output?
adb shell id
Also, what about just
adb remount
- jc
Click to expand...
Click to collapse
Tried both remount and shell remount..
$ ./adb shell id
uid=0(root) gid=2000(shell) groups=1007(log)
$ ./adb remount
remount failed: No such file or directory
$ ./adb shell remount
remount: not found

[Q] Write, Execute Permissions

I have been googling far too long for an explanation of how to change the Read, Write, Execute options on individual system and data apps, when I remembed how fast someone usually answers my n00b questions here. It is not even clear to me what the differences are between the Write and Execute options. Can someone give me a link to a tutorial regarding this?
I did read the suggested threads, not helpful, and one I didn't understand about remounting the "entire /system partion to read-write".
thanks. d
To be more specific, I want to change the permission on certain system apps so I can uninstall them.
If your phone is rooted then you need a file manager that will remount the system partition as RW ( read write). Or you can use adb with your first command being adb remount.
Sent from my HTC Vision using XDA App
As ESKIMOn00b started to explain, the process of removing apps from the /system partition isn't a matter of individual file or folder permissions. Android secures the /system partition by preventing it from being written to under normal circumstances. If you have rooted your device then you have the ability to become the root user and run most if not all commands.
ADB provides a nice convenience command, 'adb remount', that will allow you to modify the /system partition. This command will only work if you have root user privileges but will unlock all of the apps for you to remove. Be careful though, you shouldn't just delete APK's directly out of /system/app as the package manager in Android might not keep up with your deletions. The best way to go about it (after remounting /system read/write) is to use the 'pm uninstall' command:
# pm uninstall com.myapp
To figure out the package names you can use 'pm list packages' and it will dump a huge list of all installed apps on the device. You'll need to hunt through and find the right ones. Most developers use obvious naming schemes such as Amazon's MP3 Store: com.amazon.mp3.
Hope this helps!
-ObsidianX
I have root and some recent experience w/the AndroidSDK. Using the SDK on my SonyEricsson phone:
c:\Users\dSpr> cd c:\AndroidSDK\tools
c:\AndroidSDK\tools>dir
{list}
c:\AndroidSDK\tools>adb devices
{0123456789ABCDEF device}
c:\AndroidSDK\tools>adb ls /system/app
{list}
c:\AndroidSDK\tools>adb shell
$ pm list packages
{list}
Note the shell command produces a $ instead of a #, but it still gives me a list.
But w/the $ and the command adb remount this:
$adb remount
adb remount
adb: permission denied.
If: tools>adb remount
This: remount failed; Operation not permitted
Same operation w/my QT7 and tools>adb shell produces a #. In fact, I don't even have to I don't have to use the adb remount command on my first uninstall, just
#rm /system/app/{app}.apk
#pm uninstall {package name}
I don't recall that I used the remount command between uninstalls-don't think I did or I would have noted it because I was keeping careful track of what I was doing. I can't test it because I have no apps on that device to uninstall.
Get the same result when using the terminal with the su command on the phone itself.
This is why I thought I had to change the Read/Write permissions.
What are you telling me that's not getting thru.
Thank you both very much.
d
to remount your system, you can try this
Code:
adb shell
Code:
su
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
hesperides said:
to remount your system, you can try this
Code:
adb shell
Code:
su
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
Click to expand...
Click to collapse
Nope. adb shell results in a $. su results in a su w/out the $ and after some (close to a minute) hesitation: Permission denied $
Debugging is on, as is mock locations. I am also having the exact same problem with my new enTourage Pocket eDGe, but it isn't that bothersome because it doesn't have a lot of garbage like the cell phone.
d

[Completed] [Q] Batch file commands help

So I am trying to make a batch file that automatically flashes a custom bootanimation from my computer and I am having trouble with these commands.
adb wait-for-device shell "su -c 'ls /system/media'"
adb wait-for-device shell "su -c 'mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system'"
adb wait-for-device shell "su -c 'rm /data/media/bootanimation.zip1'"
Bascially I want to have the adb shell enter superuser mode, remount system in read write mode and delete the existing bootanimation.zip
Whenever I try and run this it says permission denied.
Please post your question in Android General so that the right experts may be of help.
Thread Closed. Thank you.

Cloning Pre-configured Android 8.1 Device / ROM

Hey guys,
Not sure if this is the correct place to post, but I am at my wits end and think I need a bit of help. I have been cloning devices on Android 7.1 without too much trouble, but something has changed in Android 8.1 which breaks things. Here is my setup:
Device: Xiaomi Redmi Note 4X 16GB, unlocked bootloader
OS: LineageOS 15.1 (Android 8.1)
My setup process is as follows:
Let stock ROM update (for latest firmware), unlock BL, flash TWRP, clean wipe, flash LineageOS + Gapps + Magisk
Skip through setup wizard, apply customisations (apps via APKs, launcher, settings, etc)
Clear Data for following:
com.google.android.gms.setup
Google App
Google Account Manager
Google Backup Transport
Google One Time Init
Google Partner Setup
Google Play Services
Google Play Services for Instant Apps
Google Play Store
Google Services framework
Reboot to TWRP
Connect to PC, run following ADB command: adb pull /data/system/users/0/settings_secure.xml
Open settings_secure.xml and delete "android_id" line
Push settings_secure.xml back to device: adb push settings_secure.xml /data/system/users/0/
Capture system image, flash onto other devices (either via TWRP backup or pushing system images via ADB)
Boot device, log into client Google account, done
Now this process used to work great on LineageOS 14.1 (Android 7.1), but now I get the following issues:
When adding a Google Account, it does not appear in Android device manager, but it appears in the list of devices in the Google Play Store? If I remove the account and then add it again it appears, but the issues below still occur.
Google's messaging / push system is broken. If I send a Hangouts message to my Google account, it won't appear until I open the app.
Any pre-installed apps won't appear in the "installed" list of apps in the play store, and therefore not update automatically until the user manually searches for the app in the Play Store and hits "update" (ugh).
I need to be deploying around 100 units over the next couple of months or so I need something that is scalable. I might be going around this the wrong way completely. I am not a ROM developer or programmer, just found something that has worked well in the past, so if I need to develop a ROM from scratch based on LineageOS I'll probably need to hire someone to do this for me as this is a bit beyond my current capabilities and time constraints. Let me know your thoughts! Thanks.
Android ID is same for many devices if you clone. That is really bad and can cause issues.
Rayman96 said:
Android ID is same for many devices if you clone. That is really bad and can cause issues.
Click to expand...
Click to collapse
I am deleting the Android ID from settings_secure.xml though. Unless it is somewhere else as well?
I'm still struggling with this problem. Is there anything else I can try? I googled this problem and the first result is this thread :/
stephendt0 said:
I'm still struggling with this problem. Is there anything else I can try? I googled this problem and the first result is this thread :/
Click to expand...
Click to collapse
Code:
adb shell settings delete secure android_id
adb shell settings delete secure advertising_id
adb shell settings delete secure bluetooth_address
adb shell settings put secure bluetooth_name 'YOURNAME'
adb shell settings put global device_name 'YOURNAME'
adb shell settings put global wifi_p2p_device_name 'YOURNAME'
The two IDs are then randomly regenerated. YOURNAME is any name of your choice.
rainman74 said:
Code:
adb shell settings delete secure android_id
adb shell settings delete secure advertising_id
adb shell settings delete secure bluetooth_address
adb shell settings put secure bluetooth_name 'YOURNAME'
adb shell settings put global device_name 'YOURNAME'
adb shell settings put global wifi_p2p_device_name 'YOURNAME'
The two IDs are then randomly regenerated. YOURNAME is any name of your choice.
Click to expand...
Click to collapse
Thanks for that. I believe I actually found their respective strings in settings_secure.xml:
<setting id="59" name="config_update_certificate"
<setting id="43" name="bluetooth_address"
And of course the Android ID. Once I deleted these, they auto-generated on the next boot, so I do this using ADB in TWRP.
I tried this and so far I'm not having any problems! Will report back if I experience any issues.
Another update - turn out that this is NOT enough. You will also want to clear data for the following apps (ideally just before shutting down the system and clearing android, bluetooth and config_update_certificate) to ensure that push notifications continue to work:
Com.google.android.gms.setup
Google App (not 100% sure if this is required, but I do it anyway)
Google Play Services
Google Play Store
Google Services framework
Reboot, clear your IDs, and then take your image. It should be OK after that, I think. I generally like to setup Hangouts on the device and then reboot, and let it sit for 5 minutes so its fully dozed before I send a test message.
Edit: STILL not working even after all this. Anyone else able to offer an explanation as to why push notifications is such an issue? This is becoming really difficult
stephendt0 said:
Another update - turn out that this is NOT enough. You will also want to clear data for the following apps (ideally just before shutting down the system and clearing android, bluetooth and config_update_certificate) to ensure that push notifications continue to work:
Com.google.android.gms.setup
Google App (not 100% sure if this is required, but I do it anyway)
Google Play Services
Google Play Store
Google Services framework
Reboot, clear your IDs, and then take your image. It should be OK after that, I think. I generally like to setup Hangouts on the device and then reboot, and let it sit for 5 minutes so its fully dozed before I send a test message.
Edit: STILL not working even after all this. Anyone else able to offer an explanation as to why push notifications is such an issue? This is becoming really difficult
Click to expand...
Click to collapse
ok, if you want to reset everything in a clone, proceed as follows:
Code:
adb shell su -c mount -o remount,rw /system
adb shell su -c rm /data/system/users/0/accounts.db
adb shell su -c rm /data/system/users/0/accounts.db-journal
adb shell su -c rm /data/system/users/0/photo.png
adb shell su -c rm /data/system/sync/accounts.xml
adb shell su -c rm /data/system/sync/pending.xml
adb shell su -c rm /data/system/sync/stats.bin
adb shell su -c rm /data/system/sync/status.bin
adb shell su -c pm clear com.android.packageinstaller
adb shell su -c pm clear com.android.providers.downloads
adb shell su -c pm clear com.android.vending
adb shell su -c pm clear com.google.android.backuptransport
adb shell su -c pm clear com.google.android.gms
adb shell su -c pm clear com.google.android.gsf
adb shell su -c mount -o remount,ro /system
Please also follow my instructions above for resetting the IDs before rebooting.
Google then recognizes a new device! Have fun :fingers-crossed:
rainman74 said:
ok, if you want to reset everything in a clone, proceed as follows:
Code:
adb shell su -c mount -o remount,rw /system
adb shell su -c rm /data/system/users/0/accounts.db
adb shell su -c rm /data/system/users/0/accounts.db-journal
adb shell su -c rm /data/system/users/0/photo.png
adb shell su -c rm /data/system/sync/accounts.xml
adb shell su -c rm /data/system/sync/pending.xml
adb shell su -c rm /data/system/sync/stats.bin
adb shell su -c rm /data/system/sync/status.bin
adb shell su -c pm clear com.android.packageinstaller
adb shell su -c pm clear com.android.providers.downloads
adb shell su -c pm clear com.android.vending
adb shell su -c pm clear com.google.android.backuptransport
adb shell su -c pm clear com.google.android.gms
adb shell su -c pm clear com.google.android.gsf
adb shell su -c mount -o remount,ro /system
Please also follow my instructions above for resetting the IDs before rebooting.
Google then recognizes a new device! Have fun :fingers-crossed:
Click to expand...
Click to collapse
OMG, I think that worked, thank you! I spent 5 hrs and stayed up to 3am trying to work this out with no luck, and this did the trick. To make things easier however, I morphed these commands into a dirty "one-liner" that saves entering each command.
Code:
adb shell settings delete secure android_id && adb shell settings delete secure advertising_id && adb shell settings delete secure bluetooth_address && adb shell settings put secure bluetooth_name 'Redmi Note 4' && adb shell settings put global device_name 'Redmi Note 4' && adb shell settings put global wifi_p2p_device_name 'Redmi Note 4' && adb shell su -c mount -o remount,rw /system && adb shell su -c rm /data/system/users/0/accounts.db && adb shell su -c rm /data/system/users/0/accounts.db-journal && adb shell su -c rm /data/system/users/0/photo.png && adb shell su -c rm /data/system/sync/accounts.xml && adb shell su -c rm /data/system/sync/pending.xml && adb shell su -c rm /data/system/sync/stats.bin && adb shell su -c rm /data/system/sync/status.bin && adb shell su -c pm clear com.android.packageinstaller && adb shell su -c pm clear com.android.providers.downloads && adb shell su -c pm clear com.android.vending && adb shell su -c pm clear com.google.android.backuptransport && adb shell su -c pm clear com.google.android.gms && adb shell su -c pm clear com.google.android.gsf && adb shell su -c mount -o remount,ro /system
I'm sure there is a more efficient way of stacking commands, but this worked. Replace "Redmi Note 4" with your actual device and reboot. I cleared data for any messaging apps and removed my Google account before I began, however.
stephendt0 said:
OMG, I think that worked, thank you! I spent 5 hrs and stayed up to 3am trying to work this out with no luck, and this did the trick. To make things easier however, I morphed these commands into a dirty "one-liner" that saves entering each command.
I'm sure there is a more efficient way of stacking commands, but this worked. Replace "Redmi Note 4" with your actual device and reboot. I cleared data for any messaging apps and removed my Google account before I began, however.
Click to expand...
Click to collapse
Perfect! You don't need to remove your Google account as the commands do this anyway
rainman74 said:
Perfect! You don't need to remove your Google account as the commands do this anyway
Click to expand...
Click to collapse
Quick update.
After a bit more testing, turns out that there were still a few things that needed clearing, particularly on different versions of Android (7.1). Also, I've noticed that a GSF ID can be generated before you get a chance to capture an image if you leave Wi-Fi enabled, so I've included that in the script. I've ended up with a .BAT file with the following:
Code:
echo on
adb shell settings delete secure android_id
adb shell settings delete secure advertising_id
adb shell settings delete secure bluetooth_address
adb shell su -c mount -o remount,rw /system
adb shell su -c svc wifi disable
adb shell su -c rm /data/system/users/0/accounts.db
adb shell su -c rm /data/system/users/0/accounts.db-journal
adb shell su -c rm /data/system/users/0/photo.png
adb shell su -c rm /data/system/users/0/settings_ssaid.xml
adb shell su -c rm /data/system/sync/accounts.xml
adb shell su -c rm /data/system/sync/pending.xml
adb shell su -c rm /data/system/sync/stats.bin
adb shell su -c rm /data/system/sync/status.bin
adb shell su -c pm clear com.google.android.ext.services
adb shell su -c pm clear com.google.android.ext.shared
adb shell su -c pm clear com.google.android.gsf.login
adb shell su -c pm clear com.google.android.onetimeinitializer
adb shell su -c pm clear com.android.packageinstaller
adb shell su -c pm clear com.android.providers.downloads
adb shell su -c pm clear com.android.vending
adb shell su -c pm clear com.google.android.backuptransport
adb shell su -c pm clear com.google.android.gms
adb shell su -c pm clear com.google.android.instantapps.supervisor
adb shell su -c pm clear com.google.android.gsf
adb shell su -c mount -o remount,ro /system
I have found that this works consistently across both LineageOS 14.1 and LineageOS 15.1 devices.
stephendt0 said:
OMG, I think that worked, thank you! I spent 5 hrs and stayed up to 3am trying to work this out with no luck, and this did the trick. To make things easier however, I morphed these commands into a dirty "one-liner" that saves entering each command.
Code:
adb shell settings delete secure android_id && adb shell settings delete secure advertising_id && adb shell settings delete secure bluetooth_address && adb shell settings put secure bluetooth_name 'Redmi Note 4' && adb shell settings put global device_name 'Redmi Note 4' && adb shell settings put global wifi_p2p_device_name 'Redmi Note 4' && adb shell su -c mount -o remount,rw /system && adb shell su -c rm /data/system/users/0/accounts.db && adb shell su -c rm /data/system/users/0/accounts.db-journal && adb shell su -c rm /data/system/users/0/photo.png && adb shell su -c rm /data/system/sync/accounts.xml && adb shell su -c rm /data/system/sync/pending.xml && adb shell su -c rm /data/system/sync/stats.bin && adb shell su -c rm /data/system/sync/status.bin && adb shell su -c pm clear com.android.packageinstaller && adb shell su -c pm clear com.android.providers.downloads && adb shell su -c pm clear com.android.vending && adb shell su -c pm clear com.google.android.backuptransport && adb shell su -c pm clear com.google.android.gms && adb shell su -c pm clear com.google.android.gsf && adb shell su -c mount -o remount,ro /system
I'm sure there is a more efficient way of stacking commands, but this worked. Replace "Redmi Note 4" with your actual device and reboot. I cleared data for any messaging apps and removed my Google account before I began, however.
Click to expand...
Click to collapse
YES, this did it. I cloned a kindle fire hdx using TWRP backup&restore and had to perform the action mentioned above in order to use both devices independetly.
ATTENTION!
Remember to change the values listed in stephendt0's example that were not part of the original code from rainman74:
- device_name: Equals the device type. E.g. adb shell settings put global device_name 'KFHDX'
- bluetooth_name: Hostname of the device seen in bluetooth.
- wifi_p2p_device_name: Hostname used for a p2p wifi network aka "ad hoc network". Not supported on all devices.

Imposible to uninstall APPs with adb

I need help, I want to uninstall some applications from my phone with adb, but typing the command: ". \ Adb shell pm uninstall --user 0" app_to_remove ".
I get the error: "Failed to remove package from user owner's system."
I follow the commands correctly from beginning to end, but it does not allow me to uninstall applications, my phone is an "Alcatel 1 5033e
.
1. The command used is unusual. It should be adb uninstall <PKG-NAME>
2. Apps housed in /system partititon can only get uninstalled by ROOT user and if partition /system is mounted as RW ( means: Read / Wrire access )
jwoegerbauer said:
1. The command used is unusual. It should be adb uninstall <PKG-NAME>
2. Apps housed in /system partititon can only get uninstalled by ROOT user and if partition /system is mounted as RW ( means: Read / Wrire access )
Click to expand...
Click to collapse
how can you how can I get root access from adb?
Install a temporary ROOT.
Example
Code:
adb devices
adb push <LOCATION-OF-SU-BINARAY-ON-COMPUTER> /data/local/tmp/
adb shell "chmod +x /data/local/tmp/su"
adb shell "/data/local/tmp/su -c '<SHELL-COMMAND-TO-GET-RUN-HERE>'"

Categories

Resources