How to Make a Raspberry Pi Virtual Machine

The Raspberry Pi is one amazing little machine with a bit of a caveat: the RAM and SD card storage. And it's not like you can do anything with that since everything is soldered directly on the board. That's why upgrading both RAM and storage is impossible - unless you make a Raspberry Pi virtual machine.

And the good news is that it's so easy to make one. Here we show you how to make a Raspberry Pi virtual machine.

What You Need

You only need three things to do this:

  • Raspberry Pi Desktop ISO image
  • Oracle VM VirtualBox
  • A Windows, Linux, or Mac PC that can run VirtualBox

Many OS installs on VirtualBox follow a two-step process. The first one sets up the OS image in some form of a bootable disk, much like a bootable USB. After that, the second step is about installing the OS, itself.

However, since the Raspberry Pi OS doesn't have some sort of a "bootable" form, the second step will look different from normal VM installs. This guide will make sure that you won't make a mistake on that part while setting yourself up a Raspberry Pi OS virtual machine.

Download a Raspberry Pi ISO Image

To make a virtual machine with the Raspberry Pi, you'll first need an ISO image. Unfortunately, the version normally installed on a Raspberry Pi won't work because that's saved as an IMG file.

  1. Go to the Raspberry Pi operating system images download page. You should see a list of links and versions to download.
Raspberry Pi Os Download Page
  1. Scroll down to Raspberry Pi Desktop and click the "Download" button. That's the only version in the list that is saved as an ISO file.
Raspberry Pi Os Download Page Download Section For Raspberry Pi Desktop Red Arrow On Download Button

Alternatively: You can download older versions of Raspberry Pi OS or even Raspbian through the Raspberry Pi Downloads Archive.

Setup Raspberry Pi ISO Image on VirtualBox

  1. Download and install Oracle VM VirtualBox.
Oracle Virtualbox Download Page Virtual Machine For Raspberry Pi
  1. On VirtualBox, click on the "New" button.
Oracle Vm Virtualbox Red Arrow On New Button
  1. The "Create Virtual Machine" window should pop up. On the "Name" field, add the name of your Raspberry Pi virtual machine.
Raspberry Pi Os Create Virtual Machine Red Arrow On Name Textbox Raspberry Pi Os Virtual Machine
  1. On the "ISO Image" field, click on the drop down menu and select the "Other..." option.
Virtualbox Raspberry Pi Os Create Virtual Machine Red Arrow On Iso Image Other
  1. You will be shown a file explorer to find your ISO file. Select your Raspberry Pi OS ISO file.
  1. After selecting the ISO file, all the other fields should gray out. Click the "Next" button.
Virtualbox Raspberry Pi Os Create Virtual Machine Virtual Machine Name And Operating System Red Arrow On Next Button
  1. You should see an option for unattended guest settings. You can skip this part, but you might need to change the "Hostname" fields if you picked a name with spaces earlier. Click on "Next" after that.
Virtualbox Raspberry Pi Os Invalid Hostname
  1. Here is where you can increase or decrease the random access memory (RAM) and CPU count for your Raspberry Pi virtual machine. While the default should work, you can add more to speed it up even more. Click on "Next" after you're done setting this up.
Virtualbox Hardware Section
  1. Next up is the virtual hard disk. This is the size of disk memory your Raspberry Pi virtual machine can use. Ticking the "Pre-allocate Full Size" check box immediately allocates the max size on your host PC's hard drive.
Virtualbox Virtual Hard Disk Section

Note: You should allocate at least 8 GB of virtual hard disk to ensure that you have enough space to install the Raspberry Pi OS and any other programs you might need with it.

  1. After clicking "Next" from the previous section, you should see a page to review your current virtual machine settings. Click on "Finish."
Virtualbox Summary Section

Tip: Other than Raspberry Pi OS, you can also install macOS in VirtualBox.

Installing the Raspberry Pi OS

The moment you click on "Finish" from the summary section, VirtualBox should automatically run the virtual machine for you. But then you'd see a problem: the ISO does not load and you'll find an error code that says "No DEFAULT or UI configuration directive found!" on VirtualBox.

Virtualbox Raspberry Pi Os No Default Or Ui Configuration Directive Found Error
  1. To fix that, you'll need to power off your machine.
Virtualbox Proper Shutdown For Virtual Machine
  1. From Virtualbox's list of your virtual machines, select the Raspberry Pi virtual machine, then click on "Settings."
Virtualbox Raspberry Pi Os Virtual Machine Settings
  1. Go to "Storage -> contents of Controller: IDE." Normally, this would be named "Unattended" followed by a string of alphanumeric characters. You might sometimes get one named "Empty" instead.
Virtualbox Raspberry Pi Os Virtual Machine Settings Storage Controller Ide Content
  1. After that, click on the disk icon beside the dropdown. This is a separate dropdown that lets you pick an ISO image. Select "Choose a disk file..." to access the file explorer or select your Raspberry Pi ISO image if it shows up on the list.
Virtualbox Raspberry Pi Os Virtual Machine Settings Selecting New Image Iso
  1. Click on "OK" to finalize your settings. Your Raspberry Pi virtual machine should now run the Raspberry Pi installer the next time you run it.

Note: The BIOS mode settings will show up the moment you run your Raspberry Pi virtual machine. Leave it be until you see the Raspberry Pi welcome screen or hear the screen reader say "To install the screen reader, press Ctrl + Alt + Space."

Virtualbox Raspberry Pi Os Installed Configuration Process

From this point on, installing the rest of the virtual machine will be similar to doing the post-installation configuration on a normal Raspberry Pi. This means you can now set up and personalize your new Raspberry Pi virtual machine.

Frequently Asked Questions

Why is my Raspberry Pi OS image not showing in VirtualBox import?

If you have downloaded the IMG file, VirtualBox can't read IMG files, so it won't show up when you try to import it.

Why does it take so long to install my Raspberry Pi OS image on VirtualBox?

This can depend a lot on your hard drive's capacity. Allocating low CPU and RAM into your virtual machine makes installation a lot longer than it would on a normal Raspberry Pi. If you are installing a Raspberry Pi OS image along with GRUB, expect it to take even longer - perhaps even hours!

What is the difference between the Desktop version and the regular version of Raspberry Pi OS?

Other than the file extensions (ISO for Desktop and IMG for Raspberry Pi), both versions are practically the same.

Terenz Jomar Dela Cruz

Terenz is a hobbyist roboticist trying to build the most awesome robot the world has ever seen. He could have done that already if he wasn't so busy burning through LEDs as a second hobby.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox