Category Archives: Media Center

Hyperion+RetroPie+Kodi=Bliss!

UPDATE: SteamLink is now available in the experimental packages inside RetroPie. Since Hyperion uses the whatever is output to the screen to drive the LEDs, SteamLink works in this setup as well!

Back at it again.  Due to funding issues, I have been using all the spare parts that I have acquired over the past 1-2 years.  This week it was finally time to put the blinky lights to good use.  Just about 3 years ago I had attempted to set up BobLight using a Raspberry Pi 2, Kodi, and a set of WS2801 LEDs.  This worked ok, but it wasn’t the greatest.  The majority of the time, only the set that was nearest to the Pi would light up, the remainder would work intermittently, if at all.  This caused the project to be put on the back burner since the cost of the LED strip and connectors made it not worthwhile to replace the setup.  Fast Forward 2 years, and I acquired a 5m length of WS2812B LEDs, an Arduino compatible Nano, yet another Raspberry Pi 3, and a 5V/8A power supply. Continue reading Hyperion+RetroPie+Kodi=Bliss!

Full setup of Retropie.

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

Replacing a PC and Pogoplug with a Raspberry Pi 3

For the past two years, I’ve had a hacked together system combining a desktop PC running Ubuntu headless and a Pogoplug v4 running Arch Linux ARM headless.  The PC handled all download scheduling, Pihole, centralized media library database for 4 instances of Kodi, external SSH access, and for a brief time an instance of MythTV.  The Pogoplug v4 handled the shared 10 TB of hard drives on the network over Samba, and formerly external SSH until a botched update broke SSH.  Attempts to restore SSH access to the Pogoplug were temporarily successful, until updates once again borked it.

Now I’m rebuilding the setup under a single Raspberry Pi 3, for power consumption reasons and simply because I’m bored.  Come along on the journey, while we explore if all of this functionality can be placed into an SBC (no MythTV is not being installed on the Pi 3, although previously that has occured).  I’m mostly interested in how many simultaeneous HD streams it can serve up over the 100 Mbps ethernet that is shared with the USB 2.0 bus.  I have no reason to beliew

The first step in any project like this is to choose the base operating system which will enable the Pi 3 to do all the necessary functions.  On researching the options available, I had a choice to make.  0) I can do it the hard way, start with the most recent version of Raspbian,  or 1) I could install a system that has some or all of the functionality built in and add on as required.

I went with option 1, because I was on a bit of a time constraint and really wanted to finish the process in under 4 hours.

As already discussed, Raspbian was out, because although it can be done, I really wanted to be lazy.  The next option was OpenMediaVault.  This would serve all of my file server need, and would only need to add on SabNZBD, Sonarr, CouchPotato,  HeadPhones, and MySQL to complete the process.  This seemed easy enough, but attempting to log in over ssh at the start was a hassle, and mono would need to be compiled for the processor.  Since I don’t have a cross compiling environment configured, it was on to plan B.

Plan B was DietPi.  I had never heard of this software prior to this grand experiment, but was willing to give it a chance.  After all, the setup I have currently works, the worst that would happen is I keep the existing arrangement if it fails to function.

DietPi on first boot, seemed like a winning choice.  I’m a big fan of running things headless, since that means I can sit in the comfy chair at my desk, and ssh into the device.  DietPi does not launch a GUI on first boot, instead it displays the ip address, user name, and password, and leaves it to you to figure out that things should be configured over SSH.

Once I was able to log in over ssh, I logged out, and performed my favorite bash command “ssh-copy-id”.   I really can’t stand having a SSH server accept password authentication, and this system would not fall into that trap.  Besides, I have seen way too many attempts to try to brute force a password with a user name of “pi”.  This is one of the favorites to attempt by people who practice the “throw it at the wall and see if it sticks” method of intrusion.  No reconnaissance, just blast everything that has port 22 open to the world with a username of pi and password raspberry, and you are bound to get a shell somewhere.  I can’t really fault them, it works because many people don’t change default passwords.

On logging in, the Diet-Pi configuration wizard loaded up with many options, and to my suprise, almost everything I needed was available.  PiHole, Sonarr, SabNZBd, Deluge, NFS, and Samba servers.  No standalone MySQL server (many choices for webserver stacks, but I didn’t want to be installing unnecessary packages) which will be rectified later.  HeadPhones was also missing from the easy list, but I can live without that for now.

After what appeared to be a very long wait for software to install, I finally was able to start configuring everything that had previously been set up between the two boxes that were in use.  A great part about the software being used, is that the configuration files are the same across platforms.  Copy the files to the right locations, modify a few server calls to reflect the new ip address, and back in business like before.

The incredibly hard part was configuring Samba on the pi.   This wasn’t because Samba is hard in itself, but more because I had a very outdated configuration file.

All told, the total time taken was just over 9 hours to get everything “close enough” which included forgetting that I mounted the USB drives under a home directory for a user I had yet to create and wasting 2 hours trying to get NFS working rather than troubleshooting to make my smb.conf file compatible with Samba 4.

 

 

 

RetroPIe!

 

UPDATE: Relocating the home folder to a USB flash drive is a much better option.  Found that folders don’t ln -s very nicely.  Editing fstab and referencing the drive by UUID is the more elegant solution.  Added bonus, can power down, plug into a PC and update the games more easily.

I’ve been playing with RetroPie this weekend on a Raspberry Pi 3.  Using iBuffalo controllers I purchased from Amazon.  The micro SD card I am using is only 8GB, however all the guides I’ve seen list a difficult method for installing games to an external USB drive.  RetroPie simply runs a Linux distribution, and as such has access to all types of fun file tools.  In this case, the easiest one I’ve found is to use symbolic links to the external drive.  This takes a little bit of work setting up ssh access and some command line kung-fu, but it is basic stuff.  Retropie expects to find the files for each system in ~/RetroPie/roms/{systemname}.  By default the first external drive is mounted at /media/usb0/.  If we take this information we can “ln -s /media/usb0/{systemname}/* ~/RetroPie/roms/{systemname}/”.    As far as the operating system is concerned, it will check the default folder and treat the files as if they were where they belonged.   All my games are already sorted by system so I just have to link each file to the default folders.

Added bonus, it’s also possible to install Kodi in RetroPie, making this an all in one system for retro gaming and media playback.

 

Sideloading apps

While attempting to assist someone with getting apps loaded onto a Android TV Stick,  I ran into a slight problem.  A parental control pin was enabled, and I had no way of immediately getting in touch with the person.  In app configuring couldn’t be done without the pin, since the app wouldn’t launch without asking.  After some hunting to try to locate where the system stores whether the app has launched before, I had an idea.  Go in through adb, and try launching from the shell.  Lo and behold it worked, but still wouldn’t launch afterwards from the gui.  Doesn’t matter to me as the owner knows the PIN code.  I got what I needed to do done, and confirmed everything was working.  If anyone is interested the appropriate code to launch it through adbFire was located here.    A little massaging was needed since we already had an adb shell through adbFire, and voilà.  The app runs without a pin code.  Not an elegant solution since we need adb access to allow it to run every time without the PIN, but it’s functional for my needs.   As far as massaging the command, it was as simple as dropping “adb shell” from  the beginning.

Raspberry Pi 3 — Finally using it

Hello again,

It’s been a long time since an update has been posted here, however this will hopefully become a weekly thing.  Today, as it is the beginning of a new year, I am going to be pulling out a piece of neglected (at least in my life) tech.  I’ve had my RaspberryPi3 since shortly after its release, however never set anything up on it more than RetroPie since all my Pi2s are running media center’s and I have a dedicated PC running my MythTV setup.  That will soon change since i feel this board should have the needed horsepower to do something fun.  Already it has been run as a RetroPie system, however I am currently missing controllers (They vanished).   Maybe a portable game console would be a great addition to my collection, but I feel it should look good too.  The 7″ lcd screen I have works well with it, but i feel I am missing some necessary hardware to make it pop.  Maybe a 3-D printer is in my future for a custom printed case to hold it all together.  Keep watching this space for updates, which should be coming more frequently.

The things I do to myself.

A bit of background first…. When it comes to media center software,  this isn’t my first rodeo.  I’ve been running Kodi since it was XBox Media Center.   If I search hard enough, I’m sure I can find an XBox laying around here somewhere that still has the software on it.  That being said, I should have known better than to embark on my current quest to run a MythTV backend on a Raspberry Pi B+, on the same network as a OpenElec install on the same network.  First up, I need a TV tuner.   Some research later, but not very good research, I settled on this little guy.   This turned into an epic fail since I live in the US, and the DVB-T adapter, while having many useful features as a Software Defined Radio dongle (SDR), it is completely useless as a TV tuner stateside.  Oh well, it will eventually be turned into a ADS-B receiver to track flights overhead, or maybe grabbing NOAA weather satellite images out of thin air.   At 11$, it’s not too big a mistake, and it has other applications.    Continue reading The things I do to myself.