# Temporary Unroot for Magisk/Magisk 暫時把 Root 取消
<a href="#chinese-ver">看中文</a>
Table of Contents:
[toc]
## Introduction
As an advanced user, a geek, and a hacker, from time to time, we face the problem: the app refuse to work for a rooted phone. Maybe Google just patched the holes to bypass Integrity Check in Google Play Service, or maybe the bank just found some abnormal environment traits. Sometimes, with the wall built with [MagiskHidePropsConf]( https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf ), Play Integrity Fix, [Hide My AppList]( https://github.com/Dr-TSNG/Hide-My-Applist ) and so, the modifications seems well-hidden, but the bank app can always find a hint that you've rooted your phone. Admit it, we just can't hide them all. Admit it, we may not always be with our unrooted phone for backup. Admit it, there's always some situation that we must run the app. That's why we need to temporary unroot the phone.
(TL;DR) This tutorial provides a way to quickly (in ~5 minutes) unroot the phone (to some extent) rooted with Magisk, while making it possible to recover your root permission after that. You can do them all **without a computer.**
## Prerequisite
- [Magisk]( https://github.com/topjohnwu/Magisk ) (Mine is v29.0): You should enable MagiskHide to install Magisk Manager app with a randomized package name.
- [Termux]( https://github.com/termux/termux-app ) (Mine is v0.119.1)
## Steps to Unroot
1. **Disable Zygisk.** Open your Magisk manager -> Settings. In the Magisk section, disable Zygisk. This is to reduce Magisk's modification to the system.
2. **Ungrant root permission for autostart apps.** (Suggested but Optional) This is to eliminate hints of root.
3. **Disable Magisk Modules.** You can either manually turn them off in Magisk manager -> "Module" tab, or check "Safe mode" before reboot.
4. **Reboot your phone**. If you use the reboot button in Magisk manager, you may see a "Safe mode" check box there. Check it if you need. Now, wait till it boots again.
5. **Open Termux.** After the reboot, magisk still works, but most modifications are revertable. We need to use commands to revert them.
6. **Type `su` to enter superuser shell.** We need that shell to gain access to the `magisk` command. (If you have `sudo/ksu` installed, you can run the following command with a `sudo` prefix.)
7. **Stop Magisk with `magisk --stop`.** This is a command documented in `magisk --help`, and ends the magisk process totally. Now, you should've successfully unrooted your phone (temporarily, to some extent).
If you've done everything above, nothing should crash. If you see some complaints about process keeping stopping, there's a high chance that some module is not disabled, and a low chance of some apps requiring root permission stopped.
## Steps to Recover
1. **Reboot your phone.** Before that, open Magisk manager leads to an error. After that, you should find Magisk manager works again.
2. **Re-enable the modules.**
3. **Regrant root permission for autostart apps,** if you ever need to.
4. **Re-enable Zygisk.** Some of your modules may require this to hide Magisk better.
5. **Reboot you phone** to apply your magisk modules.
## Results
After unrooting, apps that refuses to work may now work again, including: 凱基銀行, 行動郵局, 台灣行動支付, NHI Express, 全家便利商店. There are still some apps refuses to work, including 文化幣. Also, only Basic Integrity of Play Service is restored. Please notice, **this is not a full unroot, so don't expect all the app to run.**
<a id="chinese-ver"></a>
## 簡介
身為進階使用者、科技迷和黑客,我們不時會遇到程式發現 Root 後,拒絕執行的問題。也許 Google 剛剛修補了繞過 Google Play 服務中,用來繞過 Play Integrity 檢查的漏洞,或者銀行 App 發現了一些環境異常。有時候,儘管透過 [MagiskHidePropsConf](https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf)、Play Integrity Fix、[Hide My AppList](https://github.com/Dr-TSNG/Hide-My-Applist) 等工具嚴密地隱藏了修改,但銀行應用程式總能找到手機已 Root 的蛛絲馬跡。承認吧,我們無法隱藏所有東西。承認吧,我們偶爾會忘了帶沒 Root 的備用手機。承認吧,總是有時候,我們必須要用這些程式。這就是我們需要暫時取消手機的 Root 的原因。
(簡而言之)本教學提供了一種快速(約 5 分鐘內)暫時取消 Magisk 的 Root 權限的方法(到某種程度),同時之後也能恢復你的 Root 權限。重點是,這個操作**無需電腦**。
---
## 前提條件
* **Magisk**(我的版本是 v29.0):你應該啟用 MagiskHide,以使用亂數安裝包名來重新安裝 Magisk Manager 應用程式。
* **Termux**(我的版本是 v0.119.1)
---
## 如何取消 Root
1. **停用 Zygisk**。打開你的 Magisk Manager -> 設定,並在 Magisk 一節停用 Zygisk。這是為了減少 Magisk 對系統的修改。
2. **取消自動啟動應用程式的 Root 權限。**(建議但非強制)這是為了消除 Root 的痕跡。
3. **停用 Magisk 模組**。你可以手動在 Magisk Manager ->「模組」選項卡中關閉它們,或者在重新啟動前勾選「安全模式」。
4. **重新啟動手機。** 如果你使用 Magisk Manager 中的重新啟動按鈕,你可能會看到一個「安全模式」核取方塊。如果需要,請勾選它。現在,等待手機重新啟動。
5. **打開 Termux**。重新啟動後,Magisk 仍然會運行,但它做得大多數修改都可取消,我們需要使用命令行指令來復原他們。
6. **輸入 `su` 進入超級使用者 Shell。** 我們需要這個 Shell 來存取 `magisk` 命令。(如果你有裝 `sudo/ksu`,你可以改成在以下命令前加上 `sudo`)
7. **使用 `magisk --stop` 停止 Magisk**。這是 `magisk --help` 中記載的一個命令,它會完全終止 Magisk 進程。現在,你應該已經成功地暫時取消了手機的 Root(在一定程度上)。
如果你已經完成了以上所有步驟,應該不會有任何程式崩潰。如果你看到一些關於程序一直停止的抱怨,很有可能是某些模組未被禁用,但也有小概率是要求 Root 權限的程式出錯了。
## 如何恢復 Root 權限
1. **重新啟動手機**。在此之前,打開 Magisk Manager 會導致錯誤。之後,你應該會發現 Magisk Manager 再次正常運作。
2. **重新啟用模組**。
3. **重新授予自動啟動應用程式的 Root 權限**。如果有需要再做。
4. **重新啟用 Zygisk**,有些模組可能需要它,來更好地隱藏 Magisk。
5. **重新啟動手機**來讓你的 Magisk 模組發揮功能。
---
## 結果
取消 Root 後,之前拒絕啟動的應用程式,現在可能就能用了。包括:凱基銀行、行動郵局、台灣行動支付、健保快易通、全家便利商店。但仍然有一些應用程式拒絕運作,包括文化幣。此外,Play Integrity 只有 Basic 等級恢復,其他沒用。請注意,**這方法沒有徹底地把 root 移除,所以不要期待所有程式都正常運行!**