topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
48.91k stars 12.56k forks source link

Patched Samsung Galaxy AP ROM file doesn't contain userdata.img.lz4 #8547

Closed BigKananga closed 2 weeks ago

BigKananga commented 2 weeks ago

When patching a Samsung Galaxy ROM AP file inside Magisk for flashing with Odin, the patched .tar file doesn't contain userdata.img.lz4 which is especially for upgrades like monthly security updates necessary to keep userdata. In Magisk 26.1 everything works fine and the userdata.img.lz4 is included in the patched .tar file. At least since 26.4 this file is missing.

Device: Samsung Galaxy Android version: 13 Magisk version name: Magisk (070719db) (28001) Magisk version code: 28001

salvogiangri commented 2 weeks ago

https://github.com/topjohnwu/Magisk/pull/7129#issue-1779006020

BigKananga commented 2 weeks ago

Ok, I see. It won't be fixed. :(

salvogiangri commented 2 weeks ago

Ok, I see. It won't be fixed. :(

It's not a bug, it's intentional.

BigKananga commented 2 weeks ago

Ok, I see. It won't be fixed. :(

It's not a bug, it's intentional.

So it's intentional that you lose all your settings and userdata when applying security updates? Seriously?

salvogiangri commented 2 weeks ago

So it's intentional that you lose all your settings and userdata when applying security updates? Seriously?

On what basis are you assuming this? As explained in the PR, the shipped userdata.img in the AP tar only contains generic OS files/bloat, there's no point for the Magisk app to copy back the image since you're either formatting your data if installing Magisk for the first time (thus deleting all the content of the flashed partition) or upgrading your OS which does not flash the image when using the HOME_CSC tar (this makes sure you're not losing your data)

salvogiangri commented 2 weeks ago

Because when I flashed the file last time without this file, my phone didn't boot anymore. Had to do a full new flash to get it working again, all settings and app data lost. After switching back to older version patching, flashing and booting worked as intended for the next firmware updates. Of course I'm always using Home CSC files for updates. But keeping data is not the problem. The problem is, that the phone doesn't boot without flashed userdata.img.lz4.

Your problem has nothing to do with this. The userdata.img.lz4 is ignored when using the HOME_CSC tar, if it gets flashed you do lose your data.

BigKananga commented 2 weeks ago

And why does it work with userdata.img.lz4? Is it a bug in 26.x versions (didn't test 27+ cause I don't wanna brick my phone again)?

salvogiangri commented 2 weeks ago

HOME_CSC tar packages have a download-list.txt which tells Odin which of the supplied images to flash. Eg. HOME_CSC_OKR_S911NOKR4CXJ1_MQB86414397_REV00_user_low_ship_MULTI_CERT.tar.md5:

aop_devcfg.mbn
aop.mbn
apdp.mbn
bksecapp.mbn
cpucp.elf
devcfg.mbn
tz_iccc.mbn
hypvm.mbn
imagefv.elf
km41.mbn
qupv3fw.elf
shrm.elf
storsec.mbn
tz.mbn
vbmeta.img
uefi.elf
uefi_sec.mbn
xbl_config.elf
XblRamdump.elf
xbl_s.melf
abl.elf
NON-HLOS.bin
dspso.bin
sec.elf
quest.fv
testvector.fv
QcomCate.fv
Core_NON-HLOS.bin
vaultkeeper.mbn
engmode.mbn
tz_kg.mbn
tz_hdm.mbn
boot.img
dtbo.img
vendor_boot.img
super.img
recovery.img
vbmeta_system.img
vm-bootsys.img
modem.bin
cache.img
prism.img
optics.img
init_boot.img
keymint.mbn

You can clearly see the userdata image is missing to make sure it gets ignored, otherwise it would be flashed and overwrite the content of your data partition, leading to data loss.

salvogiangri commented 2 weeks ago

And why does it work with userdata.img.lz4? Is it a bug in 26.x versions (didn't test 27+ cause I don't wanna brick my phone again)?

I've already told you this has nothing to do with your situation. If you want to report issues regarding Magisk not booting on your device after upgrading, open another issue and provide proper debug info or at least a way to properly replicate the bug:

All bug reports require you to USE DEBUG BUILDS. Please include the version name and version code in the bug report.

If you experience a bootloop, attach a dmesg (kernel logs) when the device refuse to boot. This may very likely require a custom kernel on some devices as last_kmsg or pstore ramoops are usually not enabled by default.

BigKananga commented 2 weeks ago

Ok, I'll stay at 26.1 and test again when I would setup my phone again. If it still doesn't work, I'll have to stay at old version cause I can't setup my phone again every few days. Sorry for the harsh posts.