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.  Need to figure out a way to make this service run last at startup, by manipulating the various service parameters / targets “wanted” – any input welcomed.

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
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

Removing Linux Ubuntu Boot Screen

Conclusion – I’ve been able to build a console that functions as it should;  combining this unit with a media server would be an interesting possibility.  However, for a dedicated system it is just easier to install Lakka, it’s developed by the same team that builds RetroArch, mostly everything just works 🙂

Example Ubuntu retroarch.cfg:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
ai_service_enable = "false"
ai_service_mode = "0"
ai_service_source_lang = "0"
ai_service_target_lang = "0"
ai_service_url = "http://localhost:4404/"
all_users_control_menu = "false"
apply_cheats_after_load = "false"
apply_cheats_after_toggle = "false"
aspect_ratio_index = "1"
assets_directory = "~/.config/retroarch/assets"
audio_block_frames = "0"
audio_device = "hdmi:CARD=HDMI,DEV=0"
audio_driver = "alsa"
audio_dsp_plugin = ""
audio_enable = "true"
audio_enable_menu = "true"
audio_enable_menu_bgm = "true"
audio_enable_menu_cancel = "true"
audio_enable_menu_notice = "true"
audio_enable_menu_ok = "true"
audio_filter_dir = "/usr/lib/x86_64-linux-gnu/retroarch/filters/audio/"
audio_latency = "64"
audio_max_timing_skew = "0.050000"
audio_mixer_mute_enable = "false"
audio_mixer_volume = "0.000000"
audio_mute_enable = "false"
audio_out_rate = "48000"
audio_rate_control = "true"
audio_rate_control_delta = "0.005000"
audio_resampler = "sinc"
audio_resampler_quality = "3"
audio_sync = "true"
audio_volume = "0.000000"
auto_overrides_enable = "true"
auto_remaps_enable = "true"
auto_screenshot_filename = "true"
auto_shaders_enable = "true"
automatically_add_content_to_playlist = "true"
autosave_interval = "10"
block_sram_overwrite = "false"
builtin_imageviewer_enable = "true"
builtin_mediaplayer_enable = "true"
bundle_assets_dst_path = ""
bundle_assets_dst_path_subdir = ""
bundle_assets_extract_enable = "false"
bundle_assets_extract_last_version = "0"
bundle_assets_extract_version_current = "0"
bundle_assets_src_path = ""
cache_directory = "/tmp"
camera_allow = "false"
camera_device = ""
camera_driver = "video4linux2"
cheat_database_path = "~/.config/retroarch/cheats"
check_firmware_before_loading = "true"
cheevos_auto_screenshot = "false"
cheevos_badges_enable = "false"
cheevos_enable = "false"
cheevos_hardcore_mode_enable = "false"
cheevos_leaderboards_enable = "false"
cheevos_password = ""
cheevos_test_unofficial = "false"
cheevos_token = ""
cheevos_username = ""
cheevos_verbose_enable = "false"
config_save_on_exit = "true"
content_database_path = "~/.config/retroarch/database/rdb"
content_favorites_path = "~/.config/retroarch/content_favorites.lpl"
content_favorites_size = "100"
content_history_dir = ""
content_history_path = "~/.config/retroarch/content_history.lpl"
content_history_size = "100"
content_image_history_path = "~/.config/retroarch/content_image_history.lpl"
content_music_history_path = "~/.config/retroarch/content_music_history.lpl"
content_runtime_log = "true"
content_runtime_log_aggregate = "false"
content_show_add = "true"
content_show_favorites = "true"
content_show_history = "true"
content_show_images = "false"
content_show_music = "false"
content_show_netplay = "true"
content_show_playlists = "true"
content_show_settings = "true"
content_show_settings_password = ""
content_show_video = "false"
content_video_history_path = "~/.config/retroarch/content_video_history.lpl"
core_assets_directory = "~/.config/retroarch/downloads"
core_options_path = ""
core_set_supports_no_game_enable = "true"
core_updater_auto_extract_archive = "true"
core_updater_buildbot_assets_url = "http://buildbot.libretro.com/assets/"
core_updater_buildbot_cores_url = "http://buildbot.libretro.com/nightly/linux/x86_64/latest/"
crt_switch_center_adjust = "0"
crt_switch_resolution = "0"
crt_switch_resolution_super = "2560"
crt_switch_resolution_use_custom_refresh_rate = "false"
crt_video_refresh_rate = "60.000000"
current_resolution_id = "0"
cursor_directory = "~/.config/retroarch/database/cursors"
custom_viewport_height = "2160"
custom_viewport_width = "2880"
custom_viewport_x = "608"
custom_viewport_y = "0"
desktop_menu_enable = "true"
discord_allow = "false"
discord_app_id = "475456035851599874"
dpi_override_enable = "false"
dpi_override_value = "200"
dynamic_wallpapers_directory = "default"
enable_device_vibration = "false"
fastforward_ratio = "0.000000"
filter_by_current_core = "false"
flicker_filter_enable = "false"
flicker_filter_index = "0"
fps_show = "true"
fps_update_interval = "256"
frame_time_counter_reset_after_fastforwarding = "false"
frame_time_counter_reset_after_load_state = "false"
frame_time_counter_reset_after_save_state = "false"
framecount_show = "false"
frontend_log_level = "1"
game_specific_options = "true"
gamma_correction = "0"
global_core_options = "true"
history_list_enable = "true"
joypad_autoconfig_dir = "~/.config/retroarch/autoconfig"
keyboard_gamepad_enable = "true"
keyboard_gamepad_mapping_type = "1"
kiosk_mode_enable = "false"
kiosk_mode_password = ""
led_driver = "null"
libretro_directory = "~/.config/retroarch/cores"
libretro_info_path = "~/.config/retroarch/cores"
libretro_log_level = "1"
load_dummy_on_core_shutdown = "true"
location_allow = "false"
location_driver = "null"
log_dir = "~/.config/retroarch/logs"
log_to_file = "false"
log_to_file_timestamp = "false"
log_verbosity = "false"
materialui_icons_enable = "true"
materialui_menu_color_theme = "0"
memory_show = "false"
menu_battery_level_enable = "true"
menu_core_enable = "true"
menu_driver = "xmb"
menu_dynamic_wallpaper_enable = "false"
menu_enable_widgets = "true"
menu_font_color_blue = "255"
menu_font_color_green = "255"
menu_font_color_red = "255"
menu_footer_opacity = "1.000000"
menu_framebuffer_opacity = "0.900000"
menu_header_opacity = "1.000000"
menu_horizontal_animation = "true"
menu_left_thumbnails = "1"
menu_linear_filter = "true"
menu_mouse_enable = "true"
menu_navigation_browser_filter_supported_extensions_enable = "true"
menu_navigation_wraparound_enable = "true"
menu_pause_libretro = "true"
menu_pointer_enable = "false"
menu_rgui_full_width_layout = "true"
menu_rgui_shadows = "false"
menu_savestate_resume = "true"
menu_shader_pipeline = "2"
menu_show_advanced_settings = "true"
menu_show_configurations = "true"
menu_show_core_updater = "true"
menu_show_dump_disc = "true"
menu_show_help = "true"
menu_show_information = "true"
menu_show_latency = "true"
menu_show_legacy_thumbnail_updater = "false"
menu_show_load_content = "true"
menu_show_load_core = "true"
menu_show_load_disc = "true"
menu_show_online_updater = "true"
menu_show_overlays = "true"
menu_show_quit_retroarch = "true"
menu_show_reboot = "true"
menu_show_restart_retroarch = "true"
menu_show_rewind = "true"
menu_show_shutdown = "true"
menu_show_sublabels = "true"
menu_swap_ok_cancel_buttons = "false"
menu_throttle_framerate = "true"
menu_thumbnail_upscale_threshold = "0"
menu_thumbnails = "3"
menu_ticker_smooth = "true"
menu_ticker_speed = "1.000000"
menu_ticker_type = "0"
menu_timedate_enable = "true"
menu_timedate_style = "5"
menu_unified_controls = "false"
menu_use_preferred_system_color_theme = "false"
menu_wallpaper = ""
menu_wallpaper_opacity = "0.300000"
menu_xmb_animation_horizontal_highlight = "0"
menu_xmb_animation_move_up_down = "0"
menu_xmb_animation_opening_main_menu = "0"
menu_xmb_thumbnail_scale_factor = "100"
midi_driver = "alsa"
midi_input = "Off"
midi_output = "Off"
midi_volume = "100"
netplay_allow_slaves = "true"
netplay_check_frames = "600"
netplay_input_latency_frames_min = "0"
netplay_input_latency_frames_range = "0"
netplay_ip_address = ""
netplay_ip_port = "55435"
netplay_mitm_server = "nyc"
netplay_nat_traversal = "true"
netplay_nickname = ""
netplay_password = ""
netplay_public_announce = "true"
netplay_request_device_p1 = "false"
netplay_request_device_p10 = "false"
netplay_request_device_p11 = "false"
netplay_request_device_p12 = "false"
netplay_request_device_p13 = "false"
netplay_request_device_p14 = "false"
netplay_request_device_p15 = "false"
netplay_request_device_p16 = "false"
netplay_request_device_p2 = "false"
netplay_request_device_p3 = "false"
netplay_request_device_p4 = "false"
netplay_request_device_p5 = "false"
netplay_request_device_p6 = "false"
netplay_request_device_p7 = "false"
netplay_request_device_p8 = "false"
netplay_request_device_p9 = "false"
netplay_require_slaves = "false"
netplay_share_analog = "1"
netplay_share_digital = "1"
netplay_spectate_password = ""
netplay_start_as_spectator = "false"
netplay_stateless_mode = "false"
netplay_use_mitm_server = "false"
network_cmd_enable = "false"
network_cmd_port = "55355"
network_on_demand_thumbnails = "true"
network_remote_base_port = "55400"
network_remote_enable = "false"
network_remote_enable_user_p1 = "false"
network_remote_enable_user_p10 = "false"
network_remote_enable_user_p11 = "false"
network_remote_enable_user_p12 = "false"
network_remote_enable_user_p13 = "false"
network_remote_enable_user_p14 = "false"
network_remote_enable_user_p15 = "false"
network_remote_enable_user_p16 = "false"
network_remote_enable_user_p2 = "false"
network_remote_enable_user_p3 = "false"
network_remote_enable_user_p4 = "false"
network_remote_enable_user_p5 = "false"
network_remote_enable_user_p6 = "false"
network_remote_enable_user_p7 = "false"
network_remote_enable_user_p8 = "false"
network_remote_enable_user_p9 = "false"
overlay_directory = "~/.config/retroarch/overlay"
ozone_collapse_sidebar = "false"
ozone_menu_color_theme = "1"
ozone_truncate_playlist_name = "true"
pause_nonactive = "true"
perfcnt_enable = "false"
playlist_directory = "~/.config/retroarch/playlists"
playlist_entry_remove_enable = "1"
playlist_entry_rename = "true"
playlist_fuzzy_archive_match = "false"
playlist_show_inline_core_name = "0"
playlist_show_sublabels = "true"
playlist_sort_alphabetical = "true"
playlist_sublabel_last_played_style = "0"
playlist_sublabel_runtime_type = "0"
playlist_use_old_format = "false"
quick_menu_show_add_to_favorites = "true"
quick_menu_show_cheats = "true"
quick_menu_show_close_content = "true"
quick_menu_show_controls = "true"
quick_menu_show_download_thumbnails = "true"
quick_menu_show_information = "true"
quick_menu_show_options = "true"
quick_menu_show_recording = "true"
quick_menu_show_reset_core_association = "true"
quick_menu_show_restart_content = "true"
quick_menu_show_resume_content = "true"
quick_menu_show_save_content_dir_overrides = "true"
quick_menu_show_save_core_overrides = "true"
quick_menu_show_save_game_overrides = "true"
quick_menu_show_save_load_state = "true"
quick_menu_show_set_core_association = "true"
quick_menu_show_shaders = "true"
quick_menu_show_start_recording = "true"
quick_menu_show_start_streaming = "true"
quick_menu_show_streaming = "true"
quick_menu_show_take_screenshot = "true"
quick_menu_show_undo_save_load_state = "true"
quit_press_twice = "true"
record_driver = "ffmpeg"
recording_config_directory = ""
recording_output_directory = ""
resampler_directory = ""
rewind_buffer_size = "20971520"
rewind_buffer_size_step = "10"
rewind_enable = "false"
rewind_granularity = "1"
rgui_aspect_ratio = "0"
rgui_aspect_ratio_lock = "0"
rgui_background_filler_thickness_enable = "true"
rgui_border_filler_enable = "true"
rgui_border_filler_thickness_enable = "true"
rgui_browser_directory = "~/"
rgui_config_directory = "~/.config/retroarch/config"
rgui_extended_ascii = "false"
rgui_inline_thumbnails = "false"
rgui_internal_upscale_level = "0"
rgui_menu_color_theme = "4"
rgui_menu_theme_preset = ""
rgui_particle_effect = "0"
rgui_particle_effect_speed = "1.000000"
rgui_show_start_screen = "false"
rgui_swap_thumbnails = "false"
rgui_thumbnail_delay = "0"
rgui_thumbnail_downscaler = "0"
run_ahead_enabled = "false"
run_ahead_frames = "1"
run_ahead_hide_warnings = "false"
run_ahead_secondary_instance = "false"
runtime_log_directory = "default"
savefile_directory = "~/savefiles"
savefiles_in_content_dir = "false"
savestate_auto_index = "false"
savestate_auto_load = "false"
savestate_auto_save = "false"
savestate_directory = "~/savestates"
savestate_thumbnail_enable = "false"
savestates_in_content_dir = "false"
scan_without_core_match = "false"
screen_orientation = "0"
screenshot_directory = "~/screenshots"
screenshots_in_content_dir = "false"
settings_show_achievements = "true"
settings_show_ai_service = "true"
settings_show_audio = "true"
settings_show_configuration = "true"
settings_show_core = "true"
settings_show_directory = "true"
settings_show_drivers = "true"
settings_show_frame_throttle = "true"
settings_show_input = "true"
settings_show_latency = "true"
settings_show_logging = "true"
settings_show_network = "true"
settings_show_onscreen_display = "true"
settings_show_playlists = "true"
settings_show_power_management = "true"
settings_show_recording = "true"
settings_show_saving = "true"
settings_show_user = "true"
settings_show_user_interface = "true"
settings_show_video = "true"
show_hidden_files = "false"
slowmotion_ratio = "3.000000"
soft_filter_enable = "false"
soft_filter_index = "0"
sort_savefiles_enable = "false"
sort_savestates_enable = "false"
state_slot = "-1"
statistics_show = "false"
stdin_cmd_enable = "false"
streaming_mode = "0"
suspend_screensaver_enable = "true"
sustained_performance_mode = "false"
system_directory = "default"
systemfiles_in_content_dir = "false"
threaded_data_runloop_enable = "true"
thumbnails_directory = "~/.config/retroarch/thumbnails"
twitch_stream_key = ""
ui_companion_enable = "false"
ui_companion_start_on_boot = "true"
ui_companion_toggle = "false"
ui_menubar_enable = "true"
user_language = "0"
vibrate_on_keypress = "false"
video_adaptive_vsync = "false"
video_allow_rotate = "true"
video_aspect_ratio = "-1.000000"
video_aspect_ratio_auto = "true"
video_black_frame_insertion = "false"
video_context_driver = ""
video_crop_overscan = "true"
video_disable_composition = "false"
video_driver = "gl"
video_filter = ""
video_filter_dir = "/usr/share/video_filters"
video_font_enable = "true"
video_font_path = "/usr/share/retroarch-assets/xmb/monochrome/font.ttf"
video_font_size = "32.000000"
video_force_aspect = "true"
video_force_srgb_disable = "false"
video_frame_delay = "0"
video_fullscreen = "true"
video_fullscreen_x = "1280"
video_fullscreen_y = "720"
video_gpu_record = "false"
video_gpu_screenshot = "false"
video_hard_sync = "false"
video_hard_sync_frames = "0"
video_max_swapchain_images = "3"
video_message_color = "ffff00"
video_message_pos_x = "0.050000"
video_message_pos_y = "0.050000"
video_monitor_index = "0"
video_msg_bgcolor_blue = "0"
video_msg_bgcolor_enable = "false"
video_msg_bgcolor_green = "0"
video_msg_bgcolor_opacity = "1.000000"
video_msg_bgcolor_red = "0"
video_post_filter_record = "false"
video_record_config = ""
video_record_quality = "4"
video_record_scale_factor = "1"
video_record_threads = "2"
video_refresh_rate = "60.002399"
video_rotation = "0"
video_scale = "3.000000"
video_scale_integer = "false"
video_shader_delay = "0"
video_shader_dir = "/tmp/shaders"
# tweaked for fzero
video_shader_enable = "true"
video_shader_watch_files = "false"
video_shared_context = "true"
video_smooth = "false"
video_stream_config = ""
video_stream_port = "56400"
video_stream_quality = "9"
video_stream_scale_factor = "1"
video_stream_url = ""
video_swap_interval = "1"
video_threaded = "true"
video_vsync = "true"
video_window_opacity = "100"
video_window_save_positions = "false"
video_window_show_decorations = "true"
video_windowed_fullscreen = "false"
video_windowed_position_height = "720"
video_windowed_position_width = "1280"
video_windowed_position_x = "0"
video_windowed_position_y = "0"
vrr_runloop_enable = "false"
vulkan_gpu_index = "0"
wifi_driver = "null"
xmb_alpha_factor = "75"
xmb_font = ""
xmb_layout = "0"
xmb_menu_color_theme = "4"
xmb_scale_factor = "100"
xmb_shadows_enable = "true"
xmb_theme = "0"
xmb_vertical_thumbnails = "true"
youtube_stream_key = ""
Lima

About the author

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

Comments

    1. There are notes on this page to create a system service, which you can configure to load on system boot. Alternatively, just type retroarch from the console.

Leave a Reply

%d bloggers like this: