Setting up RetroPie


I wanted to play some old video games, and I had a Raspberry Pi B+ lying around, so I thought I would check out RetroPie and get that working.

Flashing an image to an SD card using OS X

I downloaded the image (I used retropie-v3.3.1-rpi1), flashed it to a 4GB SD card, and set up the Pi.

$ mount
# Looking for my SD card
/dev/disk2s1 on /Volumes/NO NAME (msdos, local, nodev, nosuid, noowners)

$ diskutil unmountDisk /dev/rdisk2
Unmount of all volumes on disk2 was successful

$ sudo dd bs=1m if=Downloads/torrent/retropie-v3.3.1-rpi1.img of=/dev/rdisk2
# ^T will show you the progress here

$ diskutil unmountDisk /dev/rdisk2
Unmount of all volumes on disk2 was successful

Finding your hard-wired Pi without keyboard access

I use a MacBook as my primary computer and don't have any other keyboard, so typing on the Pi was my first difficulty. The Pi may output its IP address during the bootup process, but I didn't catch it. Fortunately, this is pretty easy to work around for a hard-wired Pi: I can just use the default hostname. This wouldn't work if my Pi had been using wifi, because I would have needed to configure the SSID and password, but I'm fine since I am using a wire.

$ ping retropie.local
ping: cannot resolve retropie.local: Unknown host

In this case, the hostname didn't work. Maybe my router was misconfigured, or maybe this distribution doesn't support this feature. Still, we can use nmap to find the IP address, then ssh in using the default login (pi / raspberry):

$ nmap 10.0.1.\*

Starting Nmap 6.46 ( ) at 2016-01-01 18:24 PST

I'm going to be looking for something with ssh running. My Pi ended up being this one:

Nmap scan report for
Host is up (0.018s latency).
Not shown: 997 closed ports
22/tcp  open  ssh
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds

Nmap done: 256 IP addresses (5 hosts up) scanned in 55.26 seconds

$ ssh -l pi
pi@'s password:
Linux retropie 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jul 20 17:08:12 2014

  .~~.   .~~.    Saturday,  2 January 2016,  2:26:08 am UTC
 '. \ ' ' / .'   Linux 4.1.13+ armv6l GNU/Linux
  .~ .~~~..~.
 : .~.'~'.~. :   Filesystem      Size  Used Avail Use% Mounted on
~ (   ) (   ) ~  /dev/root       2.3G  2.0G  168M  93% /
( : '~'.~.'~' : ) Uptime.............: 0 days, 00h05m18s
~ .~       ~. ~  Memory.............: 132632kB (Free) / 250352kB (Total)
 (   |   |   )   Running Processes..: 71
 '~         ~'   IP Address.........:
   *--~-~--*     Temperature........: CPU: 41°C/105°F GPU: 41°C/105°F
                 The RetroPie Project,

pi@retropie ~ $

Setting up AFP to connect to a Time Capsule

Now that I had the keyboard set up I proceeded to use the on-TV instructions to set up an XBox 360 wired controller. Then it was time to set up some games. My games are stored on a Time Capsule file server, so I will need to set up that service. I basically followed this guide.

pi@retropie ~ $ sudo service samba stop
pi@retropie ~ $ sudo update-rc.d samba disable
# These two disable the samba sharing service. This isn't necessary, but I
# am not going to use it.
pi@retropie ~ $ sudo apt-get install fuse afpfs-ng
pi@retropie ~ $ sudo usermod -aG fuse pi
# Log out and back in
pi@retropie ~ $ sudo chown root:fuse /dev/fuse
pi@retropie ~ $ sudo chmod 660 /dev/fuse
pi@retropie ~ $ sudo mkdir -p /mnt/TimeCapsule/Data
pi@retropie ~ $ sudo chown -R pi:pi /mnt/TimeCapsule/
pi@retropie ~ $ mount_afp afp://"Ryan Patterson":"REDACTED"@ /mnt/TimeCapsule/Data

Note for anyone following along here, I was getting an obnoxious error that was quite difficult to track down. The error was:

Mounting from Data on /mnt/TimeCapsule/Data
Unmounting volume Data from /mnt/TimeCapsule/Data
Unknown error 1, 1.

This error is very uninformative, but I was able to use strace to find out that the problem was related to not having the fusermount program installed. This is provided by the fuse package, so make sure to install that.

Trying again with CIFS

I spent a lot of time trying to set up the connection to the service using AFP, but the daemon was crashing and I decided to switch to using CIFS, which was much easier to set up as well.

pi@retropie ~ $ sudo service samba stop
pi@retropie ~ $ sudo update-rc.d samba disable
# These two disable the samba sharing service. This isn't necessary, but I
# am not going to use it.
pi@retropie ~ $ sudo mount -v -t cifs // /mnt/TimeCapsule/Data -o user="Ryan Patterson",pass="REDACTED",file_mode=0644,dir_mode=0755,sec=ntlm,uid=1000,gid=1000,noserverino

I also needed to add a line to my /etc/fstab so that the share would be mounted on reboot (\040 is how you escape a space in fstab):

// /mnt/TimeCapsule/Data cifs user=Ryan\040Patterson,pass=REDACTED,file_mode=0644,dir_mode=0755,sec=ntlm,uid=1000,gid=1000,noserverino 0 0

Using the scraper with CIFS

I had a collection of ROMs and wanted to get the titles / box art in EmulationStation. EmulationStation's builtin scraper is ludicrously slow and only does 1 game at a time however, so I searched around and found a faster program that lives in the RetroPie "experimental" section, called Sselph's Scraper. However, it has a problem where it doesn't follow symlinks, which means that my symlinked ROMs folder isn't scanned. The workaround is as simple as adding a trailing slash to the pathname and running the scraper manually.

/opt/retropie/supplementary/scraper/scraper -image_dir /home/pi/.emulationstation/downloaded_images/snes -image_path /home/pi/.emulationstation/downloaded_images/snes -output_file /home/pi/.emulationstation/gamelists/snes/gamelist.xml -rom_dir /home/pi/RetroPie/roms/snes/ -workers 4 -thumb_only -skip_check

Future ideas:

While I was working on this project, I kept a list of the things that could be better. Maybe this will give you an idea for how to improve RetroPie.

  • I'd like to fix the wired XBox 360 controller blinking LED. Looks like the kernel module (xpad) does not have LED support compiled in?
  • I want a power switch for the Pi so I don't have to unplug the device to turn it off. Ideally, I'd like to find out how to get something that allows wireless xbox 360 controllers to power on the device using the button.
  • The libretro GUI (rgui) is rather primitive, and doesn't seem to be able to save configuration changes in the latest release.
  • I would like to automatically restore my save state when I power on an emulator.
  • I'd like to upgrade to a Raspberry Pi 2 and get N64 emulation running.
  • The bootup time is pretty high. What could be shaved out to speed it up?
A picture of Ryan Patterson
Hi, I’m Ryan. I’ve been a full-stack developer for over 15 years and work on every part of the modern tech stack. Whenever I encounter something interesting in my jobs, I write about it here. Thanks for reading this post, I hope you enjoyed it!
© 2020 Ryan Patterson. Subscribe via RSS.