> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boat.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Virtualization

> Run KVM, Firecracker or the Android emulator inside a sandbox.

You can run virtual machines inside a sandbox: QEMU/KVM, Firecracker, or the Android emulator at full speed.

## Where your sandbox runs

| | Standard machines | Fallback machines |
| - | - | - |
| Hardware | Dedicated AMD Ryzen 9 9950X (Zen 5) hosts | Hetzner cloud VMs with an older AMD CPU |
| When Boat uses them | Normally | When the standard machines are temporarily out of capacity. Boat uses them instead of a queue. |
| `/dev/kvm` | Yes. The CPU virtualization extensions are passed through. | No |
| Price | Same | Same |
| CPU-heavy work | Normal speed | Slower, about 3x on our [build benchmark](/pricing#performance) |

Internally, we call the standard machines "baremetal". Your sandbox is still a full virtual machine with its own kernel. It is not a bare-metal server.

If you need KVM and `/dev/kvm` is missing, create a new sandbox a bit later.

## Check for KVM

Do this check before you rely on KVM:

```bash theme={null}
ls /dev/kvm && echo "KVM available"
```

## Run the Android emulator

This script runs a headless Android emulator. We tested it on a `large` sandbox.

* The install takes about one minute.
* Android 14 then boots in 20 to 30 seconds.
* The emulator needs about 3 GB of RAM. Use `default` or bigger.

```bash theme={null}
sudo apt-get install -y openjdk-17-jre-headless
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 ANDROID_HOME=$HOME/android
mkdir -p $ANDROID_HOME/cmdline-tools && cd /tmp
curl -fsSLo clt.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q clt.zip -d $ANDROID_HOME/cmdline-tools && mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest
SDK=$ANDROID_HOME/cmdline-tools/latest/bin
yes | $SDK/sdkmanager --licenses >/dev/null
$SDK/sdkmanager "platform-tools" "emulator" "system-images;android-34;google_apis;x86_64"
echo no | $SDK/avdmanager create avd -n phone -k "system-images;android-34;google_apis;x86_64" -d pixel_6
if [ ! -e /dev/kvm ]; then
  echo "No KVM on this sandbox: the Android emulator cannot start here." >&2
else
  $ANDROID_HOME/emulator/emulator -avd phone -no-window -no-audio -gpu swiftshader_indirect &
  $ANDROID_HOME/platform-tools/adb wait-for-device
fi
```

To take a screenshot, run `adb exec-out screencap -p > screen.png`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.