sdmaid
sdmaid copied to clipboard
Clean up Magisk leftovers
Is your feature request related to a problem? Please describe. Magisk leaves a bunch of backup folders/files after patching (and does not clean them up). The folders are below /data and have the format /magisk_backup_???? - where ??? are a sequence of "random" characters. The folders contain a file "boot.img.gz". Per: https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-86418905 and https://forum.xda-developers.com/t/magisk-general-support-discussion.3432382/post-86418905 These folders can be deleted, except for the one with the most recent date.
Describe the solution you'd like Add a feature within SD (possibly systemcleaner) - that would delete all folders named /data/magisk_backup_* with the exception of the one with the latest date.
Describe alternatives you've considered I have done the deletions manually, but clearly that is not the greatest user experience. SD does this type of thing so well, and it would be great if this could be added.
Additional context Add any other context or screenshots about the feature request here.
How do I get Magisk to create those? I don't have them on my rooted devices, do I need a specific Magisk version?
Maybe it has to do with the way I flash updates. I have a Moto G6 (A/B) device with Lineage. To flash a ROM update I do the following:
- Flash the ROM
- Flash TWRP (I like that recovery over the Lineage)
- Reboot into recovery
- Flash Magisk (a copy of magisk.apk renamed to magisk.zip)
Perhaps it is the step 4 process that leaves the files. I now have Magisk 24.1 (the release version), but earlier versions if magisk left files over as well.
Maybe it is related to the way I am doing things....
On Sat, Feb 19, 2022 at 2:04 AM Matthias Urhahn @.***> wrote:
How do I get Magisk to create those? I don't have them on my rooted devices, do I need a specific Magisk version?
— Reply to this email directly, view it on GitHub https://github.com/d4rken/sdmaid-public/issues/5338#issuecomment-1045916828, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQS6GS535LD4TQKHNFALYTU346JFANCNFSM5OKAZNGA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
How do I get Magisk to create those? I don't have them on my rooted devices, do I need a specific Magisk version?
@d4rken
Lets say you have a unrooted phone and you rooted it in this way
Flash custom recovery>rename magisk.apk to zip via recovery>flash the zip
Now magisk is doing is creating a folder on /data named magisk_backup_??? And makes 2 copies of unpatched stock boot image in that folder
The first copy, magisk will not touch it because it will be the backup.
Magisk will touch the second copy, it will get patched, written to boot partition and delete the second copy and everything is done
The ??? Is just a random string or a md5 hash of a previous boot image whether its unpatched boot image or boot image with previous version of magisk
Then the next few days, there was a notification, magisk update, you installed the update directly, via app, it will do(what i think of), create a new folder, like the first time you flash the zip, then makes 2 copies the current boot image you have to the newly created folder
then patches the second copy then directly flashes it to boot partition and deletes the second copy.
Problem, whether installing an magisk update via app or recovery, doesn't check for previous old backups that can be deleted
And i think it doesn't need a specific version unless there were changes how magisk behaves on updating
This description makes sense.
If I understand correctly, you are summarizing, providing a (great!) technical description and acknowledging the issue.
Is there anything else that you may need from me? It seems that the "needs info/repro" tag is still assigned.
Thank you again.
There is a new magisk update now, ill update today and check if these 2 folder became 3, then magisk it still doesn't do anything on previous boot image backups
Also @ewillner , darken will just tag you when he needs more info from you and he is probably busy and checking before removing "needs info/repro" issue label
I just updated magisk via direct installation, it doesn't make new backup of boot image and the old 2 folders i have still there.
Maybe magisk doesn't make backups of boot image anymore when you update directly
@dragonGod97677 - thank you for your clarification and your testing.
I also updated magisk (to v24.3) via direct installation and did not get any extra folders created.
Then I went through the process that I would use to flash an updated version of my ROM:
- Flash the ROM
- Flash TWRP (I like that recovery over the Lineage)
- Reboot into recovery
- Flash Magisk (a copy of magisk.apk renamed to magisk.zip)
With this sequence, an additional folder was still created.
@dragonGod97677 - thank you for your clarification and your testing.
I also updated magisk (to v24.3) via direct installation and did not get any extra folders created.
Then I went through the process that I would use to flash an updated version of my ROM:
- Flash the ROM
- Flash TWRP (I like that recovery over the Lineage)
- Reboot into recovery
- Flash Magisk (a copy of magisk.apk renamed to magisk.zip)
With this sequence, an additional folder was still created.
So... Now we get that magisk only backups boot image when a fresh install via recovery or install update via recovery
Also your welcome :D
How do I get Magisk to create those? I don't have them on my rooted devices, do I need a specific Magisk version?
Magisk creates those when flashed through recovery
Yes, that's true. I also see 2 folders. I rooted mine by flashing Magisk on Android 11 via TWRP. Then upgraded to Android 12, but had to use the 'Install to inactive slot' route to keep root, since TWRP is not supported on Android 12 in my device. I guess that's why I also see 2 folders.