Configuring RetroArch on Ubuntu

Last Updated on

*Still debating whether or not a full install of Ubuntu is worth the effort vs. Lakka which “just” works, for the most part with little or no configuration.  RetroArch is more configurable / tweakable outside of Lakka, however there are key differences which are covered below, mostly related to the configuration of Ubuntu.

Emulators are nothing new nor is RetroArch – a ROM emulator based on libretro cores packaged in a clean & intuitive interface. I started tinkering with this application a few days ago and found it to be rather well done.  I installed a Linux distro called Lakka which conveniently boots from a USB stick straight into the emulation interface.  This actually works quite well – however i wanted to go a little further with it as i already have an extra machine with Ubuntu 16.04 19.04 installed.  I used once again, an additional Lenovo M73 – these are great little machines!  This guide similar for more recent builds of Ubuntu as well.  I’ll be updating this post as I move a long with the customization of my machine.  Installation is straight forward:

lenovo m73 ps3 retroarch setup
lenovo m73 ps3 retroarch setup

For simplicity (not security) optionally enable root:

1
2
3
sudo passwd root
sudo passwd -u root
sudo ufw disable
1
2
3
4
5
6
7
8
9
10
##testing
sudo add-apt-repository ppa:libretro/testing
##stable
sudo add-apt-repository ppa:libretro/stable
sudo apt update
sudo apt install -y retroarch libretro-*
sudo apt install -y alsa-utils
sudo apt install -y openssh-server
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
sudo service ssh restart
  • To execute the interface I have been running sudo retroarch -v
  • To execute the interface….on boot – create a service definition and set it to disabled.  Then create a cron job to start the service at boot.
  • *Without root or superuser privileges the emulator does not seem to take any type of user input

RetroArch Service Definition – this also restarts RetroArch when it crashes or on user exit; operates like a “kiosk.”
/etc/systemd/system/retroarch.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[Unit]
Description=Retroarch
After=graphical.target
ConditionKernelCommandLine=!retroarch=0
Requires=graphical.target

[Service]
#ExecStartPre=/bin/sleep 30
Environment=DISPLAY=:0.0
Environment=SDL_MOUSE_RELATIVE=0
Environment=FB_MULTI_BUFFER=2
Environment=HOME=/storage
EnvironmentFile=-/run/libreelec/retroarch.conf
ExecStartPre=-/usr/lib/retroarch/retroarch-config
ExecStart=/usr/bin/retroarch
KillMode=process
TimeoutStopSec=10
Restart=always
#Restart=on-failure
RestartSec=0
StartLimitInterval=0

[Install]
WantedBy=retroarch.target

Currently I have this service set to disabled by default.  It doesn’t seem to start properly due to the before and after service constraints – haven’t figured those out yet.  The workaround is to have RetroArch start via a system start chron job.

RetroArch interface running on Ubuntu Server 19.04

Once installed load various modules and metadata via the Online Updater menu item.

The configuration file:

1
vi /storage/.config/retroarch/retroarch.cfg

Sound Issues with AlsaMixer:

1
2
3
4
5
6
amixer -c 0 set Master playback 0% mute
amixer -c 0 set Master playback 100% unmute

amixer -c 0 set Master 100 unmute
amixer -c 0 set Master 0
amixer -c 0 set Master 100

Important Note:  Ubuntu will pause / stall the system on boot indefinately or ~5min until a network connection is detected.  on Ubuntu 19.04 this behavior can be adjusted. Other versions of Ubuntu have options such as Hotplug and editing the services file – I have tried all combinations of these solutions and none seem to work with 18.04 – so 19.04 is the answer.

Prerequisites and compiling command lines for Centos 7 / RedHat – I haven’t been able to get this working … yet!

1
2
3
4
5
6
sudo dnf install git make automake gcc gcc-c++ kernel-devel mesa-libEGL-devel libv4l-devel libxkbcommon-devel mesa-libgbm-devel Cg libCg zlib-devel freetype-devel libxml2-devel ffmpeg-devel SDL2-devel SDL-devel perl-X11-Protocol perl-Net-DBus pulseaudio-libs-devel openal-soft-devel libusb-devel
git clone https://github.com/libretro/RetroArch
cd RetroArch/
./configure
make
sudo make install

Pairing a BlueTooth PS3 / PS4 controller to your newly built emulator box.

Linux Box Auto-Login as Root

Conclusion – Although it would be nice to get this tuned perfectly, I’ve found its just easier to install Lakka, it’s developed by the same team that builds RetroArch, mostly everything just works 🙂

Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Leave a Reply