If you want to spend less time swapping cards and more time playing with your Raspberry Pi, installing the BerryBoot multi-boot manager makes it dead simple to boot multiple operating systems from one SD card. Read on as we walk you through the process.
Why Do I Want to Do This?
BerryBoot is a boot management tool for the Raspberry Pi that adds quite a bit of functionality to the Raspberry Pi experience. The biggest benefit is that it allows you to boot more than one operating system off the SD card. You can store the operating systems either on the card itself or, if you want more room, you can configure BerryBoot to use the SD card only as a launcher and to run the operating systems off an attached hard drive.
In addition, the BerryBoot configuration tool makes it dead simple to download additional Raspberry Pi optimized distributions. The current Pi-optimized distributions included with BerryBoot are:
- BerryWebserver (Webserver Bundle: Lighttpd + PHP + SQLITE)
- Berry Terminal (LTSP/Edubuntu Thinclient)
- Raspbian (Debian Wheezy)
- OpenElec (Media Center Software)
- Puppy Linux
- RaspRazor (Unofficial Rasbian branch, lots of programming tools)
- Sugar (The One-Laptop-Per-Child OS)
In addition to the included distributions, you can also add your own Linux distributions either by downloading optimized images or by converting them to the SquashFS format and importing them to BerryBoot—more on this later.
In short, if you want to play with different tools and operating systems on your Pi without buying a bunch of SD cards, labeling them, keeping track of them, and swapping them out all the time, BerryBoot is an excellent way to get even more from your Pi with very little extra effort.
What Do I Need?
You’ll need a Raspberry Pi, appropriate peripherals, and internet access. We would suggest reading over our tutorial The HTG Guide to Getting Started with Raspberry Pi to make sure you have the basics covered (like making sure you have an adequate power source and the basics of configuring Raspbian).
In addition to the hardware requirements outlined in the tutorial, you’ll need to download the following file from the BerryBoot repository:
To get started extract the contents of the BerryBoot Installer .ZIP file to a FAT-formatted SD card you want to use as your multi-boot platform.
Once you have downloaded the installer and extracted the contents of it to your SD card, it’s time to get started. Pop the SD card in your Raspberry Pi unit and plug in the power cable to boot it up. You will see a brief boot process and then you’ll arrive at the GUI of the configuration wizard as seen below:
Take a moment to adjust the video output (select or deselect overscan based on whether or not you see the green calibration bars at the top and bottom of the screen). Set your network connection to wired or Wi-Fi. Finally, set your locale and keyboard preferences.
If you selected Wi-Fi for your network connection, you’ll be prompted to select a Wi-Fi network and enter that network’s passcode.
Note: This Wi-Fi setup only applies to the BerryBoot installer; once you install the distributions—like Rasbian—you’ll need to configure the Wi-Fi again within that distribution.
After you have configured the Wi-Fi or if you’re using a wired connection, you will be prompted to select a disk:
The default is the SD card. If you want to install the distributions to an attached flash or USB HDD, now is the time to attach it. Once you see the disk you wish to use (in our case, the SD card), select it and press the Format button.
After a minute or so, you’ll be kicked into the Add OS menu where you can select the first (of many) operating system you want to install to your BerryBoot card. To start with, we’re going to install Raspbian. After selecting it, press OK to start the installation process.
Once the image has finished downloading and installing, you’ll be presented with the BerryBoot menu editor:
Here in the menu editor, you can perform a wide variety of functions. You can add another operating system or remove existing ones, as well as set the default operating system. You can edit the properties of the individual images to change the name and the memory allocation. You can clone the operating system (handy if you want to do two distinct projects with Raspbian, for example). You can backup the entire SD card or individual operating system installs to an external storage device.
In addition to all of that, you can also tap on the small double arrow located on the far right side to access the advanced configuration (allows you to edit the configuration and system files used by BerryBoot), set a password on BerryBoot, repair damaged file systems, and switch from the GUI menu editor to the terminal.
While all those features and options are great, what we’re most interested in now is adding an additional operating system. Click Add OS. This will return you to the Add OS menu we were in just a moment ago—we’re going to add OpenELEC to our BerryBoot system now. Make your selection and hit OK.
When the installation of the second operating system image is complete, you can then select the one you wish to be the default and click the Make default button. We’re opting to make Raspbian our default operating system:
At this point, we’re ready to exit the editor and try out the multi-boot process. Hit the Exit button on the menu bar. A moment later you will be kicked back to the main BerryBoot menu like so:
If you set a default operating system in the previous step, it will be automatically counting down to boot it. If you didn’t, it will just be idling, waiting for you to select which operating system you want to boot into. The default timeout for the boot menu selection is 10 seconds.
If you wish to change that value you can hit the Edit menu button in the lower right corner, which will return you to the BerryBoot menu editor. There you can click on Advanced Configuration tab (which is hidden, hit the double arrow on the right hand side of the menu bar) and then edit the value “bootmenutimeout” found in the uEnv.txt to a value besides 10.
Whether you edit the value or not, the BerryBoot menu will always be the first thing you see on booting up from a powered down state or rebooting from within any of your installed operating systems (such as Raspbian). You can select your operating system with a keyboard, mouse, or if you’re using your Raspberry Pi unit with an HDMI video cable and a home theater system/HDTV that supports CEC (Consumer Electronics Control), you can use the up and down selection arrows on your remote control to make your selections.
Adding Distributions to the BerryBoot System Manually
When you’re only using the included BerryBoot images, such as Raspbian and Puppy Linux, installation is a point and click affair. When you venture off the beaten path, things get a little trickier.
In order to import a Linux distribution into BerryBoot, you first need to optimize that distribution for SquashFS. The first step in the process is to acquire an image of that distribution. You can go about this one of three ways.
First, the easiest way to do this is to grab optimized images from the BerryBoot repository that haven’t been officially added to the installer yet; you can do so here. You can use these images as they are, no SquashFS optimization necessary.
Second, in the case of Raspberry Pi optimized images that are available for general download but not in/optimize for BerryBoot yet, you can simply grab that image.
Finally, in the case of distributions such as Raspbmc that require you use an installer tool to download everything directly to the Pi and go from there, you’ll need to create an image of the SD card you installed it to—for help on creating disk images using DD, check out our handy tutorial here.
In addition to the .IMG file (either downloaded or created), you will also need access to a Linux machine (be that Linux machine a dedicated Linux desktop, a computer with a Linux Live CD, or even the copy of Rasbian on your Raspberry Pi), in order to use the SquashFS tool. There simply hasn’t been a reliable port yet, so we’re going to keep things stable and simple by using SquashFS on it’s native platform.
If your distribution doesn’t have SquashFS installed already (Raspbian doesn’t ship with it by default), enter the following command at the terminal to grab a copy:
sudo apt-get install squashfs-tools
To convert the the .IMG, plug an SD card or USB device containing the file into your Linux machine. We’re going to refer to the image file as NewBerryBoot.img in the commands. Open up the terminal and run the following command on the .IMG:
sudo kpartx -av NewBerryBoot.img
The kpartx command creates device maps from partition tables and, with the –av switch, it will add the mappings and operate verbosely so we can read the output. The output should look something like this:
add map loop0p1 (252:5): 0 117187 linear /dev/loop0 1
add map loop0p2 (252:6): 0 3493888 linear /dev/loop0 118784
The second and larger partition, loop0p2, is the one we’re interested in. In your image, the loop might be different (i.e. loop3p2), so make note of the name for the next commands. Enter the following commands:
sudo mount /dev/mapper/loop0p2 /mnt
sudo sed -i ‘s/^\/dev\/mmcblk/#\0/g’ /mnt/etc/fstab
sudo mksquashfs /mnt converted_image_for_berryboot.img -comp lzo -e lib/modules
sudo umount /mnt
sudo kpartx -d NewBerryBoot.img
This series of commands mounts the partition, edits out the file systems table in the original partition, optimizes the image with SquashFS (leaving out the lib/modules which are shared among the distributions in BerryBoot), and then unmounts and deletes the partition mappings.
After all this command line magic, we can now go back to the comfort of the BerryBoot GUI. Whether you downloaded an already optimized .IMG or you created your own, it’s time to take that .IMG and add it to BerryBoot.
Plug the external media that holds the .IMG file (such as the SD card in an SD card reader) into your Raspberry Pi unit or attached USB hub. Boot into your Raspberry Pi with the original BerryBoot SD card. At the boot selection menu, press the Edit menu button to pull up the BerryBoot menu editor.
To add your .IMG file, simply click and hold the Add OS button like so:
Select Copy OS from USB stick, and you’ll then be presented with a file selection dialog box:
You may notice the odd .IMG name extensions down at the bottom in the Files of Type box (.img128, .img192). When creating an image for BerryBoot you can append .IMG extension with 128/192/224/240 to indicate to BerryBoot how you want the memory allocated for that distribution. If you don’t do it this way, don’t worry; you can always set it in the Edit section of the BerryBoot menu editor.
After you have selected your .IMG file and hit Open, sit back for a moment as the .IMG is unpacked and installed. Afterwards, you’ll see the BerryBoot menu editor with a new addition:
Success! To review quickly before leaving this section, here are the ways you can download or create an .IMG file to load into BerryBoot (in order of most stable to least stable): Download from the official-but-not-included BerryBoot repository list, modify an existing .IMG with SquashFS, or create your own .IMG from an existing SD card installation and then modify it with SquashFS. The further off the beaten path you go the greater risk there is that the modification won’t work or will have unseen side effects. It is possible, for example, to create a .IMG of a Raspbmc installation but, according to the project’s developer Sam Nazarko, converting it to SquashFS breaks the upgrade system. With that in mind, feel free to experiment (and report back here with the results to help your fellow readers add on to their BerryBoot setups!)
Have a Raspberry Pi project you’d love to see us tackle? Sound off in the comments or drop us an email at firstname.lastname@example.org and we’ll do our best to bring your project idea to life.
- › Here Are the Best iPhone Apps of 2022, According to Apple
- › How to Use an Advanced Filter in Microsoft Excel
- › How to Enable Battery-Saving Mode in Google Chrome
- › Score Microsoft’s New Surface Pro 9 at Its Lowest Price Ever
- › Dish TV Just Lost Channels in 9 Areas
- › The Logitech Litra Will Brighten Your Webcam View at $10 Off