run raspberry pi os in virtual machine

3 Ways to Run Raspberry Pi Desktop on a Virtual Machine

Most of the tutorials on this website are here to help you solve a specific problem on the Raspberry Pi. But this time, we won’t be working on the Raspberry Pi directly. Instead, I’ll be showing you how to run Raspberry Pi OS in a virtual machine on Windows, macOS, or Linux.

VirtualBox, VMWare and QEMU are three solutions to run Raspberry Pi Desktop on a virtual machine. These emulators can run Raspberry Pi OS on a standard PC running Windows, Linux, or macOS.

These software programs can be very useful if you’re a developer, don’t have your Raspberry Pi with you, or want to test something without breaking your installation on the SD card. When it’s tough to get a Raspberry Pi board at a decent price (check my tips here), it might be a good temporary solution.

If you’re feeling lost in all the Raspberry Pi jargon, I’ve got something to help you out. I’ve created a free glossary that explains all the essential terms and abbreviations in a way that’s easy to understand. It’s a great resource to have by your side. Get your free copy here.

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

Why Do I Need a Virtual Machine?

The following will depend on why you created this virtual machine, but I can give you some reasons why you might need a virtual machine.

Not (yet) a Raspberry Pi

If you do not have a Raspberry Pi, but plan to buy one, testing its capabilities on a virtual machine might be a good idea. This allows you to have a good vision of what you will be able to do. Maybe test, install, or program the software that you would like to use, so you can make the purchase when you’re sure.

If this is the only reason, I would consider purchasing a cheap Raspberry Pi board to get started quickly (a Zero kit or even the Pi 3B+ is enough for most projects). This way, you would have a real overview :).

Moving

You are addicted to Raspberry Pi, but you can’t take it everywhere? A virtual machine on your usual computer allows you to continue your projects, even without having the Raspberry Pi with you.

More Powerful

Whether you’re a tester, developer, or just curious, running your Raspberry Pi desktop on a virtual machine will help you increase power and efficiency by taking advantage of your computer’s resources. This can save you a lot of time on some applications, even if it’s less true with the new models like the Raspberry Pi 5 8GB or the Pi 4 8GB.

Snapshots

One of the best features of a virtual machine is the ability to create system snapshots. You can create a snapshot and a complete image of the virtual machine at the same time.

Something not working as expected?
You can get answers from real experts in minutes.
Get help with your setup

So it becomes possible to test something, and go back if it does not happen as expected (instead of having to recreate an SD card, reinstall everything needed, etc when we’re working directly on the Raspberry Pi).

Download Raspberry Pi OS for PC

I think this is probably the main problem you’ve encountered: where to find an image compatible with the main hypervisors?

The default image offered on the official website comes in .img format, which won’t work on some virtualization software. Looking for this image, I came across many forums that said it wasn’t possible to emulate a Raspberry Pi on a PC because it runs on ARM architecture, unlike a PC…

Finally, I ended up finding the image, directly on the official website. Go to the Raspberry Pi OS downloads page, and all the way at the bottom, you’ll find an ISO image that will work. I advise you to use a Torrent client to download it, as it’s much faster.

Now that you’ve got the image, let’s go over different options you have to run it using virtualization software.

Option 1: Use VirtualBox to Run Raspberry Pi OS on a PC

VirtualBox is an open-source hypervisor, developed by Oracle. It is available for most operating systems: Windows, Linux, macOS, Solaris, etc…

It allows you to create virtual machines on your computer and supports many operating systems to virtualize.

Installing VirtualBox

You can find download links for Windows, Mac, and Linux on this page.
In any case, the installation is straightforward:

  • Download the installer corresponding to your environment.
  • Launch the installer and keep the default options.

Note: You might get an error saying you need the Microsoft Visual C++ Redistributable. You can download and install it from Microsoft here.

Create the Virtual Machine

Here’s how to create a virtual machine using VirtualBox:

  • Click the New button in the top bar, and fill out the form for your VM:
  • Give it a friendly name, storage location, and pick the ISO image you just downloaded.
    Also set the OS type to Linux and OS Version to Debian 13 Trixie (64-bit).
  • You can then adjust the CPU and memory settings if needed.
    1GB is enough but I recommend at least 2GB memory.
    adjust VM memory and cpu
  • Also set the storage size. 16 GB is a decent minimum.
  • Click “Finish” on the summary to create the virtual machine.

Our new virtual machine is available:

Note: As of this update, starting with the default video settings will cause it to crash.
So let’s make this tweak to the display options:

  • Click Settings and go to the Display tab.
  • Increase the Video Memory to 128MB.
  • Mark the box to enable 3D Acceleration.
  • Click OK to save.

Now, we can start the virtual machine:

  • Click Start in the top bar to launch your VM.
  • A new window appears. Select Run with persistence and hit ENTER.
  • This starts Raspberry Pi OS in a live Linux environment. That means you can play test it out without having to actually install it. If that’s all you wanted to do, then you’re done.
  • If you’d like something more like a traditional VM, however, double click the Install Raspberry Pi OS icon on the desktop to get started.

Install Raspberry Pi OS VM

Clicking the shortcut on the desktop will begin the installation process:

Recommended next step
Master Raspberry Pi in 30 Days

If you want a clearer path than jumping from tutorial to tutorial, my book gives you a step-by-step roadmap to really understand your Raspberry Pi.

Check the book here
  • You’ll get a Welcome page for the installation wizard.
  • Then you’ll be asked to choose your Locale settings and Keyboard settings.
    You’ll want to change the defaults if you don’t live in the UK.
  • On the Partitions tab, choose Erase Disk for automatic partitioning.
  • Set your username and password on the next page.
  • Finally, you’ll get a summary. Click Install to begin the process.
  • Be patient while it copies files. When it’s finished, click Done to restart.

Note: There’s one last problem. When you restart, it’ll boot into the live USB environment again, but that’s not what we want. We want to boot our newly installed system. So shut down the VM, and follow the steps in the next part.

Boot the Raspberry Pi OS VM

Here’s how you can boot your newly installed Raspberry Pi OS VM:

  • Click Settings and go to the Storage tab.
  • Find and select the ISO file you used earlier.
  • Click the DVD icon dropdown and select Remove Disk from Virtual Drive.
    This “ejects” it from the DVD drive, so it won’t boot from it again.
  • Now click Start to launch the VM again.
    This time, you should see the traditional Linux bootloader, and it will boot into your newly installed Raspberry Pi OS Desktop system.

Your Raspberry Pi Desktop virtual machine running in VirtualBox is finally operational!

You can now check out my 27 tips to take a good start on this operating system if you need help configuring it.

Option 2: Create a Virtual Machine Running RPI OS in QEMU

QEMU is another great open-source machine emulator and virtualizer, developed by Fabrice Bellard under GPL. It can run many guest systems, and it also can be used with KVM to increase the virtual machine’s speed. QEMU is available for Linux, macOS, and Windows.

I’ll give you the short version here, but I have a full tutorial on how to run Raspberry Pi OS in QEMU here.

Installing QEMU

The installation isn’t quite the same depending on your operating system, so I’ll briefly explain how to do this.

Linux Installation:

For Debian/Ubuntu, QEMU is available in the repository so that you can install it with:

sudo apt install qemu-system-x86 qemu-utils

For other distributions, it’s usually available as easily via the basic commands:

RedHat/CentOS: yum install qemu-kvm
SUSE: zypper install qemu
Arch: pacman -S qemu-desktop

QEMU is a command line tool. But if you have a desktop environment, I highly recommend installing Virtual Machine Manager, which is a GUI you can use with QEMU.

On Linux, it’s available in the default repository:
sudo apt install virt-manager libvirt-daemon-system

You should reboot after installing everything to active permissions.

Note: If you’re having trouble, I have a complete guide on how to install QEMU on Ubuntu. And even if you’re not using Ubuntu, it’s similar on most distributions, so it should be useful.

Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.

Mac OS Installation:

QEMU is available via Homebrew or MacPorts.

HomeBrew:
brew install qemu

MacPorts:
port install qemu

Windows Installation:

You can get the last installer version by following this link. Then start the .exe file and follow the instructions.

On Windows, since it doesn’t have virt-manager, you can try QtEmu instead. Truthfully, you’re probably better off using VirtualBox (previous option) or VMWare (next option), that are better suited for this.

Create the Virtual Machine

Here’s how to create a Raspberry Pi OS virtual machine using QEMU:

  • Launch Virtual Machine Manager.
  • Click the icon to create a new virtual machine.
  • On the first step, select local install media (as we already downloaded RPI OS):
    qemu create new virtual machine from iso
  • Browse to the RPI OS image file you downloaded earlier:

    You need to pick the operating system manually (Debian 13 for the trixie image), as the auto-detect doesn’t work with Raspberry Pi OS.
  • After that, follow the final steps to configure the virtual machine according to your needs and resources available (storage, RAM, CPU, etc.). I recommend 2GB RAM, 2 CPUs, and 16GB disk if possible, but it would probably still work with less.

Once the virtual machine is created, you can start it from the interface, and you’ll get the same menu as with VirtualBox:

  • Select Run with persistence and hit ENTER.
  • This starts Raspberry Pi OS in a live Linux environment.
    If that’s all you wanted to do, then you’re done.
  • If want to proceed with a full install, double click the Install Raspberry Pi OS shortcut.

Install Raspberry Pi OS in VM

Clicking the desktop shortcut will begin the installation process:

  • You’ll get a Welcome page for the installation wizard.
    Change to your language here.
  • Then you’ll be asked to choose your Locale settings and Keyboard settings.
  • On the Partitions tab, choose Erase Disk for automatic partitioning.
  • Set your username and password on the next page.
  • Finally, you’ll get a summary. Click Install to begin the process.
  • Be patient while it copies files. When it’s finished, click Done to restart.

There are fewer hoops to jump through than using the VirtualBox method. Once the reboot is done, Raspberry Pi Desktop simply starts:

Your Raspberry Pi Desktop virtual machine running in QEMU is now operational!

You can now install any apps on it, like on a real Raspberry Pi (check my selection of the 17 best apps to install at the beginning here).

On the command line, you can do something similar by using a line like this:
qemu-system-x86_64 -hda IMAGE.iso -m 1024 -net nic -net user

Option 3: Run Raspberry Pi OS on PC with VMWare Workstation

VMWare Workstation is a proprietary hypervisor distributed by VMWare, a subsidiary of Dell. There is a free version, VMWare Workstation, for non-commercial use. Workstation can emulate most operating systems.

VMWare also develops many other professional tools, which can allow you to use virtual machines on a large scale, but this is not the subject of the day.

I’ll show you the short version here, but I have a full tutorial on how to run Raspberry Pi OS on VMWare Workstation on this site. Check it out for the details.

Installing VMWare Workstation

You can download VMWare Workstation Pro on the official website. There is a Linux and Windows versions, but I’m not sure about macOS.

Note: VMware is now a part of Broadcom, and you now have to create a Broadcom account to download VMWare.

On Windows, just run the .exe file to start the setup.

On Linux, you have to start the wizard, like this:
sudo sh VMware-Workstation-Full-VERSION.x86_64.bundle

You can keep default options, and no key is needed for the moment.

On the first start, choose that you want to mark that you’ want to use Workstation Player for non-commercial use, and you are ready :).

vmware player free

(I had problems with Linux at first, I had to take a newer version than the one given on the site because the modules did not install. If this happens to you, now you’ll know what to do.)

Create the Virtual Machine

We will now create our virtual machine:

  • Select Create a New Virtual Machine and choose Typical setup.
  • Choose “Installer disc image file (ISO)” and browse to your downloaded image.
  • For the OS type, select Linux and Debian 13, for example.
  • Name your virtual machine and change the installation folder if you want.
  • For the disk space, you can leave it as 20GB or decrease it to 16 GB to save space.
  • Finally, click on Finish and Close.

Note: As of this update, starting with the default video settings will cause it to crash.
So let’s make this tweak to the display options:

  • Click Settings and go to the Display tab.
  • Mark the box to enable Accelerate 3D Graphics.
  • Click OK to save.

Now you’re ready to start the virtual machine:

  • Click Start from the top bar.
  • When the boot menu appears, choose Run with persistence.
  • This starts Raspberry Pi OS in a live Linux environment.
    If that’s all you wanted to do, then you’re done.
  • If want to proceed with a full install, double click the Install Raspberry Pi OS shortcut.

You can choose to download and install VMWare Tools if you want, but it isn’t mandatory.

Install Raspberry Pi OS VM

Note: As of this update, something with the trixie image does not fully work with VMware Workstation. I am able to use the live environment, but the Install Raspberry Pi OS wizard doesn’t start properly.

Clicking the shortcut on the desktop will begin the installation process:

  • You’ll get a Welcome page for the installation wizard.
  • Then you’ll be asked to choose your Locale settings and Keyboard settings.
    You’ll want to change the defaults if you don’t live in the UK.
  • On the Partitions tab, choose Erase Disk for automatic partitioning.
  • Set your username and password on the next page.
  • Finally, you’ll get a summary. Click Install to begin the process.
  • Be patient while it copies files. When it’s finished, click Done to restart.

Your Raspberry Pi Desktop virtual machine running in VMWare Workstation is now operational!

What’s Next With a VM?

Once your virtual machine is installed, and no matter which hypervisor you choose, I invite you to follow the various tutorials on this website to set up the necessary software (SSH, VNC, etc.), as if you were on a Raspberry Pi.

Here are a few links to help you with this:

There are probably other things that are more dependent on the fact that your Raspberry Pi OS is on a virtual machine:

  • Network card: by default, I had network and Internet in these 3 installation cases, but depending on your environment, it might not work on the first boot. Or maybe you will need the opposite: isolate the virtual machine of the network.
  • File sharing: it can be interesting to have a shared folder between your virtual machine and your computer (especially for developers, to work on your computer, and launch the application on the virtual machine).
  • Adjust the hardware: you may have to adjust the screen resolution, disk size or RAM to suit your needs.

I will not go into more detail about all of this because it depends on your goals with this system. But be aware that once Raspberry Pi is virtualized and functional, you can follow any tutorial on the chosen hypervisor to help you, it does not depend on Raspberry Pi OS most of the time.


🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Something not working? Don't waste hours going in circles. Ask in the RaspberryTips Community and get help from people who've already figured it out. Get unstuck now.

Video Tutorial

If you need more help understanding everything here, or if you prefer the video version, here is a demonstration of how to do this with VirtualBox and VMWare:

You can also subscribe to see all the news videos in your YouTube Feed:

So, we saw how to create a Raspberry Pi OS virtual machine on three different hypervisors:
– VirtualBox
– QEMU
– VMWare Workstation

We also saw what the benefits of virtualization could be when talking about Raspberry Pi.
It’s up to you now to launch your projects on this, good luck!

By the way, you can now use a Raspberry Pi as a cheap hypervisor, with solutions like VMWare ESXI or by installing Proxmox on your Raspberry Pi. You can also go the other direction, too, and run a Windows VM on a Raspberry Pi.

If you’re ready to take it to the next level, here’s some stuff I recommend:

  • Raspberry Pi 4: After your first tests in a virtual machine, you are now ready to switch to a real Raspberry Pi device. It’s really not the same, you won’t regret it!
  • Learn everything step by step: If you are afraid to get started for real, I have written a book on the topic, so it’s not that complicated! The promise is to master your first Raspberry Pi in 30 days, and it’s absolutely possible. Try it and let me know.
  • Start with the cheapest model: If your problem is the price, you can totally start with a minimal model just to see if it’s for you. If you are mainly doing this for basic things or programming, this model should be perfect.

Whenever you’re ready, here are other ways I can help you:

Test Your Raspberry Pi Level (Free): Not sure why everything takes so long on your Raspberry Pi? Take this free 3-minute assessment and see what’s causing the problems.

The RaspberryTips Community: Need help or want to discuss your Raspberry Pi projects with others who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct help.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

Master Linux Commands: Overwhelmed with Linux commands? This book is your essential guide to mastering the terminal. It includes practical tips, real-world examples, and a bonus cheat sheet to keep by your side.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

13 Comments

  1. Hi I have a question about these set ups. Are any of them able to save the exact image to an SD card that can then be put into the RPi and booted headless. Thus allowing me to set the RPi OS how I like using my virtual machine and then later run headless once I have it set up?

    1. Hi,

      Thanks for your comment

      I don’t think it’s possible, but I never tried this
      Maybe someone else will help you

      1. VmWare or VBox uses less resources than original board, many things you dont need to install as it automatically picks from your physical machine hardware drivers etc, So accordingly, its not possible that you just do copy and paste the stuff and it starts works.

        Hardware should now be upgraded to Plug and Play for ease, or preinstalled and allow to change it later.

        regards

    2. The method presented by Raspberry Tips uses a version of Raspberry Pi desktop compiled for x86 PC. It allows you to experience GUI and maybe do some development for this environment but you cannot produce binary images for running on real Raspberry Pi hardware, which vastly differs from x86 PC. However, you can create scripts and other platform-independent code, which can be later ported to real Raspberry Pi image.

      To create a bootable SD card for Raspberry Pi you need an emulator capable of running ARM code, with GPU, network and all other hardware Raspberry Pi has. Currently limited options seem to exist for QEMU KVM (Linux) using qemu-system-arm package. The package delivers code to emulate about 30 different hardware boards. Unfortunately, I do not see “raspi2” on the list and haven’t checked similarities for “versatilepb” board which can be used instead, according to some manuals.

      I think you should consider use of real Raspberry Pi for preparing the SD image you need. SD card can be easily swapped, removed, copied, backed up on typical SD card reader. You can use x86 Linux machine (physical or virtual) to “open” Raspberry Pi SD card image, make changes you need (without running it) and close for use on real Raspberry Pi. If your target system needs to be headless, you can configure system initially with monitor (basic options, IP and user account config), then use SSH to perform further actions. Also:

      – you can use built-in serial port for configuration/management. Requires some setup and knowledge in electronics, because voltage levels are not typical for RS-232 use case and it is posible to fry your Raspberry Pi in this way,
      – older models (1, 2) have Composite Video output which can be programmed to use instead of HDMI. This allows use of analog (TV) monitors as console or for some other output.

      Initial Raspbian configuration can be done with text editor directly on partition containing /boot filesystem. This is VFAT partition, easily recognized by Windows on SD card connected via reader.

      HTH.

      1. Depends,

        Python is an interpreted language, so, it is not dependent of the operation system, only the right packages versions and own python version.
        Even java is possible to run, i think, since it depends on the JVM and not the processor architecture.

        Different from compiled file in C or C++ binary, which is really compiled for a certain architecture.

  2. I have Raspbian desktop running on a vbox, I don’t have winzip or an actual Pi to test so I can’t say this could work. But if you already have a boot and partition on your SD for your Pi you could try to copy and paste from the vmdk directly into your SD. It will be interesting to check once I get my Pi, or even from vm to vm. I’m Sorry if this doesn’t answer the question.

  3. Hi, what about 3D graphics hardware acceleration: any chance to get GPU passthrough working with AMD e.g. Vega64 or RX?

  4. My codesys is not able to communicate to raspberry pi on a vmware virtual machine . In codesys .. tools .. updatr pi , it not able to detect the vm pi . What to do. But putty can loginto the vm through ssh.

  5. I have just tried to boot a VirtualBox virtual Rasberry Pi Desktop machine on Raspberry Pi micro SD through USB and it does not work (whereas it works on the real Raspberry Pi) so I can confirm the negative answer of Edwin to Nicholas and thank both for the explanation. Raspberry Pi Desktop is not Raspbian!

  6. Thanks for this. It worked pretty well, minus one issue (that I’ve run into), since this doesn’t appear to actually be Raspbian, I can’t update some software.
    Specifically, Sonic Pi is stuck at version 2.10, which is the highest “reasonable to install” version regular linux seems to have, which ended up defeating my purpose, since I’m running Ubuntu and already hit a wall with upgrading that software. Is there some other trick for getting it to think it’s the right environment to update Sonic Pi?

  7. Thanks for the article. I was able to install raspbian buster on vmware workstation up to 2019-09-25-rpd-x86-buster.iso. When I tried to setup a vm using the new 2020-02-12-rpd-x86-buster.iso, the vm always gives me blank screen after installation has completed. Going through the vmware.log didn’t help much. I’ve got similar result when I tried to set up thenew ubuntu 20.04 LTS on vmware. It won’t start up after installation. However 16.04 LTS was installed fine. Could it be only 32bit linux system can be run on vmware?

  8. Ok, the installation work, i have installed the os on virtual box oracle, but the shared notes (ctrl-c, ctrl-v) copy and paste doesn’t work, i chose bidirectional shared.
    It’s annoyng typing from host and guest. Thanks you. Bye

Leave a Reply

Community members only
Comments are reserved for RaspberryTips Community members. Join the community to ask questions, get help, and interact with other Raspberry Pi users.

Join the community  or  log in