/batocera:batocera-opsfrom batocera
Use when connecting to or operating a Batocera arcade/retro-gaming cabinet over SSH: establishing the connection, understanding its read-only rootfs and /userdata layout, finding config/log/ROM paths, applying changes safely, verifying a display/config change end-to-end without a controller, or diagnosing why a setting reverts to its default on every launch (configgen). Foundation for the other batocera-* skills (roms, display, tuning, maintenance). Covers sshpass, batocera.conf, EmulationStation, the ES HTTP API, and batocera-screenshot. Not for game recommendations.
Ships in batocera. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Foundation for operating a Batocera cabinet with a coding agent over SSH. Read
this first; the sibling skills (batocera-roms, batocera-display,
batocera-tuning, batocera-maintenance) assume the connection pattern, path
model, and safety doctrine defined here.
Batocera is an immutable-rootfs Linux distro for retro gaming. The system
partition is read-only; everything you can change lives under /userdata.
EmulationStation (ES) is the frontend; RetroArch and standalone emulators do
the playing. Configuration is layered: a single batocera.conf holds most
settings, but launch-time code (configgen) regenerates per-emulator configs on
every launch, so hand-edits to the generated files get stomped. Getting these
two facts right prevents most wasted sessions.
Batocera defaults to password SSH (no key from a fresh client). Parameterize the host so nothing is hardcoded:
export BATOCERA_HOST=192.168.1.50 # your cabinet's LAN IP
Batocera's documented default credentials are root / linux. If yours
still uses them, change the password (ES menu → System Settings → Security, or
passwd over SSH) — a machine you SSH into as root should not ship with a
published password. The examples below read the password from an env var so it
never lands in shell history or a committed file:
export BATOCERA_PASS='linux' # replace with your actual password
# convenience wrapper used throughout these skills
SSHB() { sshpass -p "$BATOCERA_PASS" ssh -o StrictHostKeyChecking=no "root@$BATOCERA_HOST" "$@"; }
SCPB() { sshpass -p "$BATOCERA_PASS" scp -o StrictHostKeyChecking=no "$@"; }
Run a command: SSHB 'cat /usr/share/batocera/batocera.version'
Copy down: SCPB "root@$BATOCERA_HOST:/userdata/screenshots/x.png" .
Copy up: SCPB ./file "root@$BATOCERA_HOST:/userdata/system/"
If key auth is set up, drop sshpass. Batocera drops idle SSH connections; for
long-running work use nohup … & or screen/tmux if installed. Rapid
reconnects can trip the SSH daemon's throttle (transient "Permission denied");
wait a few seconds and retry rather than assuming the password is wrong.
A tar stream from macOS adds an ._name AppleDouble file beside every file
that has extended attributes. In a ROM or media folder those show up as broken
entries. Set COPYFILE_DISABLE=1 for the tar command on the Mac.
/usr, /etc, or
/bin. Anything you write there vanishes on reboot (or fails outright)./userdata is the only writable tree. ROMs, configs, saves, BIOS,
decorations, shaders, scripts, logs — all under /userdata.| Path | What |
|---|---|
/userdata/roms/<system>/ | ROMs, one dir per system (see batocera-roms) |
/userdata/roms/<system>/gamelist.xml | Per-system metadata + <hidden> flags |
/userdata/system/batocera.conf | Main config: one file, key=value |
/userdata/system/configs/ | Per-emulator configs (many are regenerated) |
/userdata/system/configs/retroarch/retroarchcustom.cfg | RetroArch overrides |
/userdata/system/configs/emulationstation/es_settings.cfg | ES frontend settings |
/userdata/system/services/ | Boot services (v43+; replaced custom.sh) |
/userdata/system/logs/ | Per-launch + component logs (see reference) |
/userdata/decorations/ | Bezel/overlay packs |
/userdata/shaders/ | User shader presets and configs |
/userdata/saves/ | Emulator save states and SRAM |
/userdata/bios/ | BIOS files |
/usr/share/emulationstation/es_features.cfg | Catalog of valid per-emulator setting keys + values (read-only; see batocera-conf reference) |
/userdata/screenshots/ | Where batocera-screenshot writes |
batocera-conf precedence, the configgen regeneration model, and where a
setting must live to survive a launch are in
references/batocera-conf.md. The log inventory
and ES restart mechanics are in
references/emulationstation.md.
This is a shared physical device, often the family/party arcade cabinet. Treat it accordingly.
/userdata is the only thing
standing between you and a re-image.SSHB 'cp /userdata/system/batocera.conf /userdata/system/batocera.conf.bak-$(date +%Y%m%d-%H%M%S)'
Same for any gamelist.xml before editing it.xdotool, evemu, or virtual gamepads to "drive" the cabinet. Someone may
be physically holding the controller; injected keypresses land in their
open menu and silently change settings. If a test needs button/stick input,
describe the exact steps and ask the human to drive. (The ES HTTP API launch
below is not synthetic input — it is a documented control endpoint — but
it does commandeer the screen, so skip it if someone is playing.)The signature agent-native capability: change a display/config setting and
confirm it end-to-end without touching the cabinet, using the ES HTTP API to
launch and batocera-screenshot to see the result.
# 1. Launch a specific ROM via the ES HTTP API (runs ON the box, port 1234).
# Works even for files ES doesn't list in its menu.
SSHB "curl -s -m3 -X POST http://127.0.0.1:1234/launch -d '/userdata/roms/<system>/<rom>'"
# 2. Wait 20-45s. Title/attract screens can be slow; if the shot is black,
# take a second one a few seconds later before concluding anything.
# 3. Capture the framebuffer (this exact command; there is no swissknife
# --screenshot). Writes a PNG into /userdata/screenshots/.
SSHB "batocera-screenshot"
# 4. Kill the running emulator, copy the newest screenshot down, and look at it.
SSHB "batocera-es-swissknife --emukill"
SCPB "root@$BATOCERA_HOST:/userdata/screenshots/$(SSHB 'ls -t /userdata/screenshots | head -1')" /tmp/verify.png
# then Read /tmp/verify.png
Many games at once: scripts/launch_test.sh runs
this loop over a list on the box itself. It takes the screenshots at the times
you give per game, saves the launch logs, and writes one result line per game.
It has a time limit per game: one that does not stop gets SIGKILL and hung=1,
and the run goes on. It will not start while a game is already running, and it
can stop at quiet hours. Look at the screenshots yourself before you call a
game working: "the process ran for 40 seconds" is also true for a black screen
and for a "wrong region" error page.
When /launch does nothing: the ES API cannot start every file. For a
system that ES shows inside a group tile, the call returns and no game starts.
For a file format the core does not support, ES opens a warning dialog and
waits, and every later /launch is ignored until ES restarts (see the
emulationstation reference for how to spot both).
scripts/direct_launch.sh starts the game with
batocera-launch -system <system> -rom <path> instead, which is the command
ES itself runs on v44 (older versions name it differently:
grep -m1 '<command>' /usr/share/emulationstation/es_systems.cfg shows
yours). It borrows XDG_RUNTIME_DIR from the ES process so audio and
the display work, sets the system volume to 0 and puts it back, takes
screenshots at the times you give, and stops the emulator at the end:
SSHB 'bash /userdata/system/tools/direct_launch.sh nes "/userdata/roms/nes/<rom>" /userdata/system/test/run1 "20 45"'
Its result line says whether an emulator process was alive at each shot time.
batocera-launch also gives a real exit code and a log (<prefix>.launch.log),
so a format the core rejects shows up as an error instead of a silent dialog.
Set EMUS to the process names of your standalone emulators, or the script
cannot see or stop them.
From a recording to a gamelist video. Give the script two more arguments
(start second, length) and it records the screen with ffmpeg x11grab while
the game runs. Useful for a game no scraper has a video for. The recording is
the full screen with the bezel, so convert it on the box:
# crop to the game picture, scale to 480p, drop the audio track
ffmpeg -i run1.rec.mp4 -vf "crop=1440:1080:240:0,scale=640:480" -an \
-c:v libx264 -crf 23 -pix_fmt yuv420p "/userdata/roms/<system>/videos/<name>.mp4"
ffprobe -v error -show_entries stream=codec_type,width,height -of csv=p=0 "/userdata/roms/<system>/videos/<name>.mp4"
crop=1440:1080:240:0 is a 4:3 picture centred on a 1080p screen; read the
real opening from one screenshot if your bezel differs. ffprobe must print
one line, video,640,480. Then add
<video>./videos/<name>.mp4</video> to the game's entry in gamelist.xml
(back the file up, and use the SIGKILL restart so ES does not write its old
copy over the edit). Verify:
curl -s http://127.0.0.1:1234/systems/<system>/games shows a video value
for the game. Record 30 to 40 seconds of gameplay, not the boot logo: pick the
start second from the screenshots of a first run.
Config assertions after a libretro launch: the actual values RetroArch
ran with are in
/userdata/system/configs/retroarch/retroarchcustom.cfg and
.../cores/retroarch-core-options.cfg, reflecting the last launch. Read
those to confirm a key landed, rather than trusting that your batocera.conf
edit took effect.
Gotchas that waste a verify session:
retroarch … | grep / | tail
discards core errors silently. To see why a core failed, launch with
--log-file /tmp/ra.log and read the file.retroarch blocks ES launches — the ES launch exits
instantly (~24ms, empty stderr, status 1). SSHB 'killall -9 retroarch'
first.gamelist.xml on exit and
clobbers live edits. Stop it (/etc/init.d/S31emulationstation stop) or use
the SIGKILL-restart pattern in the emulationstation reference. Config edits to
batocera.conf do not need this; gamelist XML edits do./userdata/system/scripts/ runs at each game start and
stop, with the event name and game details as arguments. A helper script
you only meant to keep there runs too. Keep helpers somewhere else, or keep
them mode 644. If a file in that folder must stay executable (a udev helper,
for example), make it exit at once when the first argument is gameStart or
gameStop.SSHB "curl -s http://127.0.0.1:1234/systems/<system>/games" (returns
name/path/hidden per entry).Batocera changes across releases (path renames, custom.sh → services, new
systems). These skills were distilled on v41-v43; commands are read-only unless
noted. Before trusting a version-specific claim, confirm the build:
SSHB 'cat /usr/share/batocera/batocera.version'. The canonical manual is the
Batocera wiki; these skills capture operational
lessons the wiki doesn't, not a replacement for it.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub t3chnaztea/batocera-skills --plugin batocera5 skills in this plugin
/batocera-displayUse when working on how games look on a Batocera cabinet: CRT and other shaders, shaderset resolution and per-game shader overrides, bezel/overlay artwork and alignment, generating missing .info sidecars, filtering unusable bezels, seasonal bezels and boot splash clips, pinning the display resolution, or diagnosing moire and cropped/misaligned game viewports inside bezels. Covers why a shaderset seems invalid, why .info top values are not alpha coordinates, and why Mega-Bezel per-game art fails. Not for performance/framerate tuning (batocera-tuning)./batocera-maintenanceUse when keeping a Batocera cabinet healthy over time: running scripts or scheduled jobs at boot and on an interval without cron, the custom_service boot-service pattern (which replaced custom.sh in v43), backing up /userdata to another machine over SSH, and upgrading between major Batocera versions (v42 to v43 and similar) including the ROM-directory renames and post-upgrade checklist, a daily thermal throttle log, and a monthly health check that alerts only on an out-of-range value. Covers why there is no crond, the backup-before-upgrade doctrine, and catch-up scheduling. Not for performance tuning (batocera-tuning)./batocera-romsUse when working with ROMs and gamelists on a Batocera cabinet: figuring out which directory a system's ROMs go in, why a game does not appear in the menu, which file formats and extensions a system accepts, curating a large library by hiding rather than deleting, editing gamelist.xml safely, cleaning up multi-disc games, or verifying dumps against No-Intro/Redump DATs. Covers extensionless-ROM-in-zip failures, the 3DO/Opera no-m3u trap, cave3rd, and the es_systems_custom.cfg landmine. Not for shaders/bezels (batocera-display), or ROM directories renamed by a Batocera version upgrade (batocera-maintenance)./batocera-tuningUse when a Batocera cabinet feels slow, laggy, or stuttery, or when tuning performance: EmulationStation menu/carousel lag, a slow-since-boot frontend, CPU governor stuck in powersave, overclock or CPU-speed core options that seem to do nothing, run-ahead / input latency, joystick polling rate (usbhid.jspoll, 1000 Hz) on arcade encoders, framerate that drops the longer the machine runs, or a 3D-heavy game (PSX/PS2/Dreamcast/N64 class) that crashes or stutters — Vulkan errors in emulator logs, picking a rendering resolution or graphics backend the hardware can afford. Covers the diagnostic order (check the throttle first), the v43 governor-at-boot failure, the emulator-name vs rom-dir-name overclock scoping trap, ES event-hook frame cost, and hardware-tier detection (batocera-info / batocera-vulkan). Not for shader visual quality (batocera-display).