Post

Batocera.linux

Batocera.linux

Batocera.linux is an open-source and completely free retro-gaming distribution that can be copied to a USB stick or an SD card with the aim of turning any computer/nano computer into a gaming console during a game or permanently. Batocera.linux does not require any modification on your computer.

Note that you must own the games you play in order to comply with the law.

Installation besides other linux installs

First of all you have to create two partitions on the drive you want to use.

orderlabeltypesizedecscription
1BATOCERAFAT3210 GiBMain OS partition. It has to be EFI and bootable.
2SHAREext4 / btrfs10 GiB“Games” partition.

NTFS for the “SHARE”-partition is possible but not recommended. I understand if you’re using a dual-boot setup like Windows and Batocera and want to share this partition with both operating systems, but you will get massive file permission problems because Batocera.linux is creating WINE prefixes for some emulators and they have to be on linux partitions.

Important: BATOCERA will always watch at the next partition and assume it to be the SHARE partition regardingless of what you actually named it.

Go to https://mirrors.o2switch.fr/batocera/x86_64/stable/last/ and download the latest boot.tar.xz.

Afterwards extract the contents of boot.tar.xz to your BATOCERA partition. Note that the EFI directory (and all other contents) must be in the root folder of the drive. I recommend using p7zip on Linux or 7-Zip on Windows for that.

Dual-boot Batocera.linux

I assume that you have the GRUB bootloader installed and running. Now create a file named 15_batocera in /etc/grub.d/ with the following content.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /bin/sh

BATOCERA_UUID=$(lsblk --fs --noheadings --pairs -o TYPE,LABEL,UUID |
		       grep -E '^TYPE="part" LABEL="BATOCERA" UUID="[^"]*"$' |
		       sed -e s+'^TYPE="part" LABEL="BATOCERA" UUID="\([^"]*\)"$'+'\1'+ | head -1)

if test -n "${BATOCERA_UUID}"
then
    echo "Image batocera found on ${BATOCERA_UUID}" >&2

    cat <<EOF
menuentry "batocera.linux" {
      search --set=root --label BATOCERA
      linux /boot/linux label=BATOCERA console=tty3 quiet loglevel=0 vt.global_cursor_default=0
      initrd /boot/initrd.gz
}
EOF
fi

Afterwards adjust the file permissons.

1
chmod 0755 /etc/grub.d/15_batocera

For GRUB to be able to detect other operating systems you need to have os-prober to be installed.

1
sudo pacman -S os-prober

Edit /etc/grub/default and look for a variable that is called GRUB_DISABLE_OS_PROBER=false and uncomment it.

1
GRUB_DISABLE_OS_PROBER=false

When finished update GRUB.

1
grub-mkconfig -o /boot/grub/grub.cfg

As you can see in the previously created script looks for the UUID and the partition type part (FAT32) with the label BATOCERA and automatically adds it as menu entry to GRUB itself.

Use external drives with just bioses, roms and saves on it

The benefit of configuring Batocera that way is that you don’t have make space for all your games on every device were Batocera runs on and you can also bring your save states with you. I for myself have a desktop computer, a laptop and a Raspberry Pi to play on. I don’t have to worry of each Batocera system-specific configuration. I just connect the external hard drive and that’s it.

Get the UUID of your external drive running blkid as root.

1
sudo blkid

Output:

1
2
3
4
5
/dev/zram0: LABEL="zram0" UUID="3e348884-074d-457d-af7d-bbb2c033bfde" TYPE="swap"
/dev/sdb2: LABEL="SHARE" UUID="5c329796-f5ae-487d-b747-3255c7b1b0a5" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="d33ee098-291d-400c-b126-da21290a6039"
/dev/sdb1: LABEL_FATBOOT="BATOCERA" LABEL="BATOCERA" UUID="2067-EAA3" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="11dc25ef-a08a-4735-962b-dfe94a645adf"
/dev/sda2: UUID="232c16da-6f07-4f54-9bc1-494f97c05c5e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="aa4bab10-ebb0-4af7-a13e-7b28e7dc4a2f"
/dev/sda1: UUID="219E-A7C7" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="c9519e0e-d630-4fa3-968e-785b57c0d4bd"

For me, let’s assume, it would be /dev/sdb2. Then the UUID would be 5c329796-f5ae-487d-b747-3255c7b1b0a5. Don’t get confused with the PARTUUID.

Edit batocera-boot.conf on your BATOCERA partition. Look for a line that begins with shardevice=INTERNAL and replace it with the below code.

1
2
3
4
sharedevice=DEVICES
sharedevice_part1=ROMS@b51a2311-5f13-49e8-b930-d17b4d705fa7:/batocera/roms
sharedevice_part2=SAVES@b51a2311-5f13-49e8-b930-d17b4d705fa7:/batocera/saves
sharedevice_part3=BIOS@b51a2311-5f13-49e8-b930-d17b4d705fa7:/batocera/bios
valuedescription
sharedevice=DEVICESStands for external DEVICES. This could be several things even remote locations.
sharedevice_partXSpecifies to storage location of folders to be replaced with.

Further reading: Storage configuration in Batocera

Adding Nintendo Switch emulation (by foclabroc)

Installation

In Batocera hit F1 in the main menu and start a terminal you’ll find it in Applications > xterm .

1
curl -L bit.ly/foclabroc-switchoff-40 | bash

This command is for Batocera version <=40

1
curl -L bit.ly/foclabroc-switchoff | bash

This command is for Batocera version >=41

Install additional emulators / software with DTJW92’s Batocera Unofficial Addons

Installation

In Batocera hit F1 in the main menu and start a terminal you’ll find it in Applications > xterm .

1
curl -L bit.ly/BUAinstaller | bash

Check out his GitHub.

App removal

Sadly you have to remove the corresponding app folder by your own. There are in following directories:

  • /userdata/roms/ports (maybe)
  • /userdata/system/pro Applications in F1 > Applications will disappear after reboot.
This post is licensed under CC BY 4.0 by the author.