Running Batocera in a virtual machine is not officially supported, nor will it be an accurate representation of how it will behave, but it can be useful for quickly testing custom images or UI changes.
Expect massive performance deficits compared to bare-metal installation. Virtual Machines don't take kindly to newer/modern graphics APIs and standards.
If you need further help with installing VirtualBox, refer to their helpful user manual
.img.gz format. Uncompress the .gz part with your favorite uncompressing tool (7-Zip, WinRar…) to make it a .img file. Some browsers uncompress the file you downloaded by default.[Win] + [R], then type cmd). For example, for the default VirtualBox installation using Batocera v33 beta: "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertdd C:\batocera-x86_64-33-20211108.img C:\batocera-x86_64-33-20211108.vdi
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd "C:\batocera-x86_64-33-20211108.vdi” --resize 20000
And we're done.
You can increase the output resolution releasing your cursor (right [Ctrl]) and clicking VIEW → VIRTUAL SCREEN-1 in the menu toolbar of VirtualBox.
You can still add files to Batocera using the usual methods, even the network share.
As you already have the image .vdi, you can setup different environments for the same machine and test which one will be better for your PC, just make sure you are using a 64-bit one (or 32-bit if appropriate).
share.img (replacing 5G with the size you desire, make it at least 5GB to support future upgrades): dd if=/dev/zero of=share.img count=5 bs=5G
To confirm that the blank share image has been created, run
ls -lh share.img
to check its reported space. For instance, a 5GB blank image should report back something like:
-rw-rw-r-- 1 XXX XXX 5.0G XXX share.img
mkfs.ext4 share.img
Otherwise it's fine to, after booting Batocera, go to SYSTEM SETTINGS → DEVELOPER → FORMAT A DISK and format it there.
udevadm info -q all -n /dev/bus/usb/001/002 echo 'SUBSYSTEM=="usb", ENV{ID_MODEL}=="Usb_Gamepad", MODE="0666"' >> /etc/udev/rules.d/99-joysticks-rw.rules
./runQemu.sh ~/batocera-x86_64-XX-XXXXXXXX.img share.img
The runQemu.sh script itself contains further instructions (that may get updated faster than this wiki). For an example of what an ordinary installation procedure might look like:
A video demonstration of Batocera being run inside a Qemu VM.
You can still add files to Batocera using the usual methods, even the network share.
In case you'd like to mount the share image to add files directly, run the following:
X=$(sudo losetup -f) mkdir -p BATOCERA sudo losetup -P $X share.img sudo mount ${X}p1 BATOCERA sudo chmod -R 777 BATOCERA/
Then it should be automatically detected and mounted by your desktop environment.
batocera*.img file from the compressed batocera*.img.tz tarball.fallocate. At least 16 GB is recommended for full functionality, but if space is a concern then you can get away with just 7 GB: sudo fallocate -l 7G batocera.img
virt-manager and qemu packages for your distro:apt-get update apt-get upgrade apt-get install virt-manager qemu
sudo dnf install virt-manager qemu
pacman -S virt-manager qemu
yum install virt-manager qemu
libvirt socket. Change out the username:username with your actual username:sudo chown username:username /var/run/libvirt/libvirt-sock
Microsoft Windows 10 (Untested. Reportedly, following this tutorial to set it up in addition to passing through all devices enables it to work: https://www.nicksherlock.com/2020/12/running-tails-as-a-vm-with-persistence-on-proxmox/
The virtual machine is not configured correctly. Preferably, you would figure out how it's not configured correctly and remedy that, but in case you'd rather just instantly work around it, you can force Batocera to use a particular resolution.
Perhaps you didn't expand the image before using it as the base?
It's also possible to simply replace the userdata partition with another, larger one by changing the “drives” in the virtual machine's settings. This will differ from virtual machine to virtual machine, look up its instructions. Batocera uses the ext4 filesystem for its userdata by default.
First, make sure you have passed it through as a USB device to the VM itself (refer to the instructions above).
If it's still not working, check that the controller itself is working fine on your host machine outside of VirtualBox.
If it's still not being recognized, add the user to the correct group:
sudo usermod -a -G vboxusers $USER && sg vboxusers virtualboxWindows shouldn't have this issue as long as the program is run in administrator mode.