Triple Boot Raspberry Pi on USB (Raspbian / RetroPie / OpenELEC) – Part 1 37

WordPress Logo The new Raspberry Pi, dubbed the Raspberry Pi 2 Model B, is by far a welcomed improvement over its predecessors. The new version of this amazing device boasts a Quad Core ARM 7 (1000Mhz) CPU and 1 GB of RAM, essentially supplying the end user with 6-times the processing power of the Raspberry Pi 1 at the same $35 (USD) price point.

Wouldn’t it be cool if you could install three OSes; Raspian, RetroPie, and Openlec – all on the same card! In this blog  series, I’d like to share with you what I intend to do with mine. Moreover, I’ll show you how it all comes together using freely available tools.

I will assume the reader is somewhat comfortable with the Linux Operating System, command line and knows how to use SSH. Furthermore, I will use Ubuntu Desktop 14.04 as the OS of choice to perform all the disk manipulation operations – specifically, the tools GParted and dd will be employed to achieve the final goal. But assuming you could find suitable alternatives, this guide should work on any OS.

While I’m here, just a word of caution for the guide that follows.

A command like dd copies data from one location to another, overwriting existing data as it goes. Needless to say, this can be dangerous and is most certainly irreversible. Don’t blindly copy the commands below without ensuring they’re applicable to your specific case – adapt them if necessary. Don’t use dd while sleep deprived. You have been warned.

Why do this, Stupidhead!

Well, good question. we could simply buy three SD cards, install the OS on each and be done with it – true, but that’s no fun…Besides we’re going to kill two birds here – I will move each OS to a fast USB flash drive instead of using the corruption prone SD cards, which have been known to cause some frustration – especially if overclocking. Only caveat to all of this, is that NOOBS requires a keyboard to select an OS on boot up. But I have a solution for that as well. I provide a script that will reboot into any OS via SSH on demand. But let’s save that for the end.

So what will we install? Yeah what, dude?

A general purpose OS, a retro-gaming platform, and a media center – pretty sweet right? Oh yeah, I will not delve into the specifics of each OS and instead will focus on the project as a whole, with the ultimate goal of having a triple boot system to show off to your friends (if they find that kind of thing cool, that is…)

These are the OSes:

  • Raspbian (2015-02-16) – a free operating system based on Debian optimized for the Raspberry Pi hardware
  • RetroPie (v2.6)– a  project that turns the Raspberry Pi into a dedicated retro-gaming console
  • Openelec (v5.0.2) – a small Linux distribution built from scratch as a platform to turn your Raspberry Pi into a Kodi (previously XBMC) media center

Things You Will Need

  • A Raspberry Pi (Thank You, captain obvious!)
  • An SD card (16Gb or more, microSD if RPi2)
  • An optional 4 GB SD card
  • A USB flash key (32Gb or more, preferably USB 3.0)
  • Miscellaneous things for the Pi (Power Adpater, HDMI cable, SD card to USB adpater, yada, yada, yada…)
  • A Ubuntu desktop system (really any OS for that matter, assuming you have a good partitioning tool and access to the dd binary)
  • Time away from the wife/girlfriend

Step 1 – RetroPie

At this point, this may appear counter-intuitive but we need to install RetroPie on an SD card as though we’re only installing one OS – just go along with me!

Download the RetroPie image from here (select the appropriate image for your version of the Raspberry Pi). As of this writing, I’m using the v2.6 rpi2 image. Using an SD to USB adapter, unzip and write the image to your SD card from the Ubuntu desktop, while taking note of which device your SD card is, mine is sdb.

gzip -d retropie-v2.6.0-rpi2.img.gz
sudo dd if=./retropie-v2.6.0-rpi2.img of=/dev/sdb bs=1M

Once complete, stick the SD card in the Raspberry Pi and boot up. You can expand the filesystem if you like but don’t bother doing any elaborate configurations at this point. To expand the file system use:

sudo raspi-config

Now SSH into your new install (user:pi/password:raspberry) and let’s begin to create a backup of the OS, specifically the root and boot filesystems.

cd /
sudo tar -cvpf root.tar /* --exclude=proc/* --exclude=sys/* --exclude=dev/pts/* --exclude=media/*
cd /boot
tar -cvpf boot.tar .

The next step requires to zip the created tarballs but unfortunately we will run into memory issues if we attempt to do this on the Raspberry Pi itself, at least I did! So copy the created tarballs from the Pi to your desktop. Use whatever method you feel comfortable with. I’ll use SSH from my desktop this time, copy the files and zip them up.

mkdir ~/working
cd ~/working
scp pi@<IP_ADDRESS_OF_RPI>:/root.tar .
scp pi@<IP_ADDRESS_OF_RPI>:/boot/boot.tar .
xz -9 -e root.tar
xz -9 -e boot.tar

You should now have two compressed files: root.tar.xz and boot.tar.xz. You can now delete the tarballs from the RetroPie install, but it’s not necessary as we will be wiping the card soon enough.

Step 2 – NOOBS

To facilitate the install process, we will use a great tool called NOOBS . Once copied to your SD card and booted from the Pi,  NOOBS prompts the user to select an OS for installation (or many at one time) then does all the heavy lifting to create partitions and such. Download it here.

NOOBS will get us 2/3 of the way there as both Raspbian and Openelec are selectable OSes.  Unfortunately, as of the time of this writing, NOOBS v.1.4.0 does not contain a RetroPie install and it’s for this reason we created the tarballs in Step 1.

So once download, unzip the NOOBS zip file.

cp ~/Downloads/ ~/working
cd ~/working
unzip -d ./NOOBS_v1_4_0

Now we need to create the RetroPie install files using Raspbian as a template. Copy the Raspbian folder, and move the two compressed files from Step 1. Also you will need to delete the flavours.json file in the RetroPie directory to get it to show up in the boot menu.

cd ~/working/NOOBS_v1_4_0/os
cp -R Raspbian Retropie
cd Retropie
rm flavours.json
mv ../../../root.tar.xz .
mv ../../../boot.tar.xz .

Of course, it’s not as simple as that. Let’s make some further changes. We need to alter the file os.json in the RetroPie directory.
I only changed name and descrption.

  "name": "Retropie",
  "version": "wheezy",
  "release_date": "2015-02-16",
  "kernel": "3.18",
  "description": "Retropie 2.6 image install",
  "url": "",
  "username": "pi",
  "password": "raspberry",
  "supported_hex_revisions": "2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,1040,1041"

Now alter the key uncompressed_tarball_size in the file partitions.json which is in the same directory as above. For the values, I simply rounded up as an approximation.

  "partitions": [
      "label": "boot",
      "filesystem_type": "FAT",
      "partition_size_nominal": 60,
      "want_maximised": false,
      "uncompressed_tarball_size": 15,
      "mkfs_options": "-F 32"
      "label": "root",
      "filesystem_type": "ext4",
      "partition_size_nominal": 2700,
      "want_maximised": true,
      "mkfs_options": "-O ^huge_file",
      "uncompressed_tarball_size": 1600

Finally, I created an icon for the RetroPie install screen. You can download mine from here. Simply delete the Raspbian.png file and replace it with mine, make sure the name is Retropie.png (or whatever the directory is plus the .png extension).

Step 3 – Install OSes

Now comes time to install the OSes onto the SD card. Let’s begin by formatting the SD card we used for RetroPie. Use whatever method you’re most comfortable with, I will used GParted. GParted is graphical and pretty intuitive and is a good choice. Remove the existing partitions, create one large FAT32 partition and copy the NOOBS files. My partition is sdb1.

cd ~/working
sudo mkdir /mnt/usbstick
sudo mount /dev/sdb1 /mnt/usbstick
cp -R NOOBS_v1_4_0/* /mnt/usbstick
sudo umount /mnt/usbstick

With that done, pull out the SD card from your desktop and stick it in the Pi and cross your fingers. NOOBS should do some magic on boot up and then prompt you to select OSes to install. With any luck you’ll see RetroPie as an option. If so, good job! Install Raspbian, RetroPie and Openelec. This should take a little while. Once done, NOOBS will reboot and prompt you with a boot up screen (press 4 on boot up if using RCA video).

At this point, hopefully all is well. Poke around the OSes and join me in Part 2 of this series, where we move the root partitions to a quicker USB flash key and create a script that will reboot into any OS.

See you there!

Leave a comment

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.

37 thoughts on “Triple Boot Raspberry Pi on USB (Raspbian / RetroPie / OpenELEC) – Part 1

  • Iridium

    Nice guide, I wanna do this on my raspberry Pi 2, I’ll get it this monday and I’m a total NOOB on linux commands, Can you explain it for total noobs like me or at least give me some guides/tutorials to read before doing this. ?
    Thanx you!

    • bobby Post author

      I’m about to publish Part II of the guide and I’m hopefully being as thorough as possible. If not, or if there’s something you are unclear about, let me know.

  • Jason

    I had to delete the flavours.json file before it would load properly in NOOBS. Took me a while to figure out why RetroPie wasn’t showing up.

  • PHoNX

    Hi there!

    I need som help. I want to make my own noobs but when I try to make a backup from the sd card with ssh I had an error message:

    The firs one is this. I get when I use this command “sudo tar -cvpf root.tar /* –exclude=proc/* –exclude=sys/* –exclude=dev/pts/* –exclude=media/*”

    tar: root.tar: Wrote only 8129 of 10240 bytes
    tar: Error is not recoverable: exiting now

    The other one is it:
    tar: boot.tar: Cannot open: Permission denied

    Any idea?

    • Robert

      I also encountered the first error you mentioned. The instructions say “You can expand the filesystem if you like but…”. In my case, not expanding the filesystem caused this error because there was not enough free space on the partition to write the tar file. Expand the filesystem and you should be able to proceed without encountering this error.

      • Robert

        After posting my comment, I reread the instructions here. The problem I had reported was created by using the 3.0 beta of RetroPie vs the instructed version 2.6.

  • Diogo Ferreira

    Hey Booby, congrats for the initiative… I was trying to find a project exactly like this one with the triple boot. I will start mine this week and after finish I’ll back to give my feedback. Thanks!

  • Barty

    I’m finishing with following error:
    Retropie: Error executing partition setup script …

    So, shall the left unaffected?

  • Hani

    Great write-up. I’ve managed to get through part I and that’s as far as I will go for what I need. I’ve got all three images working for the most part except with Retropie – I cannot access contents of the SD card or an inserted USB thumb drive via the /media directory. It comes up blank for some reason.

    My knowledge is somewhat limited but aren’t the drivers for media located in /sys which we’ve excleded during making of /root tarball?

    sudo tar -cvpf root.tar /* –exclude=proc/* –exclude=sys/* –exclude=dev/pts/* –exclude=media/

    BTW, Why do these need to be excluded from the tarball anyway?

    • bobby Post author

      Hi Hani,
      Thanks for stopping by. Your USB thumb drive is probably not mounted correctly or mounted elsewhere. Try running the mount command to see where it’s mounted. Much of what gets excluded are temporary file systems (/proc, /sys, and /dev). These temporary file systems usually get populated on boot and probably would cause problems if you did backup.

  • Biorix

    Hi !
    First I want to thank you for this, I had trouble finding a tuto like that ! That was really clear and simple !
    However, I have a problem during the installation :
    Retropie is in the choices of NOOBS but after 5 % of the installation (the different partitions has been created) I have a error about a trouble with the tarball. Do you experienced something like that ?
    Although, I have to admit that I forget to cross fingers during the NOOBS part as you said… I hope it was the only problem. :-p

    Thanks again !

  • Jack

    Just an FYI for other Mac OS X users, I had to install XZ Utils binary package for Yosemite. Otherwise, I was getting a terminal error: “-bash: xz: command not found”Also, thanks for this guide!

  • theghostofelvis


    I found this interesting article and have one question!

    Is it possible to put this 3 Retrogame releases (Retropie,Raspicade and RecalOS) + Raspian onto one SD Card ? Can the same method be used, as You used for this article?

    Would be great if You can give me an answer!

  • Vivek

    i have successfully run commands to create root and boot tar balls but it taking forever to compress them using pi2. can u explain me how to copy tarballs to my windows pc?
    once i have tar balls i can use 7zip to compress them

  • jj

    Hey, im doing this on a mac so does this work if i use terminal? And after i download raspbian, retropie and xbmc, i want to partition it so that raspbian uses 10gb, xbmc 6gb, and retropie 16gb, how do i do this?(im using a kingston 32gb micro sdhc card and a raspberry pi 2)

    • bobby Post author

      I’m sure there are ways to accomplish this with Mac OS X partitioning software, however, I use GParted on Ubuntu which is free and quite intuitive – that’s the route I’d go with. I’d suggest installing VirtualBox and Ubuntu Desktop as a Virtual Machine, such that you can follow the guide.
      Good luck!

  • Nicholas

    Hi and many thanks for this tutorial. I’m not really sure about why is it important to use a USB flash key (is this a normal USB pendrive?) Is it noticeably faster than microSD card? I’m happy to skip the part about transferring to a pendrive if the difference isn’t so great.

    Also there is no detailed info as to how to install OpenElec. I suppose that I need boot.tar.xz and root.tar.xz. I’m currently in the process of installing OpenElec on its own in my microSD card and then creating a tarball of /root and /boot, although I’m not sure if this is the way to go…

  • Liam

    Thanks for the guide. Just used it to make my own triple boot system except I got it working with the latest versions of NOOBS & Retropie. Don’t think I need to follow Part 2 and 3, it seems to be working how I want already.

  • Peter

    Thanks for the guide, it’s exactly what I was looking for. However, I am using a Pi Zero and do not have it set up with network capabilities, so I can’t use the ssh commands. Is there another way to accomplish the same tasks without a network?

    • bobby Post author

      Hi Peter,
      Thanks for stopping by! The guide assumes that NOOBS will install Raspbian and Openelec for you via the internet (more specifically, download the images to the SD and install them). Although the commands can always be entered with a USB keyboard, without network capabilities NOOBS won’t download any images at all. As a workaround, I assume you could download the images yourself and then put them onto the NOOBS microSD card with a USB SD Card reader/writer.

      But overall, I think your best bet is to pick up a cheap WiFi adapter known to work with the Pi and a powered USB hub. In all likelihood you’ll need them eventually and they will most certainly make your life easier for basic tasks like copying ROMS and so forth…
      Good Luck!

  • Bart Milosz

    Quick question, just tried this on a Raspberry Pi 3, not booting. However I have noticed that the “copy onto the SD card” bootloaders like noobs and berryboot seem to not be booting. In order to get them to work its just a simple matter of formatting the card then placing the folder on it right? I have gotten it to work with an actual image of retropie itself and raspbian.

    • bobby Post author

      Hi Bart,
      I wish I could help but unfortunately I don’t have a Raspberry Pi 3 to test, and I really can’t say whether it would work on the RPi3 or not. And yes, formatting and copying should work with bootloaders like NOOBS.
      Though, I’d appreciate if you can report back with your findings.

  • George

    This was really helpful, better than the official advice on the Retropie wiki! I wonder why they don’t yet support NOOBS by default?

  • aaron

    Hi Bobby,

    We’ll I really love your work here. I installed it from a while, I saw another tutorial from YouTube and we’ll, everything worked great.

    Some days back I updated retropie to latest version, everything fine with the commands and installation (just the skins didn’t work that well)

    The I updated Kodi to latest version, works great (some issues on the way with the skins no showing the other systems)….

    Then I ran couple of commands on raspbian

    sudo apt-get update
    sudo apt-get upgrade

    And well….. I screwed up ever right there on raspbian affecting all the graphs and getting some errors during upgrade due some dependencies.

    My question is to know if you have any intention of create a new version of the boot and if you have any recommendations based on what I just explained.

    • bobby Post author

      Thanks for visiting my blog!
      I hope to produce an updated version soon, time permitting of course.
      I’m not too sure what you mean when you say it affected the graphs? I’m sure you can apply the same methodology on whatever versions of RetroPie/Kodi are currently available.

      • The Domo Guy

        I did this using OSMC with the old Confluence skin. Somehow certain graphics are gone. For example the skin has a horizontal ‘ribbon’ with the menu options. That is supposed to have a bluish background. That background is gone so it is mere transparent and therefore hard to read. The same applies for backgrounds of most menu items. The files on the multiboot SD card are exactly identical to those on the source ‘OSMC only’ SD card.
        On the multiboot card, Raspbian is in the first OS en OSMC the second one. Is there something hard coded in OSMC that expects OSMC to be the first OS or something like that?