Full setup of Retropie.

Facebooktwittergoogle_plusFacebooktwittergoogle_plus

In this posting, I’ll be walking you through a setup of Retropie on the Raspberry Pi3.  We’re going to be working exclusively in GNU/Linux in this tutorial, as all the necessary software is already included in most distros, and most of the file systems we will be working with are ext3/ext4.  If you are unfamiliar with GNU/Linux, I will post a guide later on creating a live distro environment to use for this task.  Another option would be to virtualize a GNU/Linux system through Virtual Box or similar software and have USB passthrough enabled to access the drives through the virtual machine.  This is outside of the scope of this tutorial.

Necessary items for the Setup–

Raspberry Pi 3 – either by itself or as part of a kit with power supply, case, and HDMI cable.

Controllers- My favorites are iBuffalo SNES style and knock off PS3 style

A keyboard for the Pi3 — any usb keyboard will work.  I like this one.

And if you want to make it look awesome, you could always get this because, nostalgia.

First, download the most recent version of RetroPie for the Raspberry Pi 3.  This can be found at https://retropie.org.uk/download/.  Once this is done, we can extract the contents of the archive.  My personal favorite for this is a small program called dtrx .  This usually is not included with your distro of choice but can easily be acquired through your package manager.  On a Debian based system this would use the command “sudo apt install dtrx” in the terminal.   Then type “cd Downloads” since this is where the file should have saved, and then “dtrx <filename>”.  Tab completion helps here.  Simply type the first few letters of the filename,  which should be “retr” press tab on the keyboard, and bash should fill in the rest.

Next plug in your micro SD card to the computer, not the Pi.  Wait for the drive to mount and in your terminal type “dmesg | tail”.  This gives a readout of the last ten lines of the kernel buffer.  This will provide you with the /dev name of your connected drive.  Usually this will be in the format [sdX] with X being a letter that is displayed in the terminal, in this screenshot

dmesg output
Output of dmesg

, you can see mine is sdc.   We can do the same with the “mount” command if you know what you are looking for, but for now dmesg is our best option.  The disk I am using just happens to be sdc, so all of my commands will use this.  Be sure to substitute your own that was found with dmesg | tail for your own use.

Now that we have our image file and our SD card /dev reference, we can start the process of writing the image to the card.  If you have made sure that you have the right /dev reference this is not a dangerous thing, but be warned, using the wrong /dev reference will all but guarantee you a bad day.  The next command is “sudo dd if=<imagefilename> of=/dev/sdX”.  This will take a few minutes to write depending on the speed of your SD card and other variables.  Once it is done, place the SD card into the Raspberry Pi with it connected to a screen, and let it do its magical resizing of the partitions.

Now that the partitions are resized we can start configuring.  The Emulation Station frontend will load automatically, and ask you to start configuring your controllers.  At this point, we are not going to configure them.  I’m personally more of a fan of installing all my games on a USB drive.  This is a personal choice, and if you prefer to keep them on the SD card, you can skip the next part.

Power off the PI properly.  This can be done by pressing F4 and the keyboard and typing “sudo poweroff” in the terminal that loads.  Once the PI safely shuts down, remove the SD card.

We are going to take the SD card, and a USB flash drive (the larger the better) to our GNU/Linux workstation.  Insert the USB drive into the machine.  The majority of USB drives sold in stores are by default formated to FAT32.  Retropie can read this file system, but I prefer to rewrite them to be ext4 formatted.  Again personal preference, lifespan be damned.  To do this, I use gparted.  With the drive formatted now to ext4, unplug and replug in the drive.   In a terminal, run “dmesg | tail” again to find the /dev/sdX designation of the flash drive.  This may be the same as it was for the SD card since the SD has been removed, and then run “sudo blkid”.  We are looking to find the UUID of the disk we just formated and it will be preceded on the screen by the /dev/sdX designation.  This is a long number made of hexadecimal digits, and we will copy this to the clipboard.  The next step is to plug in the SD card we created, and navigate to partition that is not called “boot”  this should automount under the /media/$USER/ folder.   You can then copy the contents of the /home directory on the SD card to the USB drive.  This can be accomplished by “rsync /media/$USER/SDCARDDIRECTORY/home/ /media/$USER/USBDIRECTORY/ -aP” .  Once this completes, use the command “sync” to ensure all data is copied.  then delete the contents of the /media/$USER/SDCARDDIRECTORY/home.  You can use the rm command for this, like so “rm /media/$USER/SDCARDDIRECTORY/home/* -R”.  Next up, we are going to tell RetroPie that we want to use the home directory we create on the USB drive as the home directory for RetroPie.  We will do this by modifying the fstab file in /media/$USER/SDCARDDIRECTORY/etc/.  To do this type “sudo nano /media/$USER/SDCARDDIRECTORY/etc/fstab”  a simple text editor will appear that doesn’t require dark magic to navigate, unlike vim.

In nano, you’ll see something like this.

fstab screenshot

What we are going to do is add a new line, telling fstab what the USB drive is and to mount it at boot time into /home.  This looks like this, and all you need to do is change the UUID to the one that was copied earlier from “sudo blkid”

fstab with uuid
fstab updated

Now that we have that set, we can proceed to copying our game files over.   Since we still have our USB plugged into the PC, we can do this natively, and RetroPie has laid out the folders in a straightforward manner.  All the game files go under RetroPie/roms with separate subdirectories for each game system.  Additional systems can be installed later, and rsync’d across the network over ssh or via smb shares.  The next part of the puzzle, is what kind of controllers do you wish to use.  There are many choices out there, and some work better than others.  The two of which I am a fan are listed above.

Both of these work well for casual gaming, and I’ve used both with the only caveat being that the controllers are defined in RetroPie as Shanwan Clones.  The default bluetooth stack does not work with these.  RetroPie takes care of installing the correct software, but bluetooth keyboards will cease to work when using any type of PS3 compatible controller.  For the cost of them though in my opinion, it is worth the trade-off.

Boot up your RetroPie system now, and we can start to configure the controllers and add additional software.  Once booted exit out to the command line by pressing F4 on the keyboard.  Type “cd RetroPie-Setup” and then “sudo ./retropie-setup.sh” .  This loads the RetroPie configuration application where we can update, install new software, and configure the PS3 controllers.  First select update, and allow the software to do it’s thing.  The next step I usually take is to go to manage packages then manage optional packages and install Kodi.  I really like this software, and has been in use in my household since the days of the softmodded original XBox with the “Duke” controller.  I also am running another Pi3 as a file server on the network that feeds videos and music to everything on the network, so one multipurpose box taking up an HDMI port is always a win.

If using the PS3 controllers your next step is to install the drivers/this is under Configuration/Tools then ps3controller.  Follow the directions on-screen and you’ll be able to use the wireless controllers.

Finally, the last step of my install is to get moonlight up and running.  Moonlight is cross-platform streaming software that takes advantage of the Nvidia game streaming system that is available on Windows.  I have a ridiculous collection of Steam games, a Steam Link, and the Steam Controller, but my TV used to only have one HDMI port, and it got old swapping cables.

To install Moonlight, exit out to the command line again, ensure that you are connected to the network on your RetroPie, confirm you have game streaming enabled on your gaming computer and in the command line on your RetroPie type “cd” to return to the home directory.  Type “wget https://raw.githubusercontent.com/TechWizTime/moonlight-retropie/master/moonlight.sh –no-check” to download the latest version of Tech Wiz Time’s Moonlight install script.  Type “sudo chmod +x moonlight.sh” to allow the script run permissions.  Type “sudo ./moonlight.sh” and follow the onscreen instructions.

Now that everything is installed, you can reboot the pi with “sudo reboot” or simply type “emulationstation” in the terminal, configure your controllers,  and start your adventure re-playing the classics from your childhood.  If you have any questions, please feel free to ask below.  Any requests for where to find games will be directed to lmgtfy.com

One thought on “Full setup of Retropie.”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.