Preflight checks, screenshots and screen recording for the Vega Virtual Device (the Fire TV / Vega OS emulator) on Linux.
When the virtual device cannot boot, vega virtual-device start waits and prints only:
Deadline reached (120s) but virtual device unresponsive.
The cause is somewhere else. Two real cases from one machine:
vvd/instances/<id>/virtual_device.errsaidqemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file. Fix:sudo apt-get install -y libpulse0.- After a WSL restart,
XDG_RUNTIME_DIRpointed at/run/user/1000/, which no longer existed. The emulator died withlibc++abi: terminating due to uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in create_directories: Permission denied ["/run/user/1000"], andvegaagain reported only the deadline.
The same timeout hides other host problems, such as a user who cannot open /dev/kvm.
There is also no screenshot or screen-record command. Grabbing the emulator window with an X11 tool misses video, because video is drawn on a separate plane under the UI. The emulator console on port 5554 can capture the composed screen, video included, but you have to open a TCP session, authenticate with a token and type screenrecord commands by hand.
vvd-kit runs the checks in a few seconds, prints the fix command for each problem, and wraps the console capture commands.
Taken with vvd-kit shot. The video frame is in the capture. (Video: Big Buck Bunny, Blender Foundation, CC BY 3.0.)
Needs Node.js 20 or newer. No dependencies.
npx github:itssaharsh/vvd-kit doctoror from a clone:
git clone https://github.com/itssaharsh/vvd-kit
cd vvd-kit
node bin/vvd-kit.js doctorvvd-kit doctor [--json] check that this host can run the virtual device
vvd-kit shot [file.png] save a screenshot (default ./vvd-shot-<time>.png)
vvd-kit record start <file.webm> start recording the screen
[--fps N] [--bit-rate 6M] [--time-limit S] [--size WxH]
vvd-kit record stop stop recording and wait for the file
vvd-kit console "<command>" send one console command and print the reply
Options:
| Option | Default | Env |
|---|---|---|
--host <addr> |
127.0.0.1 |
VVD_CONSOLE_HOST |
--port <n> |
5554 |
VVD_CONSOLE_PORT |
--token-file <path> |
~/.emulator_console_auth_token |
VVD_CONSOLE_TOKEN_FILE |
--timeout <s> |
10 |
|
--vvd-dir <path> |
found from the active SDK | VVD_DIR |
--display <id> (shot) |
0 |
doctor exits with 1 when a blocking check fails, so it can gate a script or CI job. --json prints the same results as JSON.
Examples:
vvd-kit shot docs/home.png
vvd-kit record start demo.webm --fps 30 --bit-rate 6M --time-limit 60
vvd-kit record stop
vvd-kit console "help screenrecord"Real output from the machine vvd-kit was built on, with the device running:
✔ Vega CLI ~/vega/bin/vega (CLI 1.4.5, SDK 0.24.12112)
✔ VVD install ~/vega/sdk/vega-sdk/main/0.24.12112/vvd (1 instance; via active SDK)
bin/virtualdevice -> <sdk>/packages/KeplerCLIKVDI/KeplerCLIKVDI-2.0.4800.0/AL2_x86_64/DEV.STD.PTHREAD/build/bin/virtualdevice
✔ KVM /dev/kvm is read/write for saharsh (member of kvm)
✔ Host libraries no missing libraries (virtualdevice, emulator, qemu-system-x86_64, libqxcb.so)
✔ WSL2 / WSLg WSL2 (6.6.87.2-microsoft-standard-WSL2) with a WSLg display (DISPLAY=:0, WAYLAND_DISPLAY=wayland-0)
Vega docs call WSL2 untested; it works with /dev/kvm exposed and WSLg for the window
✔ XDG_RUNTIME_DIR /mnt/wslg/runtime-dir exists and is writable
✔ CPU cores host has 16; 46e112f5: hw.cpu.ncore = 8 (emulator used 6, its maximum)
this emulator build caps the guest at 6 cores (from virtual_device.err)
✔ Virtual device running (qemu pid 26956)
✔ Console 127.0.0.1:5554 reachable, auth OK (token ~/.emulator_console_auth_token)
✔ Last boot log no errors in virtual_device.err of 46e112f5 (2026-10-21 17:51)
10 ok, 0 warnings, 0 failed
The same machine, from a shell that still had the stale XDG_RUNTIME_DIR (exit code 1):
✖ XDG_RUNTIME_DIR /run/user/1000/ does not exist; the emulator aborts at start (filesystem_error in create_directories) and vega only reports the deadline
seen on WSL2 after a WSL restart, when /run/user/<uid> was not recreated
fix: export XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir # WSLg's runtime dir, has wayland-0 and pulse; then start the device again
A host without libpulse and without KVM access (from the test fixtures) gets:
✖ KVM /dev/kvm is not read/write for dev (group kvm, mode 660); boot will time out
fix: sudo usermod -aG kvm $USER # then log out and back in
fix: sudo chmod 666 /dev/kvm # quick fix, resets on reboot
✖ Host libraries missing: libpulse.so.0; the device will not boot
libpulse.so.0 needed by qemu-system-x86_64
fix: sudo apt-get install -y libpulse0
| Check | Catches | Fix it prints |
|---|---|---|
| Vega CLI | vega missing, broken, or not on PATH. Shows CLI and active SDK versions. |
source ~/vega/env |
| VVD install | No VVD directory for the active SDK, or bin/virtualdevice is a broken symlink. |
reinstall the SDK, or point --vvd-dir at it |
| KVM | No /dev/kvm; /dev/kvm not read/write; added to the kvm group but the session predates it; WSL1. |
sudo usermod -aG kvm $USER and re-login, or sudo chmod 666 /dev/kvm; on WSL2, nestedVirtualization=true in .wslconfig |
| Host libraries | Runs ldd on virtualdevice, the emulator launcher, qemu-system-x86_64 and the Qt xcb plugin, with the emulator's bundled library directories on LD_LIBRARY_PATH, so only host libraries that are really missing are reported. About 50 libraries are mapped to Ubuntu packages, with the 24.04 t64 names where they changed. |
sudo apt-get install -y libpulse0 ... |
| WSL2 / Display | WSL2 (kernel release contains microsoft) with or without WSLg; no DISPLAY/WAYLAND_DISPLAY on plain Linux. |
export DISPLAY=:0, or wsl --update for WSLg |
| XDG_RUNTIME_DIR | Set to a directory that is missing or not writable. The emulator crashes in create_directories and vega reports only the deadline. |
on WSLg, export XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir; otherwise create the directory with mode 700, or unset the variable |
| CPU cores | hw.cpu.ncore in an instance's config.ini below 6 (or the host's core count, if lower). The emulator in SDK 0.24 caps the guest at 6 cores, so 8 gets you 6. Also shows what the emulator actually used (hardware-qemu.ini). |
hw.cpu.ncore = 6 line for config.ini |
| Virtual device | Reads vega virtual-device status and reports whether the device is running and its qemu pid. |
vega virtual-device start |
| Console | Port 5554 not answering while the device runs, token file missing, or token rejected. Suggests the console port from the instance metadata if it differs. | --port, --token-file |
| Last boot log | Error lines in the newest instance's virtual_device.err, with known noise filtered out (GL validation spam, crashpad elf_dynamic_array_reader ... tag not found and cpufreq lines). Missing shared libraries, uncaught exceptions, KVM and display errors are kept, and the known ones get a fix. |
depends on the error |
The Vega Virtual Device runs an Android-emulator-based build that exposes the standard emulator console on 127.0.0.1:5554. vvd-kit reads each reply up to its terminator line instead of sleeping and hoping: OK ends a successful reply, and KO: <message> (or KO <message> for a few commands) ends a failed one. Behaviour checked against the live console of SDK 0.24.12112:
- The banner asks for
auth <token>and ends withOK; it can arrive in more than one TCP packet. screenrecord stopwith nothing recording repliesOK: recording is already stopped.and thenOK. A client that stops at the firstOK...line leaves the secondOKbehind and misreads the next reply. vvd-kit treatsOK: <text>as a status line and waits for the plainOK.screenrecord screenshot <dir>writesScreenshot_<unix seconds>.pnginto<dir>. If<dir>does not exist, it still repliesOKand writes nothing. vvd-kit creates a fresh directory next to the target, checks that a PNG appeared, and moves it to the name you asked for.- Relative paths are resolved against the emulator's working directory (wherever
vega virtual-device startwas run), not yours. vvd-kit always sends absolute paths. - A path with a space is split into two arguments (
KO: Must specify output file), so vvd-kit refuses those paths up front. screenrecord startonly writes WebM (KO: file must have a .webm extension). vvd-kit adds.webmif you leave the extension off. A 5 s recording at--fps 30 --bit-rate 6Mcame out as a 3.0 MB 1920x1080 VP9 + Vorbis file. The file grows while recording and is finished on stop.--time-limitis 1 to 180 seconds (default 180),--fps1 to 60 (default 24),--bit-ratein bits per second or with anMsuffix (default 4M). vvd-kit checks these ranges before sending the command.hw.cpu.ncore = 8inconfig.inibecomes 6 at boot: the emulator logsEmualtor does not support more than 6 cores. Number of cores set to 6. 6 was enough to stop video stutter on our machine.
If you connect to a console on another host with --host, screenshots and recordings are written on that host.
npm testThe tests use node:test only. The console client runs against a fake TCP console that replays the live banner and replies (auth OK/KO, multi-line output, the double OK from screenrecord stop, dropped connections, byte-by-byte delivery, no reply). Each doctor check runs against in-memory fixture hosts: missing libpulse, no KVM access, stale group membership, WSL1, WSL2 with and without WSLg, a stale XDG_RUNTIME_DIR, low core counts, a stopped device, and a real virtual_device.err.
Doctor checks are plain functions that take an environment object (files, exec, env vars, kernel release, CPU count, a console probe), so a new check needs only a fixture to test.
Vega SDK 0.24.12112, Vega CLI 1.4.5, Ubuntu 24.04 on WSL2 (kernel 6.6.87.2), Node.js 22.
MIT. See LICENSE.
vvd-kit is not affiliated with or endorsed by Amazon. Fire TV and Vega are trademarks of Amazon.com, Inc. or its affiliates.
