March 13, 2014 - mikeyD

RetroPie Installation Guide For The Raspberry Pi

Retro Pie

Update:
Be sure to checkout my new project on GitHub, called RetroRig which aims to bring retro gaming to x86_64 systems with relative ease!

The Rasperry Pi is a pretty amazing low-cost computer. While the 25/35 dollar asking price doesn’t include everything you need, it is still a very cheap entry price for the great things you can do with it. Whether that be a game console, a media center, learning tool, or just another computer, the Pi puts you smack dab in the middle of it. Sure, there are alternatives, but few in this price range are of this high notoriety.

Table Of Content

1. Requirements

2. Installation

2.1 Prepping the SD Card

2.2 Transferring the .img file

1) Using dd:

2) Using Unetbootin

2.3 Connecting it all together

3. RetroPi system configuration

3.1 Configuring the Xbox 360 Controller

1) Setting up the configuration file:

2) Enabling script to run at boot time:

3.2 The controller setup screen (finally!)

1) Easy Method

2) Manual Method

3.3 Adding 2 player support

1) Easy Method

2) Manual Method

3.4 Adding ROMs to your Retro Pie

1) Basic Setup

2) Manual Method 1 (Samba)

3) Manual Method 2 (SCP)

4) Some additional notes

3.5 Almost ready to game!

3.6 Exiting and shutdown/restart

3.7 Adding Wireless (optional)

1) Required Programs

2) Start the wicd daemon

3) Scan for available networks and get network details:

3.8 Configuration file

1) Connecting to the network

4. Maintenance / Updating

4.1 Updating the RetroPie binaries

5. Useful Tips and Tricks:

5.1 Exiting a game with a controller:

5.2 Finding your button numbers:

6. Troubleshooting:

6.1 No HDMI TV Output

6.2 Game freezes / EmulationStation freezes after exiting with Joypad

6.3 Changing default game emulators

6.4 Crackling Sound / Overclocking

1) Modifying the audio backend

2) Overclocking to fix sound

6.5 Where are my games?

6.6 Help! My ROMs won’t launch!

1) MAME ROMs

6.7 Controller woes

1) Easy Method:

2) Manual Method

3) Reconfiguring the gamepad(s)

4) Editing buttons after the fact:

5) I updated the RetroPie binaries/source, and now the controller doesn’t work!

6.8 2-player Controller issues

7. Common Issues

7.1 Retro Pie

7.2 Emulation Station

7.3 Other things you can try

1) Update to the latest emulation station

8. External Resources

1. Requirements


While the model A board (25 USD) will work, if you can spring for the model B board (35 USD), go for it. You’ll wish you had that extra USB port and extra RAM (512 MB total). Trust me. As for needed accessories, it is a good idea to purchase a kit to ensure you have all that you need. For the purposes of this How-To, I purchased this kit on Amazon. If you don’t make sure you have the following:

  • Ethernet Cord
  • WiFi adapter that is compatible with the OS you are using (optional)
  • 4 GB or more SD card (class 4 or better is recommended)
  • A micro-USB power supply (5 V power output)
  • Powered USB hub (optional, for more ports)
  • Xbox 360 Controller (well what are you going to use, your mind?)

There are two such projects that can get you in the right direction here: Retro Pie and Puppy Arcade. For this demonstration, I’ll be using the Retro Pie distribution, which is specifically targeted at this device. Puppy Arcade is still a very fine choice for this type of project.  The PetRockBlock download page also contains schematics and other documentation if you wish to review those materials. Note: In a future How-To, installing Puppy Arcade will be covered, so Puppy Linux fans, don’t worry, I got your back.

Retro Pie

2. Installation

2.1 Prepping the SD Card


Like many of the Raspberry Pi images out there, this distribution’s download is an ready-made SD card image that is pre-set to install the necessary components for Retro Pie. Ensure that the card is freshly formatted if it has been used before, with either a CLI utility of the useful GParted software. You’ll want to format the SD card as the “FAT32” file-system. Once the zip file is downloaded, extract the contents to a designated folder. The zip file will contain an .iso image, which must be transferred to the SD card.You can open the zip file with your distributions native “Archive Manager” or unzip the file with ‘unzip’ as so: Unzip into current directory:

unzip -e archive.zip

Unzip to a specified directory:

unzip archive.zip -d /path/to/other/directory/

2.2 Transferring the .img file

The easiest method is to use dd for a simple iso file. You may also use Unetbootin if you wish. Both are explained below.

1) Using dd:

List the connected devices on your system:

[email protected] /mnt> lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 223.6G  0 disk 
├─sda1   8:1    0  1007K  0 part 
├─sda2   8:2    0    80G  0 part /
├─sda3   8:3    0     8G  0 part [SWAP]
└─sda4   8:4    0 135.6G  0 part /home
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part /mnt/server_media_x
sdc      8:32   0 465.8G  0 disk 
└─sdc1   8:33   0 465.8G  0 part /mnt/dvd_archive
sdd      8:48   0 596.2G  0 disk 
└─sdd1   8:49   0 596.2G  0 part /mnt/bluray_archive
sde      8:64   0   1.8T  0 disk 
└─sde1   8:65   0   1.8T  0 part /mnt/backup_drive
sdh      8:112  1  29.7G  0 disk 
└─sdh1   8:113  1  29.7G  0 part /run/media/mikeyd/RETROPI
sr0     11:0    1  1024M  0 rom  
[email protected] /mnt>

Now make the image, substituting the location for each of your disks. Do not use in your location, only the identifier. In my example, that would be “/dev/sdh”

sudo dd bs=1M if=/home/mikeyd/RetroPieImage_ver1.9.1.img of=/dev/sdh
sudo sync

Confirm the records in matches records out:

875+0 records in
875+0 records out
3670016000 bytes (3.7 GB) copied, 469.942 s, 7.8 MB/s

Once complete, insert the SD card into the Pi and power it on.

2) Using Unetbootin

Screenshot from 2014-04-07 17:25:30

Using Unetbootin is incredibly easy. Like above, first identify your device with either lsblk, or your preferred command. Select “Disk Image” and locate the “RetroPieImage_verx.x.x.img” file you extracted earlier. Select the type as USB, and the drive location of your SD card. Click OK.

Retro Pie

2.3 Connecting it all together


Note: Be careful about removing and adding USB devices while the Pi is powered on! Your device may reboot if you remove or add devices while turn on. Next, assemble all the pieces of the Pi together, with the “power supply” micro USB connection last. This includes the SD card, the HDMI cable, ethernet cable / WiFi adapter, keyboard and and an optional Xbox 360 controller. You do not need a mouse to setup the system. There is no traditional “on/off” switch on a Raspberry Pi. The system will turn on automatically once the USB power cable is connected. Once the Pi boots to the RetroPi image, you’ll see a configuration screen for the controller input. You cannot proceed just yet. Hit F4 on your keyboard to exit the automated installer.  Next we will do some “preparation steps” so RetroPi is fit for duty.

3. RetroPi system configuration

raspi-config

First, enter “raspi-config” to enter the default Raspberry Pi configuration menu (seen above).  Now, follow these steps (make use of the TAB key to navigate):

  • Option 1 “Expand File System”, Enter on “OK”
  • Option 4 “Internationalisation Options”, Select your locale/timezone/keyboard layout.
  • Option 8: “Advanced Options”, choose the entry to enable SSH access (optional)

Finally, navigate down to “Finish” (with TAB) and hit ENTER to confirm, then “Yes”. Your Pi will now reboot.

3.1 Configuring the Xbox 360 Controller


Now comes the fun part! (pun intended) Once the Raspberry Pi reboots back into the controller configuration screen again, hit F4 on your keyboard to exit once more. Now we are going to install the infamous and very useful “xboxdrv” utilty.

sudo apt-get update
sudo apt-get install xboxdrv

Once xboxdrv is installed, we’ll need to setup the controller to load the right configuration when the Pi boots up. You should be in your “home” folder, if not, i’ll include the command if so.

1) Setting up the configuration file:

Note:For ease of use, I have provided the below script on GitHub. The script is obtainable by running the following:

git clone https://github.com/ProfessorKaos64/raspi

2) Enabling script to run at boot time:

cd ~
sudo cp /home/pi/raspi/xboxconfig /etc/init.d/
sudo chmod 755 /etc/init.d/xboxconfig

If the last command, which enables dependency based boot sequencing for your new script

sudo update-rc.d xboxconfig defaults
sudo reboot

Full code for script is below (for study):

#! /bin/sh
# /etc/init.d/xboxconfig
#
# Some things that run always
touch /var/lock/blah

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script xboxdrv "
    xboxdrv --trigger-as-button --id 0 --led 2 --deadzone 4000 --silent & sleep 1
    ;;
  stop)
    echo "Stopping script xboxdrv"
    /usr/bin/xboxdrv -kill
    ;;
  *)
    echo "Usage: /etc/init.d/xboxdrv {start|stop}"
    exit 1
    ;;
esac

exit 0

Note: If the Xbox 360 controller is wireless, replace “id” with “wid” in the command line.  Use “CTRL+O” to save the file, then “CTRL+X” to exit. For additional areas of concern, please see “Troubleshooting” at the end of this article.

3.2 The controller setup screen (finally!)


After the last reboot, you should no longer see  the “cannot find controller” message, and your Xbox controller should no longer flash incessantly with all four lights, rather link up the player 1 indicator. Follow the prompts to set the initial controller buttons.

1) Easy Method

The last screen of the emulation station GUI (the screen after full bootup) has a configuration utility at the very end if you should need to reconfigure you controller:

controller-setup

I actually like to run this even after the initial setup screen, as it contains other configurations (such as button assignment for the different emulator engines)

2) Manual Method

Exit the Emulation Station one last time by pressing the “F4” key and run the following commands:

cd RetroPie/emulators/RetroArch/installdir/bin
./retroarch-joyconfig >> ~/RetroPie/configs/all/retroarch.cfg

Follow the onscreen directions for configuring your controller. This will load the Xbox compatible configuration into the RetroPi.Don’t worry, if you mess up pressing the buttons, simply rerun the command again.su Note: Buttons can be ascertained by using ‘RetroArch-Phoenix’ or ‘retroarch-joyconfig’ Once complete, perform a system reboot:

sudo reboot

 

3.3 Adding 2 player support


1) Easy Method

The easiest way to go about this, is to reconfigure your controllers with the Start.sh script, which is also the last page of the emulationstation GUI screen after your Pi is full booted. Simply follow the on-screen prompts.

2) Manual Method

Adding support is very easy, if you use the same controller. Because you must copy a large amount of text to make an easy configuration change here, it is best to SSH in, so you have full mouse support, or type “startx” to get the Raspbian GUI desktop. If you choose to use the CLI to copy the text in the nano text editor, move the cursor to the start of the text you want to select, press the Alt-A key combination to mark the start, then move the cursor to the end of the section you want to select. Use “CTRL+SHIFT+C” to copy, and “CTRL+SHIFT+V” to paste First, open retroarch.cfg:

sudo nano /home/pi/RetroPie/configs/all/retroarch.cfg

Next, locate this line (CTRL+W to search):

input_player1_joypad_index = "0"

Check the lines that follow, and then copy them, down to the last in that section. After the last line, leave a blank line and then paste the selection. You’ve duplicated the first controller profile, but you will need to edit the new block of code so that each instance of “player1” now reads “player2” Here’s an example. The first two lines of the pasted segment should read:

input_player2_joypad_index="0"
input_player2_a_btn = "1"

Repeat until you reach the end of the copied code, then save and close.

3.4 Adding ROMs to your Retro Pie


There a few ways to transfer ROMs to the Retro Pie:

  1. SSH (if you enabled it)
  2. A spare USB drive

1) Basic Setup

The preferred method is to use a spare USB if you have one. I will still detail the manual method below.

  1. Remove the Xbox controller (you’ll need the port temporarily)
  2. Shutdown the pi with “sudo shutdown -r now”, and remove the power after all messages clear
  3. Connect a spare USB stick (your data will not be overwritten, but back it up if you wish to be safe)
  4. Power on the Raspberry Pi
  5. Give the USB drive some time to create the “roms” folder after starting up (if you have an indicator light, wait for it to stop”
  6. Unmount the drive with “sudo umount /media/usb0”
  7. Connect the drive to your other machine
  8. Copy ROMs into predefined folders

Important Note! Once your ROM directory structure is setup, you can now power off the Raspberry Pi, and insert the SD card in spare computer to transfer future ROMs.  Below is the location of the ROMs and emulators:

/home/pi/RetroPie/roms

2) Manual Method 1 (Samba)

I actually prefer this method, as you will be able to easily transfer ROMs over your file browser or via the Sabma CLI. Start by opening the appropriate config file:

sudo nano /etc/samba/smb.conf

I prefer setting my own server line:

# server string is the equivalent of the NT Description field
   server string = retropie

This is how I construct my homes on my personal machines, but your mileage may vary. I do not use the predefined commented fields for the home sharing. You can remove those entries or comment them out.  My area of the config is as such:

[RetroPiehome]
   comment = Home Directories
   path = /home/pi
   browseable = yes
   writable = yes
   read only = no
   create mask = 0644
   inherit acls = yes
   valid users = pi, mikeyd

Important! If you choose to use my configuration share above, be sure you do not duplicate or leave duplicates of any of the entries, especially “valid users”! Add the pi user to Samba:

sudo smbpasswd -a pi

Restart samba

sudo service samba restart

Connecting via the file browser At first, your file browser, under “Network” will connect as you, on your local system. If you choose “retropie” as a selection, you may only get read access. Therefore be sure to enter the share fulling into the location bar or choose the corresponding share in the home drive location.

smb://retropie/RetroPiehome

You will then be prompted to enter credentials, and if you wish to save them.  Enter the credentials of the “pi” user from your RetroPie config.

3) Manual Method 2 (SCP)

The default password, if you did not change it is “raspberry”

ssh [email protected]rypi
scp [email protected]_host:remote_file local_file

4) Some additional notes

  • PSX ROMs have the available extensions (by default of) .img .IMG .7z
  • You can try to add/change accepted ROM extensions in your “/home/pi/.emulationstation/es_systems.cfg” file

3.5 Almost ready to game!


Once your ROMs are copied over, reconnect the USB stick/drive to the Raspberry Pi and reboot it. Note: You may have to give the Raspberry Pi some considerable time to copy over all the ROMs you transferred over previously (depending on their size and count). If need be, remove the USB drive after unmounting it, and reconnect the Xbox 360 controller and reboot. [sda] Attached Important! When you first launch Emulation Station (your emulator), it starts at the Apple II emulator. Press left or right to switch between emulators. You should start with Doom, Duke Nukem 3D, PC, and a few others. The NES, SNES, Genesis (and so on) will not show up until you put some ROMs on your SD card. If there are emulators that you do not want to show up in the list, delete their folders from the SD card. I deleted pretty much everything except for Atari 2600, NES, SNES, and Genesis (Megadrive), since those are the only ones that I use. It will substantially cut down on your list of items to scroll.

3.6 Exiting and shutdown/restart


To exit Emulation Station, press Esc or your custom buton configuration noted below in the next section. Pressing this a second time on the emulator select screen will bring up the shutdown/restart menu, which will actually shutdown the Pi (fully).

Retro Pie

3.7 Adding Wireless (optional)


Not many guides about Retro Pie really detail wireless, so I’ll break it down for you. We will be configuring wireless on the command line, since there is no traditional “GUI” to Retro Pie.

1) Required Programs

sudo apt-get install wireless-tools wicd wpasupplicant

Note: If you chose a wireless USB adapter that is not automatically recognized, please see the Debian Wiki. A decent list of known good adapters, but not exhaustive, is located a eLinux. Usually the adapter included with a purchased bundle will work just fine. Identify your device (I removed wired entries for readability):

[email protected] /mnt> ifconfig

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether xx:xx:xx:xx:xx:xx  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Take not of the adapter name above, in my case “wlp0s29u1u2”.  On the Pi, yours should be listed as wlan0 or wlan1. If not already performed, add your regular user account to the netdev group and reload DBus (should already be added):

adduser pi netdev
/etc/init.d/dbus reload

2) Start the wicd daemon

sudo /etc/init.d/wicd start

3) Scan for available networks and get network details:

sudo iwlist scan

Take note of the “ESSID” and “IE” lines, which note the network name and security (respectively). Most adapters and routers these days use WPA if not setup yourself, but you can’t always be too sure.

3.8 Configuration file

Next, add/edit your network in “/etc/network/interfaces":

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
    wpa-ssid "ssid"
    wpa-psk "password"

In the above code (big thank you to adafruit) :

  • replace wlan0 with your adapter name
  • Replace “ssid” with your network name
  • Replace “password” with your wireless password key
  • For further information on available configuration options, see man interfaces, man wireless and /usr/share/doc/wireless-tools/README.Debian.

Arguments prefixed with “wpa-“,which are used for wpa_supplicant Managed Mode, are documented in /usr/share/doc/wpasupplicant/README.Debian.gz.

1) Connecting to the network

Bring the wireless interface up and down to connect to the wireless network:

sudo ifup wlan 0
sudo ifdown wlan 0

You should see “DHCPDISCOVER” start to search and add an IP address. If you added auto wlan0 as in the example above, the interface should be brought up automatically during boot up.

4. Maintenance / Updating


4.1 Updating the RetroPie binaries

Updating RetroPie from time to time is a good idea, especially if you are having issues.  Before updating, it is a good idea to backup and ROMs and config files first. Don’t say I didn’t warn you! This has helped me out with game freezes after exiting a game and more. To run the RetroPie Setup Script make sure that your APT repositories are up-to-date and that Git and the dialog package are installed:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y git dialog

Then you can download the latest RetroPie setup script with

cd
git clone --depth=0 git://github.com/petrockblog/RetroPie-Setup.git

The script is executed with

cd RetroPie-Setup
chmod +x retropie_setup.sh
sudo ./retropie_setup.sh

Be sure to select the “Update RetroPie Binraries” selection.  The source-based installation option is not necessary, but can be run if you wish to re-compile and re-configure specific components. Once the script downloads the “binariesDownload.tar.gz2,” it will commence updated. Reboot your Pi and check things out. Issues with HDMI Audio, Video, and game crashing are well know with some. It varies from TV to TV, of course.

5. Useful Tips and Tricks:


  1. If you have hundreds of games in an emulator remember what button you set as Page Up/ Page Down.  This will save you a ton of time.
  2. Remember! Some games cannot use the right or left joysticks by default (obviously games like those on an NES), nor would you want to.
  3. Remember what your exit key is (Esc by default on the keyboard) You can set this up to your liking with….
  4. You can get a GUI by exiting Emulation Station to the command line with F4, and typing “startx”. This is very useful if you wish to configure WiFi without the command line.
  5. You can  edit your systems config file (~/.emulationstation/es_systems.cfg) to remove emulators you don’t wish to use.. You can move, remove, or just comment out an unwanted entry (add a # at the very start of a line to comment it out). They’ll display in the order they’re listed.
  6. Many of the emulators allow ROMs to be in a “root folder,” such as “A” under the Mame ROM folder with many ROMs inside. Your mileage may vary.

5.1 Exiting a game with a controller:

You can set the controller button to exit a game, versus Esc by adding

"input_exit_emulator_btn = "btn#"

Subsitute the input # that applies above. Add this to  your “~/RetroPie/configs/all/retroarch.cfg” file, and you will be able to exit the emulator on a button press. I know of no way to do this with multiple buttons. Here, btn# has to be replaces by your desired button number on your gamepad/joystick. The following comes from here: If you add (for my SNES controllers button6 is select and button 7 is start) :

input_enable_hotkey_btn = 8
input_exit_emulator_btn = 9

…To your “~/RetroPie/configs/all/retroarch.cfg” file. You can now exit the emulator by holding select then pressing start. As explained here, do not use quotes! This is actually two lines that match exactly (minus the btn #) at the start of this section you can use. Uncomment the # comment symbol and change the button number.

5.2 Finding your button numbers:

sudo nano ~/RetroPie/configs/all/retroarch.cfg

Now, scroll/page down to the very bottom, or near it. You will see things labled “input_player” and so on. In this section, you can make out what “btn” # applies to the combo you want.

6. Troubleshooting:


6.1 No HDMI TV Output

I myself had this issue.  There are a number of things you can do, all of which are mostly located in the “/boot/config.txt” file.  Open the file with nano as root:

sudo nano /boot/config.txt

Inside this file are some key areas, which helped me out to a point.  The settings that helped me the most out personally are below.  My Sony TV I was using this on is 1366×768 (720p).

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1366
framebuffer_height=768

6.2 Game freezes / EmulationStation freezes after exiting with Joypad

See the  main section titled “Updating RetroPie”.  Corresponding helpful posts are below:

You can also try changing the default emulator noted in the relevant section below.

6.3 Changing default game emulators

Changing a default emulator is as simple as diving into /home/pi/emulationstation/es_systems.cfg seen below. In the example, I changed the default emulator to SNES9X, one of my favourites from years past.

DESCNAME=Super Nintendo
NAME=snes
PATH=/home/pi/RetroPie/roms/snes
EXTENSION=.smc .sfc .fig .swc .SMC .SFC .FIG .SWC
#COMMAND=/home/pi/RetroPie/supplementary/runcommand/runcommand.sh 1 "/home/pi/RetroPie/emulator$
COMMAND=/home/pi/RetroPie/emulators/snes9x-rpi/snes9x %ROM%
# alternatively: COMMAND=/home/pi/RetroPie/emulators/pisnes/snes9x %ROM%
PLATFORMID=6

6.4 Crackling Sound / Overclocking

Sound is a common issue with the Raspberry Pi, especially in this sort of application of your Pi. One common suggestion to to bump up the clock speeds on your Raspberry Pi. This may or may not solve all your sound issues, but it can help. You can also try modifying the audio backed and sample rates. Please see the warning below if you choose to over clock. There are also alternative emulators you can try, which may react differently to settings you have configured (see the troubleshooting section “Changing default game emulators.”

1) Modifying the audio backend

From puncrathod:

I managed to get perfect sound with retroarch+pocketsnes core by defining sdl as the audio backend with 44100 samplerate. However I never managed to get the thing run faster than 70% speed during actual gameplay. I tested it with lostvikings and when you pause the game the game runs fullspeed and the sound is perfect. But while playing the speed goes below 80% and the sound and music gets this echoing sound. I’ll see if I can make it run at full speed by a little overclock and some addinational video settings.

The only settings i changed in the /etc/retroarch.cfg was:

audio_enable = true
audio_out_rate = 44100
audio_driver = sdl
audio_sync = true

You can also try disabling “rewind” in /home/pi/RetroPie/configs/all/retroarch.cfg:

rewind_enable = fal

2) Overclocking to fix sound

WARNING:I am not responsible for any issues or permanent damage caused by overclocking. This will likely reduce the lifespan of the Pi, depending on how far you take the overclock.

sudo raspi-config

pi overclock

Some games have a crackling sound? The only way to get rid of this, is overclocking. For overclocking there aren’t “THE BEST SETTINGS”. You have to test your overclocking settings, how far you can go. To push the Raspberry Pi to the limits, I recommend you buy a heat sink. The crackling sound disappared, after I set armfreq to 950, corefreq to 450, sdramfreq to 450 and gpumem to 384.

sudo nano /boot/config.txt

Contents:

arm_freq=1050
gpu_mem_512=384
core_freq=500
h264_freq=0
isp_freq=0
avoid_pwm_pll=1
sdram_freq=550
over_voltage=6
avoid_safe_mode=1
force_turbo=0

The above settings, suggested by PetRockBlog seemed to help the sound on a lot of my MAME games, especially TMNT2 (which I love to death).  Your milage may vary. If your Rapberry Pi crashes (freezes etc.), please use lower settings. If your Rapberry Pi crashes (freezes etc.), please use lower settings. Sometimes it seems to run stable, but crashes in emulationstation or running a game. To test the stability and a possible SD Card corruption, I recommend to use a stresstest script. e.g. from elinux.org:

nano /home/pi/stresstest.sh
chmod +x /home/pi/stresstest.sh

Contents:

#!/bin/bash
#Simple stress test for system. If it survives this, it's probably stable.
#Free software, GPL2+

echo "Testing overclock stability..."

#Max out the CPU in the background (one core). Heats it up, loads the power-supply. 
nice yes >/dev/null &

#Read the entire SD card, 2x. Tests RAM and I/O
for i in {1..2}; do echo reading: $i; sudo dd if=/dev/mmcblk0 of=/dev/null bs=4M; done

#Writes 512 MB test file,  5x.
for i in {1..5}; do echo writing: $i; dd if=/dev/zero of=deleteme.dat bs=1M count=512; sync; done

#Clean up
killall yes
rm deleteme.dat

#Print summary. Anything nasty will appear in dmesg.
echo -n "CPU freq: " ; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
echo -n "CPU temp: " ; cat /sys/class/thermal/thermal_zone0/temp
dmesg | tail 

echo "Not crashed yet, probably stable."

To get the current temperature in an human readable output try “vcgencmd measure_temp”. I don’t know exactly, but on my experiences the Raspberry Pi freezes, if the temperature goes over 65 degrees celsius.

6.5 Where are my games?

Are they in the right folders? Remember, paths and file extensions are case sensitive. You can check what folders ES is using

nano ~/.emulationstation/es_systems.cfg

Each emulator has a certain folder it looks for. Some emulators allow folders as the title of the game, while others I have found, prefer a straight ROM dump of the games.

6.6 Help! My ROMs won’t launch!

1) MAME ROMs

It is possible (I can attest to this) that the ROMs will not work with the version of the emulator RetroPie has.

It’s  a pretty complex problem. You have to have MAME files from the http://blog.petrockblock.com/forums/topic/emulationstation-looping-back-to-menu-after-selecting-game/#post-2801, but you also need to have files for the same game from different romsets as well, and you can’t rename any of the files or use ES Scraper for MAME. I don’t understand why it works that way, but I’ve found if I change any one of those things, I can’t play the roms anymore.

I have found the Mame4All ROM set at multiple sites, which I cannot promote or list here. The one I found, required a donation, but was well worth it, as all my ROMs thereafter worked.

6.7 Controller woes

If you ever need to redo the controller configuration inside of the Emulation Station, type “rm /home/pi/.emulationstation/es_input.cfg” in the command line to delete your original setup. To return to the Emulation Station, type “emulationstation” in the command line. If you are playing a game, simply press the “ESC” key on your keyboard to return to the main menu.

1) Easy Method:

See the main section entitled: “The controller setup screen (finally!)” In summary, enter the configuration screen for controllers, located at the very end of the emulator select screen after full bootup.

2) Manual Method

3) Reconfiguring the gamepad(s)

You need to delete the configuration file that Emulation Station uses by invoking rm /home/pi/.emulationstation/es_input.cfg. Note that you exit Emulation Station by pressing F4. When you (re-)start Emulation Station, the configuration prompt will appear again.

rm /home/pi/.emulationstation/es_input.cfg
emulationstation

4) Editing buttons after the fact:

Typing “sudo nano /home/pi/RetroPie/configs/all/retroarch.cfg” in the command line will open a window that allows you to view and edit specific buttons on the controller.

5) I updated the RetroPie binaries/source, and now the controller doesn’t work!

This happened to me, and it was very frustrating. I could not figure out what was going on at first. I redid all my configs and already had a stressful day, But, as soon as I ran ‘sudo service xboxconfig start’, where xboxconfig is the service I mad to start xboxdrv, I got an error about the USB interface being claimed. Guess what it was?, xpad! Curse you!  It seems after the binary updates, xpad was introduced as a part of Raspbian or something or other. The easiest way to do this is to remove the xpad module, and then blacklist it.

echo "blacklist xpad" > /etc/modprobe.d/blacklist.conf
sudo rmmod xpad
sudo reboot

6.8 2-player Controller issues

Don’t even get me started on this one. Try your best to keep the same controller for both player 1 and player 2. Mixing controllers is a manual affair, and it is best to keep the same. On a second note, Xbox controllers work very well, but you don’t have to use an Xbox controller with the ‘xboxdrv’ module. xboxdrv handles just about any joypad, and is very versatile and customizable. Don’t assume that the default joypad driver will be the magic end-all-be-all.

7. Common Issues


7.1 Retro Pie

7.2 Emulation Station

7.3 Other things you can try

1) Update to the latest emulation station

Try to update to the latest version of EmulationStation using git (you might need to delete your es_input.cfg and es_settings.cfg after that to reset them to default values): cd EmulationStation git pull export CXX=g++-4.7 cmake . make

8. External Resources


Whether it be contributing an article online, engaging with the community, or diving head first into unknown waters, Linux is the focal point of my computing hobbies.

Gaming / How-To raspberry pi / RetroPie /

Comments

  • Steve Garner says:

    Xbox Driver: add –dpad-as-button is you want to be able to play games with either dpad or joystick

  • Scott says:

    Hey MikeyD — awesome tutorial. Any idea why my Super Mario Bros key mapping would be off with the wireless Xbox 360 controller? I’ve run through retroarch.cfg several times to no avail. For example, in Super Mario Bros, when I press DPad-Right, Mario goes right but also jumps, and when I hit A, Mario jumps but also goes back (DPad-Left). What could be wrong?

    • mikeyD says:

      The only thing I can think of, is trying to use that reconfigure controller window at the end of the emulator screens (as you go left/right in the main screen). Other than that, you’d probably have to look into how xboxdrv is mapped, but that is probably not necessary. Did you do the gamepad config? You could also submit an issue on the github page: https://github.com/petrockblog/RetroPie-Setup

  • Scott says:

    Yep, I did the Emulation Station config, and the menus and everything seem to work fine. Which reconfigure controller option are you referring to? I think I tried all those on the emulator screen config options, and they just popped me back into a linux console window rather than a nice GUI. 🙁

  • Scott says:

    Got the emulator inputs figured out. It was an xboxdrv issue upon startup. By the way you should include how to “blacklist” xpad in this tutorial..as folks will need to do that in order to get xboxdrv to work properly.

    One last problem — the inputs from the wireless xbox 360 controller lag ever so slightly. Any idea how to speed them up? This person also had the same experience: http://yetiblog1337.wordpress.com/2013/06/02/retropie-which-gamepad-should-i-use/

  • Peter Tinsley says:

    Installed the image to two 64GB cards using UNetbootin. Confirmed that all the files are present in the root folder but neither of them boot the Pi. Any suggestions please? Cheers

    • mikeyD says:

      Sorry I am actually leaving my house soon, but i’d love to check out your issue. I’m quite busy with my retro gaming project lately too. While you wait for me to check this out further did you contact anyone at the retropiesetup github site?

  • Peter Tinsley says:

    It was unetbootin that was at fault, doesnt write the image correctly, used win32diskimager to write the image and it now works fine. Cheers

  • Peter Tinsley says:

    The roms directory should be “/home/pi/RetroPie/roms/” I guess they changed the directory structure since this guide was written.

  • Rob says:

    I am trying to use the clone for the github file and it’s asking me for username and password for github. What are they?

  • Sam says:

    Hi can anyone help me in configuring a Buffalo USB SNES Controller button mappings to quit the Sega Master System emulator and return to emulation station
    currently I can Select the SELECT AND START buttons simultaneously from any Emulator and EXIT a game but not Sega Master System

    I hate unplugging the Power to my PI as I don’t want to corrupt the SD Card

    • mikeyD says:

      I had trouble with that too, which is why started a project for regular x86_64 PC’s on Ubuntu. What emulator is configured under your retroarch file? Is it using Mednafen, Gens, Pico?

  • hi! i just instaled retropie with emulationstation, i want to play with my keyboard but when i finish configuratin the buttons nothing happens, i cant press the ok at the end… still go back to the buttons options but cant go any far… any idea?

  • Jason says:

    wireless xbox 360 controller?

    I am unclear on the Raspberry Pi side . . . how does the Pi send and receive to and from the controller?

  • geannf says:

    I have two controls a PS3 and XBox360 other, what happens is that the retropie recognizes 3 controllers, and when I walk on emulators appears PS3 port # 0 xbox port # 1 and also appears xbox port # 2. I do not know why, but it seems that so retropie is lost and not let me use the second controller to the player 2 on emulators.

    When do the controllers tests with jstest command js0 or js1, also appears JS2, as another control xbox360, so that there JS2.

    Already I tried to find something to solve it and make retropie recognize only two controllers.

    When I add a driver in retropie setup as a new input appears up there one xbox360 control in port # 0 and another on port # 1, so that as I said before, there is no control on port # 1.

    Would know how to delete this ghost control, that such port # 1_?

    Please excuse me for the long text, and I hope you have understood my problem.

    Again I would be grateful for the help and attention.

    Hugs.

  • serhan says:

    Hi there, i’ve build up my project with using raspberry pi2. now i am playing mame games with no problem with my ps3 controller (still designing a custom joystick-button front panel). My coin acceptor is working fine, but i am planning to add a relay-based hardware for accepting coin when a game is started from emulator. Otherwise, coin will be wasted if i use my coin in emulation station. I want to use my coin acceptor closed on default and when a game is started, i would like to trigger a relay and make it on open position.

    I would like to ask you, is there any way to trigger a relay when a game is started from emulation station and close it on game close ?