r/batocera • u/TheMainPlott • 2h ago
Batocera v44: Fix for Xbox/Xemu Games Not Launching When Saves Are on a NAS
I had this problem for a long time and just discovered it's because I have my saves on a NAS. Technically, I have everything pulling from a NAS, but it's only the saves that effect XBOX because that is where it gets the xbox_hdd.qcow2 and needs to lock it. This is the workaround that finally worked with some AI assistance:
Setup
- Batocera v44
- Xbox emulator: Xemu
- Xbox games stored as valid XISO files
/userdata/savesstored on a NAS using CIFS/SMB- Xbox HDD image located at:
/userdata/saves/xbox/xbox_hdd.qcow2
Problem
Xbox games would immediately return to EmulationStation instead of launching.
The Batocera Xemu log showed:
Failed to get "write" lock
and:
Is another process using the image [/userdata/saves/xbox/xbox_hdd.qcow2]?
Checking with fuser and lsof showed that no other process was actually using the file.
The important discovery was that /userdata/saves was a CIFS/SMB NAS mount. Xemu needs write access and locking for its xbox_hdd.qcow2 virtual hard disk. The NAS-hosted HDD image was preventing Xemu from obtaining the required lock.
Fix
Keep /userdata/saves on the NAS, but store Xemu's xbox_hdd.qcow2 on Batocera's local ext4 storage.
For example:
Local Xemu HDD:
/userdata/system/xemu-local/xbox_hdd.qcow2
Path Batocera/Xemu expects:
/userdata/saves/xbox/xbox_hdd.qcow2
Copy the existing HDD locally:
mkdir -p /userdata/system/xemu-local
cp -av /userdata/saves/xbox/xbox_hdd.qcow2 /userdata/system/xemu-local/xbox_hdd.qcow2
Then bind-mount the local HDD over the NAS-backed path:
mount --bind /userdata/system/xemu-local/xbox_hdd.qcow2 /userdata/saves/xbox/xbox_hdd.qcow2
This allows Batocera to continue using its normal Xemu path while the actual writable QCOW2 file resides on the local ext4 filesystem.
Make It Persistent
If using Batocera's custom_service, add a section similar to:
LOCAL_XEMU_DIR="/userdata/system/xemu-local" LOCAL_XEMU_HDD="$LOCAL_XEMU_DIR/xbox_hdd.qcow2"
BATOCERA_XEMU_DIR="/userdata/saves/xbox" BATOCERA_XEMU_HDD="$BATOCERA_XEMU_DIR/xbox_hdd.qcow2"
mkdir -p "$LOCAL_XEMU_DIR" mkdir -p "$BATOCERA_XEMU_DIR"
if [ ! -f "$LOCAL_XEMU_HDD" ]; then if [ -f "$BATOCERA_XEMU_HDD" ]; then cp -a "$BATOCERA_XEMU_HDD" "$LOCAL_XEMU_HDD" fi fi
if [ -f "$LOCAL_XEMU_HDD" ]; then chmod 664 "$LOCAL_XEMU_HDD" chown root:root "$LOCAL_XEMU_HDD"
if ! findmnt -n -T "$BATOCERA_XEMU_HDD" 2>/dev/null | grep -q "$LOCAL_XEMU_HDD"; then mount --bind "$LOCAL_XEMU_HDD" "$BATOCERA_XEMU_HDD" fi fi
Verify
After rebooting:
findmnt -T /userdata/saves/xbox/xbox_hdd.qcow2
The Xbox HDD should now resolve to the local bind-mounted copy instead of directly using the CIFS-hosted QCOW2 file.
Then launch an Xbox game normally through EmulationStation.
Result
Xbox games launched correctly after moving the active xbox_hdd.qcow2 to local ext4 storage and bind-mounting it over Batocera's expected NAS save path.
The Xbox XISO game files can remain on the NAS. There is no need to move the entire Xbox library locally.
Short version
If Batocera's /userdata/saves is on a CIFS/SMB NAS and Xemu fails with "Failed to get write lock" on xbox_hdd.qcow2**, keep the Xbox games on the NAS but move** xbox_hdd.qcow2 to local ext4 storage. Bind-mount the local QCOW2 over /userdata/saves/xbox/xbox_hdd.qcow2 so Batocera continues using its normal path.