I got a Raspberry Pi 3 Model B late last year with the lofty dual intentions of spending some time on control projects and doing some network penetration testing.
Dual intentions require dual operating systems (Raspbian and Kali Linux in my case) and having started out with Raspberry Pi’s boot loader, NOOBS (New Out Of Box Software), I quickly came to realise that it did not support Kali Linux.
At that point I searched around and found BerryBoot - a boot loader that allowed more choice of operating systems, though with a harder setup. Given it was the end of 2018, I started out with the Pi 2/Pi 3 loader from earlier that year (berryboot-20180216-pi2-pi3.zip).
Unfortunately, despite following the steps to the letter, and then trying out all the troubleshooting tips, I could not get past the coloured splash screen, aka. the rainbow screen.
The dreaded Rainbow Screen!
I got frustrated and left the Pi in its broken state for most of the year, until I got round to spending a bit more time on it.
Getting BerryBoot to Work
BerryBoot is available in a number of different versions, supporting different combinations of Pi Zero, Pi, Pi 2 and Pi 3. There is no support for the Pi 4 at time of writing.
In the intervening months that I had left my Pi idle, 2 new versions of BerryBoot had been released. I opted to try the latest berryboot-20190612-pi0-pi1-pi2-pi3.zip version.
The new version of BerryBoot faired a lot better than the original one and I was able to get it up and running and install both Raspbian and Kali Linux without too much trouble.
Below are the steps I followed to get it up and running with both operating systems loaded.
Download and Install BerryBoot
Download the berryboot-20190612-pi0-pi1-pi2-pi3.zip installer and extract into a folder on your local computer.
Next, you need to format your SD card to FAT in order to load BerryBoot. On a Mac, this can be done using the Disk Utility application.
Insert the SD card into a card reader and start up the Disk Utility app
Choose the SD card (in the example below, mine is called RASPI)
- Click the Erase button at the top of the application. This pops up an erase dialog as shown below.
- Choose a name for the disk up to a maximum of 8 characters (I chose RASPI) and select the format as MS-DOS (FAT). It is very important that you choose this format or the loader will not work!
- Click the Erase button to begin the formatting
Formatting the SD card
Note: If you have problems formatting the SD card, or you receive the ominous error code -36 as I did, where the BerryBoot files cannot be written to the disk, there are a number of options you can try. Unfortunately none of the options worked for me, so I ended up inserting the SD card into a digital camera and using that to format the disk, after which I was able to copy the BerryBoot files onto the SD card.
Once the SD card has been formatted, the contents of the berryboot-20190612-pi0-pi1-pi2-pi3.zip can be copied onto the SD card, taking care to copy the contents of the extracted zip minus the zip folder.
Copy the BerryBoot installer files onto the SD card
The SD card is now ready to boot the Raspberry Pi, so eject it from the computer and insert it into the Pi.
Booting the Pi
With BerryBoot on the newly formatted SD, boot up the Raspberry Pi. The rainbow screen may display for a moment; don’t be alarmed - it should disappear after a few seconds and be replaced with a welcome screen.
Welcome screen
So long as the Pi is connected to the network, it should automatically detect the network and location settings, allowing you to click the OK button to accept all defaults.
Reformatting the SD Card
The next screen lets you choose the drive to install operating systems to, as well as getting you to reformat the SD card to a different file system. Don’t worry that the SD card will be reformatted; the initial BerryBoot will no longer be needed as it will be replaced by a new boot loader.
Select the destination drive and file system
I chose ext4 as the filesystem, which is the default option. Clicking the Format button reformats the drive and replaces the boot loader.
Adding the First Operating Systems
Once formatting is complete, a screen to choose an operating system is presented. Pick the first operating system you want to load. You will be able to add additional ones at a later stage. Take note of any instructions on the installer. I chose Kali Linux as my initial operating system and the default root password was provided in the instructions.
The operating system will download automatically from the internet. This may take some time depending on the network speed and operating system size.
Downloading the operating system
Once it has finished downloading and installing, you are automatically returned to the BerryBoot menu.
Installing the Second Operating System
The BerryBoot menu will show the first operating system as installed. Click the Add OS button to select the another operating system to install.
Adding a second operating system from the BerryBoot menu
In my case, I chose the full edition of Rasbian for my second operating system. Again, this will download automatically from the internet and install onto the Pi.
Choosing a second operating system
Subsequent operating systems can be added from the menu, as required.
Finishing Up
As a finishing step, it is a good idea to set a password on the BerryBoot menu, to prevent unauthorised changes being made.
To do this, click the More options button on the right side of the menu, which expands a second level menu.
Expanding the BerryBoot menu
On that second level menu, click the Set password button and add your boot menu password twice in the dialog that pops up. Click the OK button to save your boot menu password.
Setting a password on the BerryBoot editor
You can also set things like the default operating system to boot, using the Set default button.
First Boot
Once the operating systems are installed, it’s time to boot and connect a shell.
MacOS comes with a terminal shell, which allows you to ssh onto the Pi. On Windows, this can be done with a tool like PuTTY.
Take note of the IP address of the Pi (viewable when the Pi boots, if using DHCP). My IP address was 192.168.1.116, which I’ll use in the examples.
Open up a terminal window on the Mac and execute a secure shell to the Pi:
mymac:~ julian$ ssh root@192.168.1.116
Enter the default root password to gain access to the secure shell on the Pi.
It is a good idea to change the default root password as the first command you execute on the Pi.
root@192.168.1.116:/etc/ssh# passwd
Installing X Windows
Though not required, sometimes connecting via X Windows can be useful for applications that have a GUI. There is an excellent open-source X Windows client available for the Mac called XQuartz, which works on MacOS Mojave (I have not tested it on Catalina yet).
Download and install the latest XQuartz application installer from XQuartz
Execute the XQuartz DMG installer to install the tool onto your Mac
Now open a terminal on your Mac and ssh to the Pi with a -X switch to allow an X Windows client to connect
mymac:~ julian$ ssh -X root@192.168.1.116
In the secure shell to the Pi, start an X session
root@192.168.1.116:/etc/ssh# /etc/X11/Xsession
This should automatically start XQuartz on your Mac and show the X Windows GUI
XQuartz client connecting to Kali Linux on the Pi
If you do have issues, there is a good forum on running X Windows on a Raspberry Pi: https://www.raspberrypi.org/forums/viewtopic.php?t=6722
Conclusion
Setting up and installing BerryBoot is a relatively easy task, even for someone who doesn’t have a lot of knowledge of working with the Linux operating systems. It provides a great first experience of using the Raspberry Pi and will hopefully get you excited about doing further projects with your Pi.
There is a wealth of information available online in forums and blogs to help you if you do get stuck.