yashsingh1/xdaforums huggingface dataset:
[General Questions and Answers] kerstin92:
Hi all,

I may have just messed up my smartphone and really need your help. I wanted to get rid of some of the bloatware on my A40 and read online that one can actually uninstall many apps via the Windows command line. So I looked up a list of apps supposedly safe to remove and ran a batch file to uninstall them. This is as far as I got:

Right before that, I had moved apps related to "Knox" and "MDM" and everything seemed fine. But even while the last commands were running, the "desktop" disappeared (the home screen with all my app shortcuts) and some kind of "busy notification" was running instead (I think it said something like "starting up apps" or "launching apps"). But the phone didn't reboot, it just seems that the homescreen had crashed. I then noticed that I might have slipped in apps for deletion that I actually needed or was using, such as

Since the phone seemed to be stuck in this "busy loop", I decided to restart it by long-pressing the power button and selecting restart. But from this point, the phone wouldn't restart and got stuck in a reboot loop, where only the Samsung logo pops up, followed by a short vibration pulse, then reboot etc.

At this point I panicked and started searching online for solutions (which also brought me to this forum). I've read about using OEM unlocking, firmware-flashing using Odin, Samsung Tool Pro, TWRP etc. but quickly got lost in the woods and didn't want to risk breaking things more.

There are log files I can access from the boot menu which might contain a lot of useful information regarding the cause of the problem, but it's way too much to type it:

Is there a way I could somehow read these log files via a USB connection? For example, in rescueparty_log, there is some "serious-sounding" stuff:

Also, some information from the boot screen output:

Is anyone perhaps familiar with this problem and knows of a way how I could get the phone to start up properly, so I can at least recover all my personal data?

My impression is that I might have deleted some important system app, since the problem occurred right in the middle of the uninstall process (see shell history above), and I'm a little bit hopeful that maybe it's possible to just reinstall it somehow. I haven't tried the "Wipe data/factory reset" option in the boot menu as I don't want to lose all my data.

Thank you so much for your help, any advice is super-appreciated!!
[General Questions and Answers] Droidriven:
You were way too aggressive with removing all those apps. Some of them are important and the device can't function without them.

You need to reflash your current firmware via Odin and start over. Next time, research what the app actually is before you remove it, you could be removing an app or service that works in unison with an app or service that you intend to keep/use, effectively killing something you actually want to use.
[General Questions and Answers] Tresans:
Hello Kerstin92

I think best option is to flash with ODIN "and deselect DATA" partition,then you will not lose your data.

So If you load the firmware in ODIN what was original on the phone while this is happened,then you will see a lot of files on the right side < delete the DATA.img> and then all of your apps will install ,except DATA partition. (Can someone confirm this?

Kindly regards
[General Questions and Answers] kerstin92:
Hi,

the home screen crashed right during the removal of one of the last apps in my list stated above. Do you recognize any app that might be critical for system stability? I used a removal list from a Samsung-specific website featuring a description/categorization of all unnecessary apps where it was stated that these apps are safe to remove and not required for the phone to run properly (trying to find it right now...)

Edit - I think the list was from one of these two sites:

Easily Remove Bloatware From Galaxy S20, S20+, S20 FE and S20 Ultra (No Root)

Here is our indepth-guide to Remove Bloatware From Galaxy S20, S20+, S20 FE and S20 Ultra (No Root required)

rootmygalaxy.net

Learn to Completely Remove Bloatware on your Galaxy S10 (No Root Needed) • Android Flagship

You know how the story goes. Your Galaxy S10 might seem to have it all, but Samsung needs to make a few changes when it comes to the pre-installed apps. They basically reduce the user experience and are nothing more...

androidflagship.com
[General Questions and Answers] kerstin92:
I've looked into this a bit and it seems that one can flash the firmware while retaining one's data (i.e. such that it doesn't get wiped). Have you ever done this and could you give me some advice on how to do this safely? E.g. do I need a certain version of Odin, where should I best download the original firmware (something safe/malware-free), which settings in Odin and which FW files are required etc.

I can get into the boot menu with recovery options and I can also get into download mode, so not all is lost it seems.

Thank youuu
[General Questions and Answers] kerstin92:
Hi Tresans,

have you ever done this and could you give me some advice on how to do this safely? E.g. do I need a certain version of Odin, where should I best download the original firmware (something safe/malware-free), which settings in Odin and which FW files are required etc.?

I can get into the boot menu with recovery options and I can also get into download mode, so not all is lost it seems. But my feeling is that flashing could end up being a one-shot chance, so I don't want to mess this up.

Many thanks!
[General Questions and Answers] victoriam8a:
I sent you a message !!! Hope I can help :)
[General Questions and Answers] xtcislove:
Why not post your tips here so anyone can benefit from it?
[General Questions and Answers] kerstin92:
Hi,

are you familiar with firmware flashing using Odin? There seems to be a way to do this while retaining one's data:

https://xdaforums.com/t/help-how-to-flash-without-losing-data.3704358/

Are you maybe familiar with this? Also, do you know where one could get original Samsung firmware files (safe/no malware) and how to verify file integrity/authenticity (maybe some hash/checksum)?
[General Questions and Answers] victoriam8a:
No problem !! I can post the process here too !!! I just wanted to message them privately to guide them step by step !! :)

1. Go to this page: https://samfw.com/

2. Type your model number in the search bar

3. Select your Android version

4. Select your CSC code

5. Scroll down until you see the latest build of your firmware

6. Click on the code under "Version"

7. Download the zip package

8. Extract the zip

9. Download the latest version of Odin from this google drive link

https://drive.google.com/drive/folders/1e9e-a_Qa5biQ-XH9zTYM1MR34BRZXhsF?usp=sharing

10. Open the exe file inside the Odin folder

11. Connect your phone to your PC

12. Turn off your phone

13. When the screen goes black press volume down and volume up at the same time

14. When you see a blue screen with some letters in Chinese, press the volume up button once

15. There's a section in the Odin program that says "log". Look for that section and look for a message that says "added" under that. If you see the message, your phone is being recognized by the device

16. If you don't see the message go to the Odin folder, look for the sub-folder that says "Samsung Driver"

17. Click on the file that says "Download"

18. Select the latest version of the drivers and download them to your computer

19. Double-click the downloaded exe file and go through the setup wizard

20. After the drivers are installed, open the Odin application again and you should see the "added" message under the "log" section. Your device is now recognized

21. Go to the right of the Odin application and click on the "BL" button

22. This will open your file explorer. Go to the folder where you extracted your firmware and select the file that starts with "BL"

23. Click the "AP" button on Odin and select the firmware file starting with "AP"

24. Click the "CP" button and on Odin and select the firmware file starting with "CP"

25. Lastly, click the "CSC" button on Odin and select the firmware file starting with "HOME_CSC"

26. Go to the bottom of the Odin application and click on the "Start" button

27. You should see a progress bar at the top indicating that the flashing has started

28. Wait for a couple of minutes for the firmware to be done flashing (this might take a while)

29. When it's done, you'll see a green "PASS" message where the progress bar was

30. Reboot your phone normally

If you get stuck in a boot loop you'll have to factory reset. Follow the following steps:

31. Restart your phone into recovery mode by pressing volume up and power

32. Select "Wipe data/factory reset

33. Reboot your phone normally

34. Wait a few minutes for it to boot (it might take a while too)

After that, your phone should work normally
[General Questions and Answers] kerstin92:
Hi Victoria,

thank you so much for this super-detailed instruction! =D As we've already briefly discussed, I have just two questions regarding this process and data recovery in general:

1.) Is there a way to verify the authenticity of firmware files? I.e. has Samsung published some checksums or hashes for their original firmware update files? If not, how can you make sure that the files are "clean"? Or is there maybe even a way to download files directly from Samsung?

2.) My priority is to rescue my personal data before doing anything that risks a complete wipe/factory reset and I've read that Android is based on Linux. If I had a similar problem with a Linux PC, I would simply mount the hard disk to a different PC, decrypt it if necessary, and copy over my files. Isn't there something similar that can be done with Android via USB?
[General Questions and Answers] kerstin92:
...also, do I need to select the exact same firmware version as already installed? E.g. mine would be A405FNXXU3ATA4, but on the site that you linked, this version is listed. Also, is there a way to somehow get the CSC code from the recovery menu (i.e. if one cannot start Android)?
[General Questions and Answers] victoriam8a:
You're very welcome :) I'm glad to help in any way that I can !! In regards to your questions...

1) Every time you flash an unofficial firmware that's not original you'll get a message saying that the firmware is not official when the phone is booting. If you don't see this warning message, that means you're running Samsung's official firmware. Whenever I have flashed the files from this website I have never gotten this message and my phone always says the firmware is official.

2) The only thing I can think of to secure your data is installing a custom recovery and backing up your internal storage to a USB drive. Apart from that, I don't know how else you can rescue your data.

If you have any other concerns don't hesitate to ask !!
[General Questions and Answers] victoriam8a:
You don't have to download the same version that you have installed, you can just download the latest one. This will prevent any errors. To get the CSC code do the following. Connect your phone to your computer via USB. Turn off your phone completely. When the screen goes black, press both volume buttons at the same time. After a few seconds of doing this you'll see a blue screen that says download mode. Press the volume up button once. You'll get another blue screen with a bunch of letters on top. Look for a line of text that says "Carrier_ID" and a few letters after that. That's your CSC code. On that same blue screen you'll see a line of text that says "Current Binary". If you see the words "custom" next to it, your software is not official, but if you see the words "Samsung Official" next to it your software is official. That's another way to tell wether the firmware is legit or not.
[General Questions and Answers] victoriam8a:
These are the two blue screens that you will see. The one to the left is where you have to press the volume up button and the one to the right is where you'll find your "CARRIER_ID" (CSC) Code and whether your software is official or not

View attachment 5640067View attachment 5640063
[General Questions and Answers] kerstin92:
Hi,

thanks again. I just tried to read out the CSC code in download mode, but I only get that cyan-colored "Downloading..." screen, but no further information despite pressing the volume keys. Do you know if this is normal?

I get to the download mode by long-pressing Volume Down + Power to reboot, then selecting "Reboot to bootloader" in the menu.

Btw, it seems I have almost the same phone as you... ^^
[General Questions and Answers] victoriam8a:
You're welcome !!

Try the following steps:

-Connect your phone to your computer with s USB cable

- Turn off the phone

-When it turns off press volume up and volume down at the same time

After you do that you'll see a blue screen. When you see it press the volume up button once.

Then you should see the screen with the information.

Here's a link to a tutorial on how to get to that screen if you're confused:

Let me know if that works !!
[General Questions and Answers] kerstin92:
Ahh, yes!! It works, thanks a lot. Didn't know that just pressing both volume keys actually powers on the device...

So the CSC code is DBT, good to know. Also, I getting these bits of information:

Also, I never registered a Google account on this device which, I guess, was a good decision?
[General Questions and Answers] victoriam8a:
You're welcome !! I'm glad it worked !! Yeah, pressing both volume keys will boot you into download mode. That's very useful to know !! Now you can download the firmware and flash it to fix your phone. Let me know if you're able to do it or if you need more help ! :)
[General Questions and Answers] kerstin92:
Victoria, have you ever heard of "combination ROMs"? It seems that one can get access to `/data` using such firmware with root enabled. Would that be an alternative to using the stock firmware?
[General Questions and Answers] victoriam8a:
No, I have never heard of combination ROMs, only custom ROMs but I guess they could work. You would have to try !!
[General Questions and Answers] kerstin92:
Hey, could it be that flashing the firmware does NOT actually solve any of my problems? It appears that by doing pm uninstall I didn't actually uninstall any apps, but just removed them from my normal (unprivileged) user space. Meaning that these apps have been disabled in /data/system/packages.xml, which is not accessible without root privileges. So flashing the firmware will reinstall all apps, but the ones responsible for this whole mess will remain disabled even after flashing the firmware, unless the configuration in /data/system/packages.xml is changed.

Which brings me to the question: Is there any way to get root privileges without wiping the entire phone?

I'm thinking that law enforcement agencies are accessing files inside /data on a daily basis for forensics, so there must be a way to do this, right? Especially if I have all the credentials (lock screen PIN etc.).
[General Questions and Answers] victoriam8a:
Heyyy. Well, in order to root your phone you have to unlock the bootloader. Unlocking the bootloader will wipe all of your data and factory reset your phone. There is currently no way to gain root access without doing this. If flashing stock firmware doesn't work, then you'll need to wipe everything unfortunately :( Hope this helps !!
[General Questions and Answers] Droidriven:
Sorry, just now seeing this.

Install a version of Odin that is built/released around the same time that your device was released.

When you flash the firmware, if you have two different CSC files, use the Home_CSC and not the other. Home_CSC does not wipe data, the other CSC does.

Before you flash the device, boot into stock recovery mode and choose the option to wipe the cache partition but DO NOT choose the factory reset/format data option, you only want to wipe the cache. This is to remove any cached data that may be left over from the apps that you deleted, that data may cause a conflict during flashing that would result in an error or failed flash, wiping that cached data avoids those potential issues.

On a side note, you may want to try booting to recovert and wiping the cache then reboot and see if the device will function. There is a remote chance that it is bootlooping due to the aforementioned cached data left over from the removed apps causing a conflict when it tries to reboot, resulting in the bootloop. Any time you add or remove something to/from the system partition, such as apps or system files, you must reboot into recovery and wipe the cache partition then reboot the device so that it can rebuild the system cache with the new changes that you made, failing to do this causes things to be buggy, even cause system crashes due to the system trying to load/use cached data that it no longer has the apps to use it with. This must be done even when you add/remove something that is completely safe even if you do it completely correct, you still need to wipe the system cache and reboot so the system can rebuild cache without the leftover junk hanging around causing problems.
[General Questions and Answers] kerstin92:
Hi Droiddriven,

thanks a lot for your feedback and advices! I think I'll try the firmware flash, but I have two questions:

- Why is it important to use a version of Odin from around the same time of the device release? Also, how to find out which version is the correct one (e.g. should it be the first available version that came out after the phone was released or the last available version before the phone was released)?

- Is there a possibility that flashing the firmware will not solve the boot looping? I read that doing pm uninstall doesn't actually uninstall any apps, but only removes them from my (unprivileged) user by a modification of /data/system/packages.xml, which is not accessible without root privileges. So, wouldn't the apps presumed to be responsible for the boot loop remain disabled even after the firmware flash, since flashing doesn't (and in this case shouldn't) wipe/reset anything inside /data? But if this were to be true, how could I ever hope to retrieve any of my data as e.g. rooting the device will trigger wiping of /data?

Edit: ...also, some people recommend using Heimdall over Odin (for being open-source, supposedly more reliable etc.). Do you maybe have an advice on this?

Best,

Kerstin
[General Questions and Answers] Droidriven:
I

It isn't required to have a specific version of Odin, but, some things change with devices as things go on, such that, older versions of Odin don't always work well with newer devices and newer versions of Odin don't always work well with older devices. But if you use a version of Odin from around the same time the device was released, there is less chance of minor differences between versions of Odin and the device being flashed.

The question you are asking about data from uninstalled apps causing issues with flashing. If you do as I already recommended(and even explained in detail why), boot into recovery and wipe the cache partition before you flash the firmware. You shouldn't need to wipe data/data. No, flashing the firmware will wipe the system partition when it flashes the new system.img, anything you changed in system should be overwritten during the flashing process.

I've had less issues with Odin than I have with Heimdall, Heimdall is for Linux, not Windows and it can be a pain getting all the packages installed and libUSB set up that it needs to work correctly. Odin is much simpler to use, a few clicks of the mouse and off it goes, Heimdall isnt as user friendly.
[General Questions and Answers] kerstin92:
Hi,

okay, thanks. Just to reconfirm that I understood your advice correctly: Does wiping the cache partition also reset any changes to /data/system/packages.xml to stock configuration, i.e. will whatever "boot-critical" app that I accidentally disabled get re-enabled (reinstalled)? If so, what exactly is the mechanism behind this, i.e. how does Odin "repair/restore" the packages.xml inside the encrypted /data partition? Or are you implying that this boot loop isn't caused by settings in packages.xml in the first place?

At the moment I have two conflicting advices:

1.) "Boot loop is caused by app settings in packages.xml and, since this configuration file is stored in the protected /data partition, all hope is lost. I would have to defeat TEE in order to get root access without triggering a full data wipe, then decrypt the /data partition in order to save my data."

vs.

2.) "Flashing the firmware using the HOME_CSC instead of CSC firmware file will repair Android without wiping your data."

Which advice is correct?
[General Questions and Answers] kerstin92:
I'm proposing a possible way to solve this issue:

There is an interesting comment below the answer to

Can system apps be enabled/disabled directly from the filesystem?

System apps can be disabled by using pm disable [appname] and re-enabled in the same fashion. But is there a way to accomplish the same thing by editing some file(s?) somewhere? Context: My Andro...

android.stackexchange.com

"It is also safe to simply remove the package-restrictions.xml file — a new 'clean' file will be recreated on next reboot." – ccpizza Oct 3, 2021 at 16:43

As far as I understand, Android 9.0 switched from Full-Disk Encryption (FDE) to File-Based Encryption (FBE), which means that encryption is done on a file-by-file basis by default:

https://docs.samsungknox.com/admin/knox-platform-for-enterprise/kbas/kba-360039577713/

If it's possible to locate package-restrictions.xml on the internal storage, deleting the file (instead of modifying its content in order to restore individual app settings) will cause the stock version to be restored on the next reboot. Any problem due to a prior misconfiguration of package-restrictions.xml by doing pm uninstall should then be magically gone.

Would this work?
[General Questions and Answers] alecxs:
on download screen picture in post #13 note the DID = 2003d474a64fba11 (yours is different) - this is needed to buy Etoken (@elliwigy can explain better)
[General Questions and Answers] kerstin92:
I'm proposing a possible way to solve this issue:

There is an interesting comment below the answer to

Can system apps be enabled/disabled directly from the filesystem?

System apps can be disabled by using pm disable [appname] and re-enabled in the same fashion. But is there a way to accomplish the same thing by editing some file(s?) somewhere? Context: My Andro...

android.stackexchange.com

"It is also safe to simply remove the package-restrictions.xml file — a new 'clean' file will be recreated on next reboot." – ccpizza Oct 3, 2021 at 16:43

As far as I understand, Android 9.0 switched from Full-Disk Encryption (FDE) to File-Based Encryption (FBE), which means that encryption is done on a file-by-file basis by default:

https://docs.samsungknox.com/admin/knox-platform-for-enterprise/kbas/kba-360039577713/

So, if Android no longer encrypts the entire internal storage (or partitions) but only individual files, shouldn't it also be possible to delete individual files?

If it's possible to locate package-restrictions.xml on the internal storage, deleting the file (instead of modifying its content in order to restore individual app settings) will cause the stock version to be restored on the next reboot. Any problem due to a prior misconfiguration of package-restrictions.xml by doing pm uninstall should then be magically gone.

Would this work?