Not to be confused with jailbreaking on iOS devices, which is the act of using exploits to gain elevated permissions and bypass Apple's security restrictions on their devices.
Now, let's learn how to sideload and debug an application on your KaiOS phone using ADB and WebIDE. This will let us install apps which might be not available from KaiStore, or ones that you are developing.
ADB, short for Android Debug Bridge, is a powerful toolset that can be used on Android-based devices to unlock access to a range of functions beyond what the typical user interface provides. It's mainly designed for app developers to get access to system logs and debug the performance of their apps, but it's also a great tools for power users and enthusiasts to control their phones through shell access, install third-party APKs, tweak the system and restore it from being a dead paperweight.
While KaiOS and Firefox OS are not directly based on Android and you cannot install APKs on them, their Gonk layer makes significant use of Android's well-established hardware compatibility, including the ability to use ADB to interact with the phone through a computer. This is for the sake of deploying the OS onto different hardware without raising the cost for development.
Meanwhile, WebIDE, short for Web Integrated Development Environment, allows you to create, edit, run and debug web applications on Firefox OS (and later KaiOS) devices and simulators. It's built on the former Firefox OS App Manager but with additional functions such as a code editor, boilerplate code templates and manifest validation, and includes Firefox debugging tools. With it, you can also connect your browser to one or multiple "runtimes" where you can manage app installation.
We'll refer to this guide as the main, officially supported method of installing third-party apps onto your KaiOS phone, for the sake of simplicity. Other methods, such as Luxferre's CLI gdeploy
, are also available.
This guide is only applicable on debug-enabled KaiOS 2.5 devices, and is no longer relevant for recent versions. In 2021, Mozilla partnered with KaiOS Technologies to "modernize the old Boot2Gecko codebase to run atop a modern Gecko so that it can be used by KaiOS as a basis for their future phones", and redesigned WebIDE in the process (currently included in Firefox Developer Edition).
For debug-enabled KaiOS 3 devices, follow the instructions for KaiOS’s
appscmd
on the official Developer Portal.Before proceeding, make sure that your phone is debug-enabled, or you have taken steps to enable debugging capability on your phone. To check if your phone is debug-enabled, go to Devices page on BananaHackers Wiki.
Be careful when installing apps from unknown sources; it's never a bad practice to proof-read their source code. While there are certain security practices, such as prohibiting installing apps with
engmode-extension
permission, KaiOS is still prone to malicious code which can result in performance degradation, data loss or worse.
gdeploy
or build one of the browsers below from sourcechoco install adb
scoop install main/adb
winget
prohibits installing executables with symlinksbrew install android-platform-tools
sudo apt-get install adb
sudo dnf install android-tools
sudo pacman -S android-tools
pkg install android-tools
Need a video tutorial? If you’re on Linux, KaiOS Technologies officially made one for their own WebIDE client KaiOSRT which can be found on their channel. Alternatively, there’s also one on BananaHackers’ YouTube channel.
Begin by turning on debugging mode on your phone and connecting your phone to the computer with the USB cable. This step will differ for each device; if you're unsure, it's best to look up your phone on the Devices page on BananaHackers Wiki.
On your computer, install ADB from the package manager, or download the SDK Platform Tools from Android Developers' website, which should contain the latest version of ADB. Extract the downloaded archive to a folder, then navigate to the platform-tools
folder using Command Prompt or Terminal.
Start the ADB daemon by typing adb devices
. ADB will automatically detect your phone in debugging mode. Proceed when you see a device
, otherwise:
adb
is not a valid command, check if you're in the right folder and/or if platform-tools
was properly added in PATH. You may need to specify ./adb.exe devices
to tell the OS where to look for ADB, or make ADB an executable: chmod +x adb
.devmgmt.msc
) and look for any USB peripherals with missing drivers, and install accordingly.udev
to properly register your phone as an USB peripheral with external storage. An icon in the status bar will appear indicating storage access via USB. (If you don't wish to do this, see Setting up USB access on Linux below.)udev
and lsusb
are your friends to troubleshoot any USB connection issues hereunauthorized
, it means that you need to approve the ADB connection to your phone with a pop-up on your phone's screen. Except... KaiOS does not have such thing! You're pretty much stuck here until someone figures out how to get your phone accessible by ADB.$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
1a2b3c4d device
I was not able to get this to work. Proceed with caution.
If you are in a rush and wish to connect to your phone wirelessly, turn on Wi-Fi on your phone, set the TCP/IP socket on the phone to 5555:
$ adb tcpip 5555
restarting in TCP mode port: 5555
Disconnect the USB cable, wait a moment, then run:
$ adb connect 192.168.1.14:5555
connected to 192.168.1.14:5555
$ adb devices
List of devices attached
192.168.1.14:5555 device
$ adb forward tcp:6000 localfilesystem:/data/local/debugger-socket
6000
Replace 192.168.1.14
with your phone's IP address assigned by local network—the same network your computer is on.
You can find your phone's local IP address (192.168.1.x) by going to Settings, Network & Connectivity, Wi-Fi, Available networks, click on the connected Wi-Fi access point and look under IP address; or download N4NO’s My IP Address from KaiStore.
It's also possible to connect to your phone entirely without an USB cable, though the connection will be less reliable. See Connect to ADB wirelessly on Launch hidden settings page for more details.
Download and install either the latest version of Waterfox Classic, Firefox 59/ESR 52.9 or Pale Moon 28.6.1 corresponding to your operating system. We'll use Waterfox Classic for WebIDE here, as this is the most recently maintained browser to-date, but setting up WebIDE on other browsers should not be different.
Open the browser and press Alt to show the menu bar, then select Tools, Web Developer, WebIDE (or press Shift + F8).
Tip: Execute this command to open WebIDE without having to start Waterfox Classic beforehand:
waterfox.exe -chrome chrome://webide/content/webide.xul
Your phone’s name should appear in the right pane as an option under USB Devices. Click it to connect.
If you don't see any devices, either because you're setting up WebIDE for the first time, or your browser doesn't have a working adbd
daemon, forward ADB access to TCP socket 6000:
$ adb forward tcp:6000 localfilesystem:/data/local/debugger-socket
6000
Then, click Remote Runtime in the right pane, leave it as default at localhost:6000
and press OK. If you still see a yellow banner stating "Operation failed: Connecting to Remote Runtime", either you set the incorrect socket or your phone rejected DevTools access.
If you’re using older browsers to access WebIDE such as Firefox v59 or Pale Moon <28.6.1, at this point you may see a warning header about mismatched build date. You can safely ignore it as WebIDE was mainly designed to support Firefox OS device builds released alongside that Firefox/Pale Moon versions.
To sideload an application, download a packaged file (you can find great apps on BananaHackers Store and GitHub!) and extract it into a dedicated folder. Make sure that there's a manifest.webapp
at the root of the extracted folder. If you see an application.zip
(which indicates the app was packaged for OmniSD), unzip it.
In WebIDE, select Open Packaged App in its left sidebar and navigate to the root of the app folder you just extracted (again, make sure that there's a manifest.webapp
at its root!)
Once you get the app loaded with no errors, press the triangle Install and Run in the top bar to sideload.
Feel free to ignore this warning: "app submission to the Marketplace requires a [size in px] icon". if you were to upload your apps to the Firefox Marketplace, a 128px icon is required to display your app in the splash screen. While KaiStore also requires app icons to be in certain sizes, a 128px icon is no longer necessary, only 56px and 112px. You can get rid of this error by including a 128px icon in the app's manifest.
Dedicated to those adrenaline-fueled who want to complicate their lives.
For security reasons, if you want to plug in your phone for debugging only and without USB Storage on, which would grant your computer access to the phone's internal storage, you will need to set udev
rules to grant plugdev
read-write access to the socket on your phone.
Initialise udev
rules by installing android-sdk-platform-tools-common
on Debian and Ubuntu, or android-tools
(android-tools-git
on AUR) on Arch-based distros. Otherwise, you can also install wget
and coreutils
if they're not already installed, then manually download and install 51-android.rules
by typing:
$ wget -S -O - https://raw.githubusercontent.com/cm-b2g/B2G/1230463/tools/51-android.rules | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
wget
will fetch a list of udev
rules from cm-b2g/B2G, then pass the result to tee
which will write the content onto /etc/udev/rules.d/51-android.rules
without displaying any output in Terminal, and udevadm
will then reload the rules from configured locations.
Plug your phone to the computer using an USB cable and obtain the Vendor ID of the phone:
$ lsusb
Bus 001 Device 007: ID 05c6:f003 Qualcomm, Inc. Nokia 8110 4G
^^^^
In our case, the Qualcomm-based Nokia 8110 4G has the Vendor ID of 05c6
.
Open /etc/udev/rules.d/51-android.rules
in your preferred text editor with root privileges. Append this line, replace 05c6
with the Vendor ID you got above:
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0664", GROUP="plugdev"
This will allow read-write access to the USB device with vendor ID 05c6
for the system and users in the plugdev
group, and read-only access for others (rw-rw-r--
). Add yourself in the plugdev
group:
# usermod -aG plugdev $LOGNAME
Execute this command as root to make 51-android.rules
read-only for all users on the system:
# chmod a+r /etc/udev/rules.d/51-android.rules
Now, create ~/.android/adb_usb.ini
in your HOME directory. Open it using your preferred text editor and put the obtained Vendor ID value in HEX: 0xABCD
, whereas ABCD
is Vendor ID.
$ echo "0x05c6" > ~/.android/adb_usb.ini
Finally, re-run adb devices
.
References used for this page