topjohnwu / Magisk

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

[Magisk] add Rescue scenario #5358

Closed vslmc closed 2 years ago

vslmc commented 2 years ago

Repost 4. time because your magisk-bot is a dictator. you have three clones of this in your closed section.

I know that magisk has two ways to help remove broken installs or module: Safe Mode - very ominous never seen a device capable of this , but it might exit ADB - well, only usefull if you have a custom reovery , but than you would not need it , fasboot ist not adb , while booting is no adb , so where/when should this be used ?

I propose a new feature that can help people stuck. If a device is in bootloop or stuck on boot , you can mostly fix it with flashing the stock boot.img and/or vbmeta.img. (fastboot) Reboot. Than allow the Magisk app to disable itself or all/some modules (atm the tab is greyed out). On the next reboot first search for this case and disable accordingly. Reflash patched partitions / reinstall magisk and manualy remove or modify broken modules.

Additional thoughts; or use a special file in root of internal storage to detect on boot. some phones can have sdcards.

Things not possible: expect adb/debugging , root acces , flashing healthy data partition

Device: Samsung Galaxy S8 (SM-G950F) Android version: 11 Magisk version name: 32fc34f Magisk version code: 24101

HuskyDG commented 2 years ago

You open new issue without knowledge. Flash stock boot image will make superuser access unavailable (no way to get root access) and magisk app cannot disable itself without superuser access

vslmc commented 2 years ago

You open new issue without knowledge.

True.

Flash stock boot image will make superuser access unavailable (no way to get root access) and magisk app cannot disable itself without superuser access

It should only be used to trigger the next boot behavior of magisk e.g. User will flash stock boot/vbmeta , reboot and open magisk app to disable apps , Next reboot instead of loading the overlayed files and folders , check first if magisk flag/file/property exist , and if , just init root without overlaying. (Activate a root_but_no_modules / safe mode) For example create a shared_pref value , that will be read and used before the first magiskboot function is executed. Or a file in internal storage or sdcard

In very short: activate magisk own safe/core mode from app for the next boot

Did I miss there something ? I hope/think there should no superuser be needed

*edit Additional situation not to expect: not even going from bootrom to system (comparision: bootloop loops/crashes in system mode aka you see rom booting animation)

This is very tricky and there might be no way to help these people ? As you sad this would need superuser access (not possible because it never boots that far) or a way to modify the partition 'data' from edl/preload etc. But I think would not a custom patched boot/vbmeta work here ? This image should have also root/core only , or has just one function: to disable modules (moving files not deleting , instead of init magiskboot root and not loading overlay feature)

This second rescue img could be the universal solution What comes in handy is that fastbootd has a new command for android 12 to dump boot/vbmeta (fastboot fetch vendor_boot ) , making it possible to dump a modified image to restore after (instead of making a backup before something breakes)

Jon8RFC commented 2 years ago

In the interim, there's this: https://github.com/Magisk-Modules-Alt-Repo/HuskyDG_BootloopSaver

vslmc commented 2 years ago

In the interim, there's this: https://github.com/Magisk-Modules-Alt-Repo/HuskyDG_BootloopSaver

Nice , This will probably work on most bootloops but not if the system rom will not boot or if it crashes before module scripts are executed. (Crashes or more likely vendor verify checks)

Also I think a rescue situation should come from the project that is the actually reason for this , even if third-party addons are to blame)

vvb2060 commented 2 years ago

Duplicate of #4624

vslmc commented 2 years ago

Duplicate of #4624

No it's not ? I proposed to add a new/different way to disable modules , with or without safe mode , not that I don't find the safe mode. Pls read not assume..

m00nwtchr commented 2 years ago

This is a really needed feature, I can't find any working way to get into Safe Mode on a bootlooping Samsung Galaxy S20 FE.