Manually enable MagiskHide in settings (MagiskHide is no longer enabled by default). Also, there are known methods to detect Magisk, so your mileage may vary.
### Q: I installed a module and it bootlooped my device. Help!
### Q: I installed a module and it bootlooped my device. Help!
If you have USB debugging enabled in developer options, connect your phone to the PC. If your device is detected (check by `adb devices`), enter ADB shell and run the command `magisk --remove-modules`. This will remove all your modules and automatically reboot the device.
If you have USB debugging enabled in developer options, connect your phone to the PC. If your device is detected (check by `adb devices`), enter ADB shell and run the command `magisk --remove-modules`. This will remove all your modules and automatically reboot the device.
If unfortunately you do not have USB debugging enabled, reboot into Safe Mode. Most modern Android devices support pressing a special key combo at boot to enter Safe Mode as an emergency option. Magisk will detect Safe Mode being activated, and all modules will be disabled. Then reboot back to normal mode (the module disable state persists) and manage your modules through the Magisk app.
If unfortunately you do not have USB debugging enabled, reboot into Safe Mode. Most modern Android devices support pressing a special key combo at boot to enter Safe Mode as an emergency option. Magisk will detect Safe Mode being activated, and all modules will be disabled. Then reboot back to normal mode (the module disable state persists) and manage your modules through the Magisk app.
### Q: Why is X app detecting root?
Magisk no longer handles root hiding. There are plenty of Magisk/Zygisk modules available that specifically provide these functionalities, please search around 😉
### Q: After I hidden the Magisk app, the app icon is broken.
### Q: After I hidden the Magisk app, the app icon is broken.
The Magisk app uses a more advanced hiding method that will install a "stub" APK that has nothing in it. The only functionality this stub app has is downloading the full Magisk app APK into its internal storage and dynamically load it. Due to the fact that the APK is literally *empty*, it does not contain the image resource for the app icon.
When hiding the Magisk app, it will install a "stub" APK that has nothing in it. The only functionality this stub app has is downloading the full Magisk app APK into its internal storage and dynamically loading it. Due to the fact that the APK is literally _empty_, it does not contain the image resource for the app icon.
When you open the hidden Magisk app, it will offer you the option to create a shortcut in the homescreen (which has both the correct app name and icon) for your convenience. You can also manually ask the app to create the icon in app settings.
When you open the hidden Magisk app, it will offer you the option to create a shortcut in the homescreen (which has both the correct app name and icon) for your convenience. You can also manually ask the app to create the icon in app settings.
Magisk comes with a huge collections of tools for installation, daemons, and utilities for developers. This documentation covers the 3 binaries and all included applets. The binaries and applets are shown below:
Magisk comes with a huge collections of tools for installation, daemons, and utilities for developers. This documentation covers the 3 binaries and all included applets. The binaries and applets are shown below:
```
```
...
@@ -15,6 +16,7 @@ su -> magisk
...
@@ -15,6 +16,7 @@ su -> magisk
Note: The Magisk zip you download only contains `magiskboot`, `magiskinit`, and `magiskinit64`. The binary `magisk` is compressed and embedded into `magiskinit(64)`. Push `magiskinit(64)` to your device and run `./magiskinit(64) -x magisk <path>` to extract `magisk` out of the binary.
Note: The Magisk zip you download only contains `magiskboot`, `magiskinit`, and `magiskinit64`. The binary `magisk` is compressed and embedded into `magiskinit(64)`. Push `magiskinit(64)` to your device and run `./magiskinit(64) -x magisk <path>` to extract `magisk` out of the binary.
### magiskboot
### magiskboot
A tool to unpack / repack boot images, parse / patch / extract cpio, patch dtb, hex patch binaries, and compress / decompress files with multiple algorithms.
A tool to unpack / repack boot images, parse / patch / extract cpio, patch dtb, hex patch binaries, and compress / decompress files with multiple algorithms.
`magiskboot` natively supports (which means it does not rely on external tools) common compression formats including `gzip`, `lz4`, `lz4_legacy` ([only used on LG](https://events.static.linuxfound.org/sites/events/files/lcjpcojp13_klee.pdf)), `lzma`, `xz`, and `bzip2`.
`magiskboot` natively supports (which means it does not rely on external tools) common compression formats including `gzip`, `lz4`, `lz4_legacy` ([only used on LG](https://events.static.linuxfound.org/sites/events/files/lcjpcojp13_klee.pdf)), `lzma`, `xz`, and `bzip2`.
...
@@ -22,7 +24,7 @@ A tool to unpack / repack boot images, parse / patch / extract cpio, patch dtb,
...
@@ -22,7 +24,7 @@ A tool to unpack / repack boot images, parse / patch / extract cpio, patch dtb,
The concept of `magiskboot` is to make boot image modification simpler. For unpacking, it parses the header and extracts all sections in the image, decompressing on-the-fly if compression is detected in any sections. For repacking, the original boot image is required so the original headers can be used, changing only the necessary entries such as section sizes and checksum. All sections will be compressed back to the original format if required. The tool also supports many CPIO and DTB operations.
The concept of `magiskboot` is to make boot image modification simpler. For unpacking, it parses the header and extracts all sections in the image, decompressing on-the-fly if compression is detected in any sections. For repacking, the original boot image is required so the original headers can be used, changing only the necessary entries such as section sizes and checksum. All sections will be compressed back to the original format if required. The tool also supports many CPIO and DTB operations.
```
```
Usage: magiskboot <action> [args...]
Usage: ./magiskboot <action> [args...]
Supported actions:
Supported actions:
unpack [-n] [-h] <bootimg>
unpack [-n] [-h] <bootimg>
...
@@ -39,8 +41,10 @@ Supported actions:
...
@@ -39,8 +41,10 @@ Supported actions:
Repack boot image components from current directory
Repack boot image components from current directory
to [outbootimg], or new-boot.img if not specified.
to [outbootimg], or new-boot.img if not specified.
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
If '-n' is provided, it will not attempt to recompress ramdisk.cpio,
otherwise it will compress ramdisk.cpio and kernel with the same method
otherwise it will compress ramdisk.cpio and kernel with the same format
in <origbootimg> if the file provided is not already compressed.
as in <origbootimg> if the file provided is not already compressed.
If env variable PATCHVBMETAFLAG is set to true, all disable flags will
be set in the vbmeta header.
hexpatch <file> <hexpattern1> <hexpattern2>
hexpatch <file> <hexpattern1> <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
Search <hexpattern1> in <file>, and replace with <hexpattern2>
...
@@ -64,9 +68,9 @@ Supported actions:
...
@@ -64,9 +68,9 @@ Supported actions:
extract [ENTRY OUT]
extract [ENTRY OUT]
Extract ENTRY to OUT, or extract all entries to current directory
Extract ENTRY to OUT, or extract all entries to current directory
test
test
Test the current cpio's patch status
Test the current cpio's status
Return values:
Return value is 0 or bitwise or-ed of following values:
This binary will replace `init` in the ramdisk of a Magisk patched boot image. It is originally created for supporting devices using system-as-root, but the tool is extended to support all devices and became a crucial part of Magisk. More details can be found in the **Pre-Init** section in [Magisk Booting Process](details.md#magisk-booting-process).
This binary will replace `init` in the ramdisk of a Magisk patched boot image. It is originally created for supporting devices using system-as-root, but the tool is extended to support all devices and became a crucial part of Magisk. More details can be found in the **Pre-Init** section in [Magisk Booting Process](details.md#magisk-booting-process).
### magiskpolicy
### magiskpolicy
(This tool is aliased to `supolicy` for compatibility with SuperSU's sepolicy tool)
(This tool is aliased to `supolicy` for compatibility with SuperSU's sepolicy tool)
An applet of `magiskinit`. This tool could be used for advanced developers to modify SELinux policies. In common scenarios like Linux server admins, they would directly modify the SELinux policy sources (`*.te`) and recompile the `sepolicy` binary, but here on Android we directly patch the binary file (or runtime policies).
An applet of `magiskinit`. This tool could be used for advanced developers to modify SELinux policies. In common scenarios like Linux server admins, they would directly modify the SELinux policy sources (`*.te`) and recompile the `sepolicy` binary, but here on Android we directly patch the binary file (or runtime policies).
...
@@ -119,23 +125,23 @@ An applet of `magiskinit`. This tool could be used for advanced developers to mo
...
@@ -119,23 +125,23 @@ An applet of `magiskinit`. This tool could be used for advanced developers to mo
All processes spawned from the Magisk daemon, including root shells and all its forks, are running in the context `u:r:magisk:s0`. The rule used on all Magisk installed systems can be viewed as stock `sepolicy` with these patches: `magiskpolicy --magisk 'allow magisk * * *'`.
All processes spawned from the Magisk daemon, including root shells and all its forks, are running in the context `u:r:magisk:s0`. The rule used on all Magisk installed systems can be viewed as stock `sepolicy` with these patches: `magiskpolicy --magisk 'allow magisk * * *'`.
--load-split load from precompiled sepolicy or compile
--load-split load from precompiled sepolicy or compile
split policies
split cil policies
--compile-split compile split cil policies
--compile-split compile split cil policies
--save FILE save policies to FILE
--save FILE dump monolithic sepolicy to FILE
--live directly apply sepolicy live
--live immediately load sepolicy into the kernel
--magisk inject built-in rules for a minimal
--magisk apply built-in Magisk sepolicy rules
Magisk selinux environment
--apply FILE apply rules from FILE, read and parsed
--apply FILE apply rules from FILE, read and parsed
line by line as policy statements
line by line as policy statements
(multiple --apply are allowed)
If neither --load or --compile-split is specified, it will load
If neither --load, --load-split, nor --compile-split is specified,
from current live policies (/sys/fs/selinux/policy)
it will load from current live policies (/sys/fs/selinux/policy)
One policy statement should be treated as one parameter;
One policy statement should be treated as one parameter;
this means each policy statement should be enclosed in quotes.
this means each policy statement should be enclosed in quotes.
...
@@ -189,8 +195,8 @@ Supported policy statements:
...
@@ -189,8 +195,8 @@ Supported policy statements:
"genfscon fs_name partial_path fs_context"
"genfscon fs_name partial_path fs_context"
```
```
### magisk
### magisk
When the magisk binary is called with the name `magisk`, it works as a utility tool with many helper functions and the entry points for several Magisk services.
When the magisk binary is called with the name `magisk`, it works as a utility tool with many helper functions and the entry points for several Magisk services.
An applet of `magisk`, the MagiskSU entry point. Good old `su` command.
An applet of `magisk`, the MagiskSU entry point. Good old `su` command.
```
```
...
@@ -243,6 +263,7 @@ Options:
...
@@ -243,6 +263,7 @@ Options:
Note: even though the `-Z, --context` option is not listed above, the option still exists for CLI compatibility with apps designed for SuperSU. However the option is silently ignored since it's no longer relevant.
Note: even though the `-Z, --context` option is not listed above, the option still exists for CLI compatibility with apps designed for SuperSU. However the option is silently ignored since it's no longer relevant.
### resetprop
### resetprop
An applet of `magisk`. An advanced system property manipulation utility. Check the [Resetprop Details](details.md#resetprop) for more background information.
An applet of `magisk`. An advanced system property manipulation utility. Check the [Resetprop Details](details.md#resetprop) for more background information.
```
```
...
@@ -263,20 +284,3 @@ Flags:
...
@@ -263,20 +284,3 @@ Flags:
-p read/write props from/to persistent storage
-p read/write props from/to persistent storage
(this flag only affects getprop and delprop)
(this flag only affects getprop and delprop)
```
```
### magiskhide
An applet of `magisk`, the CLI to control MagiskHide. Use this tool to communicate with the daemon to change MagiskHide settings.