Skip to content

Instantly share code, notes, and snippets.

@Starmania
Last active January 4, 2026 15:18
Show Gist options
  • Select an option

  • Save Starmania/32520c56792e4f596cb7d51cab076f67 to your computer and use it in GitHub Desktop.

Select an option

Save Starmania/32520c56792e4f596cb7d51cab076f67 to your computer and use it in GitHub Desktop.

Preface

Genymotion recently moved root access behind a paywall, making it a premium feature. However, if you're using Genymotion for Android development, testing, or educational purposes, having root access can be essential. Root access allows developers to access deeper functionality, test root-only features, and explore Android's internals without restrictions.

The good news is that with a bit of work, you can still enable root on a Genymotion emulator if you have access to its disk image and platform keys. This guide walks you through the process of adding a custom system app, RootToggle, which will allow you to switch root access on and off without needing Genymotion's paid root access feature.

This Gist details the steps to compile, sign, and install RootToggle as a system app in a Genymotion emulator by directly modifying the emulator's disk image IN LINUX (use a virtual machine on Windows to do that).


Contents

  • RootToggle-signed.apk — Ready-to-use signed APK
  • RootToggle.zip — Source code (optional, for self-compilation)
  • This guide

Prerequisites

  • Linux environment (use a VM on Windows/macOS)
  • qemu-utils — for qemu-nbd (sudo apt install qemu-utils)
  • Android SDK Build Tools — only needed if compiling the APK yourself

Note

Does this work in WSL? I haven't tested it. If you try, please let me know in the comments!


1. (Optional) Compile the RootToggle App Yourself

If you prefer to compile the RootToggle app yourself, follow these steps:

  1. Get the source: Download source.zip

  2. Build the APK: Open the project in Android Studio and build the APK, or use the Gradle command line.

    ./gradlew assembleRelease
  3. Locate the Unsigned APK: After building, the unsigned APK will be in the app/build/outputs/apk/release directory.

2. Get the Platform Keys

You will need platform.pk8 and platform.x509.pem keys for the emulator from this official repo here. If for some reason this repo doesn't exist anymore, you could get it here.

git clone https://github.com/Genymobile/genymotion_platform_vendor_genymotion_security_public
cp genymotion_platform_vendor_genymotion_security_public/release-keys/platform* .

3. Sign the APK with Platform Keys

Run the following command to sign the APK:

/path/to/build-tools/<version>/apksigner sign \
  --key platform.pk8 \
  --cert platform.x509.pem \
  --out RootToggle-signed.apk \
  app/build/outputs/apk/release/app-release-unsigned.apk

The signed APK is now ready to be installed as a system app.

4. Install RootToggle as a System App

Using QEMU and qemu-nbd, we’ll add the signed APK to the Genymotion emulator’s system partition.

Warning

Make sure the Genymotion emulator is completely stopped before modifying the disk image. Editing while running can corrupt the image.

Step-by-Step Commands

  1. Load the NBD (Network Block Device) Module:

    sudo modprobe nbd
  2. Attach the QCOW2 Disk Image:

    sudo qemu-nbd --connect=/dev/nbd0 ~/.Genymobile/Genymotion/deployed/<device_name>/system.qcow2

    [!NOTE] The path may vary depending on your setup:

    • Deployed VMs: ~/.Genymobile/Genymotion/deployed/<device_name>/system.qcow2
    • System images: ~/.Genymobile/Genymotion/system-images/<image_version>/<android_version>/system.qcow2

    macOS users: Copy system.qcow2 to a Linux machine to modify it. After editing, copy it back to the system-images folder (not deployed), as deployed images are regenerated from system-images.

  3. Identify the System Partition:

    Run sudo fdisk -l /dev/nbd0 to find the correct partition. Look for a partition labeled system or the largest ext4 partition (typically 2-4 GB). It's usually /dev/nbd0p4.

  4. Mount the System Partition:

    sudo mkdir -p /mnt/android_system
    sudo mount /dev/nbd0p4 /mnt/android_system
  5. Create the App Directory:

    sudo mkdir -p /mnt/android_system/system/priv-app/RootToggle
  6. Copy the Signed APK:

    sudo cp RootToggle-signed.apk /mnt/android_system/system/priv-app/RootToggle/RootToggle.apk
  7. Set the Correct Permissions:

    sudo chmod 644 /mnt/android_system/system/priv-app/RootToggle/RootToggle.apk
  8. Unmount and Disconnect:

    sudo umount /mnt/android_system
    sudo qemu-nbd --disconnect /dev/nbd0

Tip

If mounting fails or you encounter errors, make sure to disconnect nbd first:

sudo qemu-nbd --disconnect /dev/nbd0

5. Start the Emulator

Start your Genymotion emulator as usual. The RootToggle app should now be installed as a system app with the necessary permissions to modify persist.sys.root_access.

This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

@4ft35t
Copy link

4ft35t commented Dec 30, 2025

Attach the QCOW2 Disk Image:

The qcow2 path ~/.Genymobile/Genymotion/system-images/${image_version}/${android_version}/system.qcow2

When you use Genymotion on mac, copy system.qcow2 to a linux to mod, you must copy system.qcow2 in system-images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment