Why does XMRig crash on Termux?
XMRig usually crashes in Termux because Android runs out of available memory, stops the app in the background, or cannot run the particular XMRig build you installed. The last message you see—and whether only XMRig stops or the whole Termux session disappears—helps you tell these causes apart.
Check what actually stopped
Termux gives you a Linux-style command line on Android. XMRig is a mining program you run inside it, not a browser miner.
Run XMRig directly in an open Termux window and watch the final lines:
- “Killed” or signal 9: Android may have ended the process because of memory pressure or background-process limits. This message alone does not prove which.
- “Illegal instruction”: The program tried to use a processor instruction your device does not support.
- “Segmentation fault”: The program accessed memory incorrectly. An incompatible build or software bug is more likely than a wallet problem.
- A frozen or closed Termux session: Check Android’s app management, available memory, and device temperature.
A pool connection error is different: XMRig may still be running but unable to reach the service that coordinates mining.
Memory is often the main problem
Monero uses RandomX, a mining algorithm designed to favor CPUs—the main processors in your devices.
RandomX’s fast mode needs a roughly 2,080 MB dataset, a large working collection of data. Its cache and other program needs add more memory use. Android and your other apps also need RAM, the device’s short-term working memory. Even a phone advertised with 4 GB of RAM may not have enough available.
For a useful test, keep your usual pool and wallet settings but start with one mining thread and light mode:
./xmrig --threads=1 --randomx-mode=light
A thread is one stream of processor work. Light mode uses a 256 MB cache instead of the large fast-mode dataset, but runs much more slowly.
If light mode works while fast mode repeatedly dies during startup, memory pressure is a strong suspect. RandomX also benefits from about 2 MB of L3 cache per thread. L3 cache is fast memory inside the processor; having less usually hurts speed rather than directly causing a crash.
Check your build and Android restrictions
Use Termux from a trusted, currently supported distribution source. Follow build instructions intended for Android and Termux, not just ordinary desktop Linux.
Your XMRig build must match your processor and Android environment. A phone with a 64-bit processor can still have a 32-bit software environment. Random binaries from videos or chat groups may be incompatible—or malicious.
If XMRig stops mainly after you switch apps or turn off the screen:
- Test with Termux visible first.
- Review Android’s battery restrictions for Termux.
- Try Termux’s wake-lock feature, which helps prevent sleep but does not override every Android process limit.
Do not root your phone or disable safety protections just to troubleshoot mining.
The bottom line
Start with one thread, light mode, and Termux in the foreground. If it still crashes, record the exact error, Android version, Termux source, and XMRig version before changing more settings.
Stop if your phone becomes unusually hot. Mining can cause heat and battery wear even when it runs reliably, and fixing a crash does not mean your phone will mine profitably.
