Skip to content

Instantly share code, notes, and snippets.

@RJCuthbertson
Last active December 17, 2017 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RJCuthbertson/45734624e03b4dd0f844fa8bc8064cb7 to your computer and use it in GitHub Desktop.
Save RJCuthbertson/45734624e03b4dd0f844fa8bc8064cb7 to your computer and use it in GitHub Desktop.
The configuration changes I made after completing the install instructions on RetroPie's website

๐ŸŽฎ Intro

I threw together a couple Pi Carts with my brothers from the instructions here.

After going through the motions to get RetroPie up and running (with sound via HDMI and no green tint on the GameBoy screen) I figured I'd write up what I had to do in hopes that it will help someone else. I may add to this file as time goes on if I make any more config changes to my RetroPie install. You'll want both a USB controller and a USB keyboard attached to your Pi to make these changes.

NOTE: There are two RetroPie images provided by the official project: RetroPie 0/1 and RetroPie 2/3. This guide is intended for the RetroPie 0/1 image (though you may find it helpful for 2/3).

๐ŸŒ ๐ŸŒŽ ๐ŸŒ i18n

The Raspberry Pi Foundation is run by some Brits across the pond, so you'll find the default i18n settings are configured to Great Britatin's standards.

To change these settings to US (or if you're in another country, use the settings that apply to you), you'll first need to get to the shell. If Emulation Station is currently running, on your controller hit Start, press down to select Quit and hit A (or whatever you've configured confirm to be), select Quit EmulationStation and confirm, then confirm when prompted if you're sure to finally drop to the shell so we can get some real work done.

From the shell, enter the Raspberry Pi Configuration tool:

sudo raspi-config

You'll want to key down through the menu options to 4 Internationalisation Options and hit Enter. You'll change all 4 settings in this sub-menu, as outlined below:

  • Locale

    Choose I1 Change Locale and hit Enter.

    โ— IMPORTANT! Leave the locale setting of en_GB.UTF-8 UTF-8 enabled (at least until you've finished all the i18n changes).

    Key down through this list until you get to en_US.UTF-8 UTF-8 (or the locale of your country) and hit the Spacebar to enable this locale.

    Hit Enter to move to the next screen.

    You will be prompted to select the "Default locale for the system environment". Choose your newly added locale and hit Enter.

    The new locale will now be generated. You'll see some text at the bottom of the screen describing the system's progress.

  • Timezone

    Choose I2 Change Timezone and hit Enter.

    You'll be prompted to select your "Geographic area". Choose America (or your appropriate geographic area) and hit Enter.

    You'll be prompted to select your "Time zone". I chose Detroit - select the time zone most appropriate to your circumstances and hit Enter.

    The time zone is now set. You'll briefly see some text at the bottom of the screen notifying you of the new time zone value.

  • Keyboard

    Choose I3 Keyboard Layout and hit Enter.

    You'll be prompted to select your "Keyboard model". I chose Generic 104-key PC (even though my generic USB keyboard only has 103 keys ยฏ\(ใƒ„)/ยฏ). Select the value most appropriate to your keyboard and hit Enter.

    You'll be prompted to select your "Keyboard layout". This will most likely be English (US) if you're in the US, otherwise select the appropriate value and hit Enter.

    You'll be prompted to select an option for a "Key to function as AltGr". I chose Right Alt (AltGr) - you can choose whatever suits you... and hit Enter.

    Finally you'll be prompted to select an option for a "Compose key". I chose No compose key - you can choose whatever suits you... and then you'll hit Enter.

  • WiFi

    If your Raspberry Pi does not have a WiFi chip, and you don't intend to use a USB dongle to connect to the Internet with it, you can skip this step.

    Choose I4 Change WiFi Country and hit Enter.

    Scroll all the way down to US United States (or your country) and hit Enter.

    You'll see a message stating the setting has been changed. Hit Enter to continue.

At this point you'll want to reboot your Raspberry Pie to ensure all services on the device are using the newest i18n settings. Hit Tab to highlight Finish and hit Enter to exit. You should be prompted to reboot. Select Yes and hit Enter. Otherwise at the shell prompt type sudo reboot.

๐Ÿ”‰ Force audio through HDMI

When using the default settings of auto-detecting the 3.5 mm jack or HDMI to use for the audio output device, you may find you get no sound coming through your HDMI device. There isn't even a 3.5 mm jack on the Pi 0 in the first place, so if you're using a Zero (or Zero W), there shouldn't even be a question about whether this is the right option for you. This should be an easy fix. From the shell:

sudo vi /boot/config.txt

Find the line hdmi_drive=2 and uncomment it (press x once while hovering over the # character), then save and quit with :wq.

If this works, it's because your TV or monitor is using the HDMI in DVI mode, which does not transmit sound (hdmi_drive=1). The setting above will attempt to force the HDMI to use HDMI mode instead.

If that doesn't quite do it for you, additional settings you can add to this file that may help are:

hdmi_force_edid_audio=1 - "Pretends all audio formats are supported by display, allowing passthrough of DTS/AC3 even when not reported as supported." Source

int_soundrate=44100 - may resolve sound issues with DGEN Source

๐Ÿ“ถ Internet Connectivity

The RetroPie 0/1 image doesn't have connectivity in mind. Unfortunately, I've found that I couldn't get enough power supplied to the ports of a USB hub on a Pi 0 to run a WiFi adapter, so I had to remove my SD card from my Pi 0 and run it on a Pi 3. Don't worry, it didn't blow up or anything, but I immediately quit Emulation Station once it booted to drop to the shell, got my WiFi running, updated my software, and then put the SD card back in my Pi 0. You might have a Pi 0 W, in which case you wouldn't need to jump through these hoops, but I didn't want to sacrifice any processing power with the 0, and so opted out of using a 0 W. Alternatively, I've read you can use a powered USB hub with the Pi 0, but I haven't tried this (because I don't have a powered USB hub), so YMMV.

Remember, this is the RetroPie 0/1 image. I did the following to get connectivity to the web:

  • Add DNS servers:

    You add DNS servers to /etc/resolv.conf, one per line:

    sudo vi /etc/resolv.conf

    Google's DNS servers are 8.8.8.8 and 8.8.4.4. Or add your own.

    Save and quit with :wq.

  • Configure the network interfaces:

    To modify the interface configuration, we'll need to edit /etc/network/interfaces:

    sudo vi /etc/network/interfaces

    Then you'll want to edit the default wlan# configurations just a hair. Assuming your network supports DHCP, the wlan0 config will look like:

    allow-hotplug wlan0
    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    Make the wlan1 config look the same, except, you know, saying wlan1 instead of wlan0.

    If you don't have DHCP (or would prefer a static IP), change the line iface wlan0 inet dhcp to:

    iface wlan0 inet manual
    address 192.168.0.13
    netmask 255.255.255.0
    gateway 192.168.0.1

    And swap out the IPv6 address, netmask, and gateway addresses per your network configuration.

    Remember to save and quit with :wq.

  • Configure your WiFi network credentials:

    Finally, you'll add your WiFi network's credentials so your adapter will know what network to connect to. This gets added to your /etc/wpa_supplicant/wpa_supplicant.conf file, below anything that might already exist there. You can add the network ID and password as plain text, but that's a bad thing to do, because security ๐Ÿ”. Instead, you should generate an encrypted key to connect.

    sudo su
    # You should now be root
    # To append the encrypted key to the networks configuration file, run the following
    wpa_passphrase 'YourNetworkSSID' 'YourNetworkPassword' >> /etc/wpa_supplicant/wpa_supplicant.conf
    exit
    # You should no longer be root
    sudo vi /etc/wpa_supplicant/wpa_supplicant.conf

    You'll see that it's added a new network entry with your SSID, Password (commented out), and a blob of text after psk=. Delete your commented out password. You'll already have values for ssid and psk. Add the rest of these values:

    For WPA1:

    network={
      ssid="YourNetworkSSID"
      psk="YourNetworkPassword"
      proto=WPA
      key_mgmt=WPA-PSK
      pairwise=TKIP
      auth_alg=OPEN
    }

    For WPA2:

    network={
      ssid="YourNetworkSSID"
      psk="YourNetworkPassword"
      proto=RSN
      key_mgmt=WPA-PSK
      pairwise=CCMP
      auth_alg=OPEN
    }

    Refer to the Raspberry Pi Documentation - Setting WiFi Up via the Command Line for additional configuration scenarios.

  • Reconfigure and test:

    To get your interface to pick up these changes, run:

    wpa_cli -i wlan0 reconfigure

    And then run iwconfig to make sure your interface is connected to your SSID, and ifconfig wlan0 to ensure you have an IP address listed after inet addr:. Finally, try ping -c 3 google.com to ping Google 3 times to make sure you're connected.

If you still don't have connectivity, try Google and reading up on setting up your WiFi dongle on Linux. Helpful commands include iwconfig (for wireless), ifconfig (for wired - also ifup and ifdown), ping, nslookup, and netstat. This article might help, as well as this list of adapters known to work with the Raspberry Pi.

๐Ÿ’ป Update Software

โš ๏ธ IMPORTANT! If your RetroPie build is for a Raspberry Pi 0, you must have connectivity from a Pi 0 or from a Pi 0 W to run your software upgrade. You will not be able to upgrade from a different version of the Raspberry Pi (like the Pi 3), as the RetroPie setup scripts auto-detect the platform they're being run on and require network connectivity to run successfully.

As mentioned in the bold faced warning prior to this, the RetroPie-Setup scripts have some fancy logic to auto-detect the device type they're being run from. If you're curious how they do this, you can find the aptly named function get_platform() in the system.sh file, under /home/pi/RetroPieSetup/scriptmodules/system.sh or on their GitHub here.

First, you should use the update mechanism provided by RetroPie first. Only if this is causing errors should you use the second method outlined afterward. Both require web connectivity.

RetroPie Update

  • From within EmulationStation, select RetroPie in the list of Emulators, and select "RetroPie Setup".
  • The first selection you'll make in this menu is S Update RetroPie-Setup script. This validates that you can access the update scripts.
  • After doing this, then select plain old U Update.
  • You'll be asked for confirmation, and yes you want to update installed packages.
  • You should get notification that the latest version of the setup scripts have been retrieved. And then you'll get a copyright information dialog. Confirm past these.
  • You'll receive a prompt that says "Would you like to update the underlying OS packages (eg kernel etc)?" - select "Yes".
  • Wait.
  • Wait some more.
  • Go grab something to drink. You've got a minute.
  • As long as there were no errors, you should be good to go.

Manual Update

Once you've connected to the web, you'll want to get the latest versions of the software you're running on your little RetroPie. Run:

sudo apt-get update && sudo apt-get upgrade

This might take a while, depending on how long it's been since you installed RetroPie. Once this is over, you'll need to update the RetroPie Setup Scripts, by running cd /home/pi/RetroPie-Setup (Remember: capitalization matters on *nix systems) and then run git pull to get the latest scripts from the RetroPie GitHub account.

After this is completed, you'll want to re-run the RetroPie setup scripts. When Emulation Station loads, navigate to the RetroPie option in your list of emulators, and confirm. Select "Retropie Setup" and watch as โœจ RetroPie automagically updates itself โœจ... hopefully.

If not, you'll probably be looking at an error message like:

Did not find needed package(s): python-pyudev

Yeah... Aptitude has a habit of removing packages when you upgrade that it doesn't think you need anymore... except RetroPie's setup script might still need them, without letting the system know this. If this happens, run sudo apt-get install <your package name> to install the missing package, and try to run the setup scripts again until it works. ๐Ÿ”

Either Update Method

If errors are encountered by the RetroPie Setup scripts using either update path, relevant errors can be found in the logs under ~/RetroPie-Setup/logs/some_file_name.log.gz where some_file_name will include the date and time the scripts were run. This isn't just the errors though. This is all of the output generated by the setup scripts. So you'll probably want to use vi and Page Down / Page UP. Find the error and resolve it. If you don't know how, try Googling the error. That's what most people who work in IT do.

An error I ran into:

"xpad patch retropie.diff failed to apply"

To resolve this, I:

  • Uninstalled xpad via the setup script menu (Manage Packages > Manage driver packages > 841 xpad).
  • Deleted all files and folders in /opt/retropie/supplemental/xpad including the xpad folder.
  • Reinstalled xpad via the setup script menu.
  • Ran U Update again via the setup script menu.

๐Ÿ”ฒ Remove Green GameBoy Screen Tint

If you run any GameBoy games you'll notice there's a green tint to the screen that looks whack. To fix this:

  • Run any GameBoy rom.
  • Hit Select + X to open the RetroArch GUI.
  • Select Options.
  • Change GB Colorization to internal.
  • Change Internal Paletter to GBC - Grayscale.
  • Press B to exit this menu.
  • Select Save Core Overrides.
  • Select Resume.

This should have saved this change for all GameBoy roms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment