12

Have to mention this to avoid possible confusion, this question is not duplicate. This question is specific to using adb to uninstall a package. There are several similar questions but are all different from this one, as they're focused on removing an application by any means.

Please do not provide answers using "rm" command to delete the package files. Also, answers related to malformed package names, or trailing carriage returns. I think they're pretty much all covered in all the other questions.

I had pm uninstall functionality but after ROM upgrade. Some things won't uninstall anymore. For example the following two system apps (which I removed under previous ROM, significantly improving overall performance):
/system/priv-app/SecurityCenter/SecurityCenter.apk=com.miui.securitycenter
/system/app/Updater/Updater.apk=com.android.updater

Now I get an error trying to pm uninstall them: Failure [DELETE_FAILED_INTERNAL_ERROR]

But other system apps (which won't uninstall through regular android interface) do uninstall via pm uninstall command. Example:
/system/priv-app/Browser/Browser.apk=com.android.browser

So both are system apps, what could be the difference between them?

For reference, I upgraded from MIUI 8.1.6.0 to 8.5.3.0, and re-installed TWRP and SuperSU. This question is not specific to my ROM, as I see other people are in the same situation. But I seem to have an advantage being able to be able to uninstall some system apps. And am willing to contribute, to find a solution for everyone, to uninstall any app.

I tried: mount -o rw,remount /system
but that didn't solve it.

Please help out with any ideas along the way. Thanks!


Update 1 - Confirming steps to avoid intermittent issues
* Wiped all partitions in TWRP
* Installed Latest ROM (MIUI 8.5.3.0)
* Went back to TWRP, wiped only /Data
* Restored /Data from backed up version of the ROM that came with device (MIUI 8.1.6.0)
* Now after I boot into OS, ROM shows as latest (MIUI 8.5.3.0) in settings

Now I am able to pm uninstall every app I've tried. Even the most resilient: Google APP, Updater, Security.

This Frankenstein.. err I mean hybrid ROM works fine so far, and I've already removed many system packages, making the phone (Redmi 3S+) visibly faster. But I would still like to pinpoint what was causing this to make it into Generic Solution. So, if it ain't broke I'm willing break it, so next time it breaks we will know what's causing it and how to fix it.

Update 2 -
* Wiped all partitions and restored all partitions from Original ROM.
* Restored to factory settings (using TWRP)
* and after booting into ROM, went back to TWRP and made another backup
* Using same scenario as in Update 1 above, with only exception of using /Data from here. pm uninstall does not work.

Any thoughts on the differences between the two /Data partitions I should be focusing on?

  • 1
    AFAIK pm uninstall cannot be used with system apps. As it's not clear whether you really want to uninstall or simply to hide an app (you mentioned pm disable), could pm hide be what you're really after? – Izzy Jul 16 '17 at 23:24
  • @Izzy Yes it can. That's what I'm saying above, I just edited/made it a bit clearer. I want to pm uninstall but what I meant was, before upgrading, I could do both, uninstall and disable on System apps, even wrote nice scripts to take care of everything after upgrade. – Emil Jul 17 '17 at 5:34
  • I have never succeeded with pm uninstall on system apps. But I have a guess: Is your previous ROM an "engineering" build? I suppose it works with an eng build (aka dev build). – iBug Jul 17 '17 at 5:37
  • @iBug no, actually previous ROM was the one that this phone came with. The new ROM is also an official upgrade from manufacturer's site. – Emil Jul 17 '17 at 5:40
  • 1
    @Firelord My MIUI Optiomization setting was already off. device_owner.xml is absent. device_policies.xml just has these lines: <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <policies setup-complete="true"> <active-password -stuff here- /> </policies> – Emil Jul 19 '17 at 7:34
16

I succeded adding the -k and --user options to the pm command, e.g.:

pm uninstall -k --user 0 com.android.service

The command was issued as root, no need to remount /system as rw. Android on the phone is 6.0 and the package is a system app. Without the extra option I get the error:

Failure [DELETE_FAILED_INTERNAL_ERROR]
  • Thank you. For anyone else reading, some guides have a single dash in front of the user, which was causing the error for me. – TrojanName Aug 24 '18 at 21:08
1

Also works without -k (keep user settings) option:

pm uninstall --user 0 com.android.service

and without opening adb shell:

adb uninstall --user 0 com.android.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.