Want to Root Samsung A40 SM-A405FN ? If yes then you are at right portal. In this proper guide we will guide you to Root Samsung A40 on Android Pie 9.
Here we are going to explain step by step guide to Root Samsung Galaxy A40 running on Android Pie by using Magisk. Special thanks to topjohnwu – this genius is one who discovered and maintaining Magisk. We also thank XDA Developer – zavajon, for testing this method.
Although Samsung has done a great job building its new One UI software which runs on the Galaxy A40 out-of-the-box. But it still poses a lot of issues to the custom development scene.
This is primarily caused by certain security features (Like KG/RMM State, DEFEX, etc) introduced by the manufacturer. While these features are actually beneficial for an average user, but they also act as a barrier when it comes to things like rooting or install custom recoveries like TWRP.
Things to be Remembered before Proceeding
- Rooting your phone will trip Knox, and thus void your warranty as well. Tripping KNOX counter also means you will lose features like Samsung Pay and Secure folder.
- We are not responsible for any damage caused to your device during or after following this procedure.
- Take a backup first! we strongly recommend taking a full backup of all your data. While performing the instructions below, all the data on your A30 will be erased multiple times.
- In order to establish a successful connection between your phone and the PC, download the latest version of the Samsung USB drivers and Install them on your PC.
- Flashing of Boot img will be done through Odin Tool. Download the latest Odin v3.13.3 and extract the downloaded zip on your Windows PC.
How to Root Samsung Galaxy A40
Here’s a brief of the complete process: In order to root, you will first need to unlock the bootloader on your Galaxy A40 SM-A405FN.
Once that is done, you will have to extract the AP firmware file from the stock firmware package and patch boot img using the latest Magisk Manager app. Then, you have to flash the patched boot.tar through Odin AP to root Samsung Galaxy A40.
For your own convenience and understanding, we have split the instructions in this guide into four major steps
Step 1: Unlock Bootloader on Samsung A40
To Unlock Bootloader of Samsung Galaxy A40, you need to follow our detailed guide How to UNLOCK Bootloader on Samsung A40
Step 2: Get the Boot img from firmware
In order to get Boot img you have to download corresponding stock firmware for the A40 from below.
Download latest Firmware from Sammobile
Your Current OS version and Downloaded Version AP and CSC should be Same. You can use Phone Info to know your firmware version.
- Extract the downloaded firmware using 7Zip. You will get four files. Select the AP file and open with 7-zip as a archive.
- Now you will see
boot.img.lz4file. Copy the file in desktop and then to phone’s internal storage.
- Now Download & Install Zarchiver on your device. Open the copied file and extract by selecting extract-to archive option. In this step you will get boot.img
Step 3: Patch the Boot img by using Magisk
- Download and Install latest Magisk Manager Apk on your phone.
- Open Magisk Manager tap on Install> Select and patch a file. Navigate to boot.img folder and select boot.img. Magisk will start creating a new patch boot.img.
- Once the process finished, the resultant Patched (magisk_patched.img) will be present in Internal storage/download folder. Rename Patched img to boot.img
- Now in Zarchiver, convert boot.img to boot.tar by selecting compress option
Copy the file from the “Download” folder of your phone’s internal storage to a suitable location on your PC.
Step 4: Root Samsung A40 by flashing Patched AP
Power Off your phone and boot into Download Mode while holding the Volume Up and Volume Down buttons together. You shall now see the Warning prompt on the screen. Press the Volume Up button to confirm and enter Download Mode
- Launch the Odin tool by double-clicking on the “Odin3 V3.13.3.exe”
- The Odin tool will detect the phone and the “ID:COM” port will be turn to blue or highlighted.
- Click on the AP slot buttons and select the boot.tar file which was copied in Step 3.
- Now, make sure that “Auto Reboot” is unchecked in the “Options” tab of the Odin tool.
- Finally, click on the “Start” button to flash the files and root Samsung Galaxy A40
Once the flashing process finishes, you should see the “PASS!” message in Odin and your A40 should be rooted with Magisk. Wait! Do not reboot your phone into the OS yet.
It is very important to perform a factory reset via the stock recovery first and then boot your phone into the OS with Magisk, in a specific way.
Step 5: Do a Factory Reset & Reboot phone
With your Samsung Galaxy in Download Mode, follow the instructions below to boot it into the stock recovery and perform a factory reset.
- Disconnect the phone from PC. Now hold the Volume Down and Power keys together to exit Download Mode.
- Most Important: As soon as the screen turns off, quickly release buttons and hold the Volume Up and Power keys. Keep holding the buttons until you see the stock recovery screen.
- Use the Volume keys to navigate the “Wipe data/factory reset” option and press the Power button to confirm.
- Select “Yes” to confirm and factory reset your device.
- Once the process finishes, select the “Reboot system now” option in stock recovery
Your Samsung phone will start booting and bootloader unlocked warning appears. Press Power button to continue the process and complete the initial set up. Install Magisk Manager APK again launch the application. Magisk will ask to complete Additional Setup which can take 3 to 4 minutes.
If anything goes wrong during or after process complition then you will need to restore the stock firmware and also perform a factory reset further to recover your phone. This will also erase all the data on the phone.