How to root Bluestacks 2 using Linux VM (Modify root.vdi)

After Bluestacks team released Bluestacks 2 2.3.37 without root with patched vulnerabilities, Kingroot app no longer able to root Bluestacks anymore. But thankfully, we have root.vdi, we can root it using VirtualBox. Thanks Bluestacks for introducing "VirtualBox VMs" since 2.2.17.6203

Well, let's get started!

For linux experts: If you know how to mount and modify .vdi without VirtualBox, skip to step 9.

First of all, to root BlueStacks this way you need VirtualBox and you have a Linux OS installed. If  you just got started, I'll recommended Ubuntu, you can follow the guide installing Ubuntu on BirtualBox. http://www.wikihow.com/Install-Ubuntu-on-VirtualBox

Also, you will need some linux knowledge. It's not necessessary, but I won't provide any support about the part dealing with linux commands. Just follow the instructions and probably you will be able to root it, but it might not be that simple.

The second mandatory stuff you will need is the Android App called SuperSU. At this time, you should be able to find the latest SuperSU. The instructions should be the same with other SuperSU versions.
Here is a direct link http://www.supersu.com/download

This tutorial assumes you already have an installed BlueStacks you wish to root, but make sure Bluestacks and Ubuntu isn't running. So, let's get started.

In this tutorial i'm using Ubuntu.

1. MAKE A BACKUP OF ROOT.VDI FILE FIRST!


2. To modify Root.vdi, you need to mount it in Ubuntu virtual machine. Select Ubuntu and click Settings -> Storage. Select Controller: SATA and click on the HDD with green plus symbol.


3. A dialog box will appear. Select Choose existing disk


4. Navigate to Bluestacks directory where you installed. Select Root.vdi and Open

 

ProTip: You can mount Data.vdi and SDcard.vdi to transfer files between guest and VDI.

5. Root.vdi should be added in Storage. Click OK



6. Start Ubuntu on VirtualBox

7. Ubuntu: On your desktop, you should see the grey Hard Drive icon on the right taskbar. Yep, that's root.vdi image file that has been mounted and the disk name should be named 8,6 GB Volume or 8,6 disk drive


8. Extract x86 Folder from .zip (Recovery Flashable.zip) archive file and /common/SuperSU.apk somewhere on Ubuntu. Bluestacks is based on Android x86.
8.1. If you already downloaded it on your host computer, Click Devices -> Drag and Drop, Select Bidirectional and you can transfer the file to guest

If you haven't download it yet, download it from http://www.supersu.com/download and click Recovery Flashable.zip

9. Copy the following SuperSU files into your mounted root.vdi

Add file: /x86/su -> (8,6 GB Volume)/android/system/xbin/su
Rename file: /x86/su ---> (8,6 GB Volume)/x86/daemonsu
Add file: /x86/daemonsu ---> (8,6 GB Volume)/android/system/xbin/daemonsu
Add file: /x86/supolicy ---> (8,6 GB Volume)/android/system/xbin/supolicy
Add file: /x86/libsupol.so --->  (8,6 GB Volume)/android/system/lib/libsupol.so
Add file: /common/Superuser.apk ---> (8,6 GB Volume)/android/system/app/Superuser.apk

10. You need to change file permissions in order for SuperSU to work correctly. Open terminal and type or copy the following commands. Enter your password when asked


sudo chmod 755 '/media/<your username>/<disk name>/android/system/xbin/su'
sudo chmod 755 '/media/<your username>/<disk name>/android/system/xbin/daemonsu'
sudo chmod 755 '/media/<your username>/<disk name>/android/system/xbin/supolicy'
sudo chmod 644 '/media/<your username>/<disk name>/android/system/lib/libsupol.so'
sudo chmod 644 '/media/<your username>/<disk name>/android/system/app/Superuser.apk'


If you like to copy and paste, click on Devices -> Shared Clipboard and select Bidirectional while VM is running.



Note: The disk name is always different from machine to machine. You can check it in File Manager, right click on disk name called 8,6 GB Volume or 8,6 GB disk drive and select Properties

ProTip: Drag a file on the Terminal to get the full path. Example: If you drag a file called test.txt from /folder/example, the terminal will input the file path '/folder/example/test.txt' which save your time from typing very long command
Press UP ARROW on your keyboard to show the last command you typed.

Files should be owned by root:root. No need to change it on Ubuntu.

11. Now we need to start "daemonsu" on every reboot. BlueStacks init procedure is quite simple. Seems like there is only android/system/etc/init.sh. So, open android/system/etc/init.sh in your preferred linux text-editor, go at the bottom of the file and search for:

    init|"")
             do_init
             ;;
    esac

Add this
    init|"")
             do_init
             /system/xbin/daemonsu --auto-daemon &
             ;;
    esac

I'd say we're done now! Shutdown your Virtualbox
  
12. Now you can start your BlueStacks. When it's booted, launch SuperSU via Play Store.

You will be prompted about a SuperSU update. Choose the "normal" way and after the update, restart your BlueStacks.

13. That should be it. Now your BlueStacks is rooted.
To be certain you should open your PlayStore and install your preferred RootChecker.

An additional task you might want to install apps for rooted Bluestacks, like Titanium Backup, Xposed, X-Plore as an Root File Explorer and etc. You might want to install a CatLog too!
Hope you enjoyed this tutorial
Hope you will enjoy you newly rooted BlueStacks.
Tweak your Bluestacks and share your .vdi files to everyone.

Credit goes to rumbla (mybot.run) for the original tutorial how to modify root.fs

And me iAndroHacker for this new tutorial

Comments

Popular Posts

VMOS Pro - FREE Custom ROMs without VIP | GMS, ROOT, Xposed | Android 4.4.4, 5.1.1, 7.1.2, 9.0 ROMs

List of Android Virtual Machine apps for Android devices