0x192 / universal-android-debloater

Cross-platform GUI written in Rust using ADB to debloat non-rooted android devices. Improve your privacy, the security and battery life of your device.
GNU General Public License v3.0
14.72k stars 798 forks source link

Bootloop in Xiaomi Mi6 after debloating #349

Open gmm96 opened 1 year ago

gmm96 commented 1 year ago

Your phone: Xiaomi Mi6

Describe the issue I uninstalled next apps, then smartphone got stuck in bootloader screen after reboot.

You have a solution? I have no solution. This is the reason why I openned this issue, to check if there is a way to reinstall these apps from fastboot or another mode so the problem will be solved.

UAD log I cannot find any log file relative to the universal android debloater. I will upload it if you tell me where I can find it. Edited: here it is. UAD_20220819.log

AnonymousWP commented 1 year ago

UAD log I cannot find any log file relative to the universal android debloater. I will upload it if you tell me where I can find it.

https://github.com/0x192/universal-android-debloater/wiki/FAQ#where-are-the-logfiles

gmm96 commented 1 year ago

UAD log I cannot find any log file relative to the universal android debloater. I will upload it if you tell me where I can find it.

https://github.com/0x192/universal-android-debloater/wiki/FAQ#where-are-the-logfiles

Sorry. Here you are. It seems there is nothing wrong on the log anyway.

UAD_20220819.log

I'm trying to reinstall the system apps without success.

TubbyCat commented 1 year ago

If you have no meaningful data on the device, factory reset from boot menu. If debugging this does not work through other means, this is your best bet. Google how to access boot menu as it varies by device. (https://www.google.com/search?q=xiaomi+mi6+factory+reset)

@ first glance perhaps com.xiaomi.joyose see: https://xiaomiui.net/what-is-the-joyose-app-on-xiaomi-phones-14625/ has something to do with it.

gmm96 commented 1 year ago

If you have no meaningful data on the device, factory reset from boot menu. If debugging this does not work through other means, this is your best bet. Google how to access boot menu as it varies by device. (https://www.google.com/search?q=xiaomi+mi6+factory+reset)

@ first glance perhaps com.xiaomi.joyose see: https://xiaomiui.net/what-is-the-joyose-app-on-xiaomi-phones-14625/ has something to do with it.

What about if I have valuable data on the device? Is there any method to backup this data when the device is bricked?

When the phone is booting, I have access to adb command, but it seems the package manager service is not already up, so I cannot install or uninstall any app using adb.

The thing I cannot understand is I can do ls command in root directory but cannot access any of its subdirectories. I was finally able to access to link sdcard, but I cannot access its subdirectories as I don't have permissons. Here you can find the commands I was able to run in adb:

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb.exe devices
List of devices attached
88998c9c        device

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb.exe shell pm list packages
cmd: Can't find service: package

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb.exe shell ls
ls: ./vndservice_contexts: Permission denied
ls: ./verity_key: Permission denied
ls: ./vendor_service_contexts: Permission denied
ls: ./vendor_hwservice_contexts: Permission denied
ls: ./ueventd.rc: Permission denied
ls: ./plat_hwservice_contexts: Permission denied
ls: ./init.zygote64_32.rc: Permission denied
ls: ./init.zygote32.rc: Permission denied
ls: ./init.usb.rc: Permission denied
ls: ./init.usb.configfs.rc: Permission denied
ls: ./init.recovery.qcom.rc: Permission denied
ls: ./init.recovery.hardware.rc: Permission denied
ls: ./init.rc: Permission denied
ls: ./init.miui.rc: Permission denied
ls: ./init.miui.post_boot.sh: Permission denied
ls: ./init.miui.nativedebug.rc: Permission denied
ls: ./init.miui.google_revenue_share_v2.rc: Permission denied
ls: ./init.miui.google_revenue_share.rc: Permission denied
ls: ./init.miui.early_boot.sh: Permission denied
ls: ./init.miui.cust.rc: Permission denied
ls: ./init.environ.rc: Permission denied
ls: ./init.batteryd.rc: Permission denied
ls: ./init: Permission denied
ls: ./default.prop: Permission denied
ls: ./cn.prop: Permission denied
acct
bin
bt_firmware
bugreports
cache
charger
config
cust
d
data
dev
dsp
etc
firmware
mnt
odm
oem
persist
plat_file_contexts
plat_property_contexts
plat_seapp_contexts
plat_service_contexts
proc
product
res
root
sbin
sdcard
sepolicy
storage
sys
system
vendor
vendor_file_contexts
vendor_property_contexts
vendor_seapp_contexts

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb shell
sagit:/ $ ls -lsa /sdcard
0 lrwxrwxrwx 1 root root 21 1970-01-01 01:00 /sdcard -> /storage/self/primary

sagit:/ $ ls -lsa /storage/self/primary
0 lrwxrwxrwx 1 root root 19 1974-03-14 20:42 /storage/self/primary -> /mnt/user/0/primary

sagit:/ $ ls -lsa /mnt/user/0/primary
ls: /mnt/user/0/primary: No such file or directory

sagit:/ $ ls -lsa /mnt/user/0/
ls: /mnt/user/0/: Permission denied

sagit:/ $ ls -lsa /mnt/user/
total 0
0 drwxr-xr-x  3 root root    60 1974-03-14 20:45 .
0 drwxr-xr-x 11 root system 240 1974-03-14 20:45 ..
0 drwxr-x--x  2 root root    40 1974-03-14 20:45 0
gmm96 commented 1 year ago

Package service seems to be failing, so that's the reason why I cannot install any app. Any suggestion to recover the data before wiping?

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb install -r telegorda.apk
Performing Streamed Install
adb: failed to install telegorda.apk: cmd: Can't find service: package

C:\Users\Guille\Desktop\platform-tools_r33.0.0-windows\platform-tools>adb shell service list
Found 31 services:
0       display: []
1       recovery: []
2       power: []
3       appops: []
4       batterystats: []
5       device_identifiers: []
6       media.audio_flinger: [android.media.IAudioFlinger]
7       gpu: [android.ui.IGpuService]
8       SurfaceFlinger: [android.ui.ISurfaceComposer]
9       media.extractor: [android.media.IMediaExtractorService]
10      miui.shell: [miui.IShellService]
11      media.metrics: [android.media.IMediaAnalyticsService]
12      drm.drmManager: [drm.IDrmManagerService]
13      media.resource_manager: [android.media.IResourceManagerService]
14      media.player: [android.media.IMediaPlayerService]
15      android.security.keystore: [android.security.IKeystoreService]
16      android.service.gatekeeper.IGateKeeperService: []
17      miuiboosterservice: [com.miui.performance.IMiuiBoosterManager]
18      storaged_pri: [android.os.storaged.IStoragedPrivate]
19      storaged: [android.os.IStoraged]
20      wificond: []
21      stats: [android.os.IStatsManager]
22      vendor.perfservice: [com.qualcomm.qti.IPerfManager]
23      media.drm: [android.media.IMediaDrmService]
24      installd: []
25      incident: []
26      miui.fdpp: []
27      thermalservice: [android.os.IThermalService]
28      netd: []
29      vold: []
30      miui.mqsas.IMQSNative: []
TubbyCat commented 1 year ago

If there's important data consider this comment a waiving of personal liability for any damages. It would be wise to take the phone into a reputable shop for data recovery.

Theoretically, you'd hopefully be able to copy (cp command) over valuable info to an SD card though. See: https://www.reddit.com/r/termux/comments/eqvhi2/how_to_mount_sd_card/ as on line 29 it states you have vold service. Note: assuming you have tried to use adb pull to move data to your desktop pc.

If not this, then one might attempt to use hacky methods or a forensic retrieval of data but that is far beyond the scope of this comment section tbh. The latter would require equipment a reputable shop probably has.

Next time, only debloat, tinker, etc. on an empty phone. I mean, I've ignored that warning myself but they're best practices for a reason.

TubbyCat commented 1 year ago

If you attempt debloat after this fiasco, you will have to titrate to determine which specific package(s) are responsible for the bootloop. Remove joyose first to see if it induces the problem and then factory reset, or do it last depending on how confident you feel about it being the package responsible for the issue.

The packages quoted below must be removed manually NOT with UAD. Report findings as it will allow UAD devs to modify the removal scripts to prevent this from recurring.

Your phone: Xiaomi Mi6

Describe the issue I uninstalled next apps, then smartphone got stuck in bootloader screen after reboot.

  • com.mi.android.globalminusscreen
  • com.mipay.wallet.id
  • com.miui.analytics
  • com.miui.backup
  • com.miui.bugreport
  • com.miui.calculator
  • com.miui.cleanmaster
  • com.miui.cloudbackup
  • com.miui.cloudservice
  • com.miui.daemon
  • com.miui.hybrid
  • com.miui.hybrid.accessory
  • com.miui.micloudsync
  • com.miui.miservice
  • com.miui.msa.global
  • com.miui.notes
  • com.miui.player
  • com.miui.smsextra
  • com.miui.videoplayer
  • com.miui.weather2
  • com.miui.yellowpage
  • com.wapi.wapicertmanage
  • com.xiaomi.joyose
  • com.xiaomi.mirecycle
  • com.xiaomi.simactivate.service
emeric254 commented 1 year ago

If you have no meaningful data on the device, factory reset from boot menu. If debugging this does not work through other means, this is your best bet. Google how to access boot menu as it varies by device. (https://www.google.com/search?q=xiaomi+mi6+factory+reset) @ first glance perhaps com.xiaomi.joyose see: https://xiaomiui.net/what-is-the-joyose-app-on-xiaomi-phones-14625/ has something to do with it.

What about if I have valuable data on the device? Is there any method to backup this data when the device is bricked?

When the phone is booting, I have access to adb command, but it seems the package manager service is not already up, so I cannot install or uninstall any app using adb.

The thing I cannot understand is I can do ls command in root directory but cannot access any of its subdirectories. I was finally able to access to link sdcard, but I cannot access its subdirectories as I don't have permissons. Here you can find the commands I was able to run in adb: ....

In theory you can create a small infinite loop using a shell to "bruteforce" the adb reinstall. The time window in which adb is enabled is short, and the package manager become ready a very short time, right before the rom reboot (once it try to load a missing pkg). I've done it multiple time while debloating (manually) my phone few years ago.

The rule is to keep track of which pkg you removed.

a quick example that could imo. be added in the README.md as a last resort before a factory reset :sweat_smile:

while true; do pm install-existing app.package.name; done

and CTRL-C as soon as it's good or you could add a && break right after the app.package.name