Run Raspberry Pi x86 on your Desktop Computer (Virtual Machine)

Michael just shared a new tutorial: "Run Raspberry Pi x86 on your Desktop Computer (Virtual Machine)"

Running a virtual Raspberry Pi on your computer can be a neat way to experiment in a Raspbian-like environment without being tethered to a physical Pi. In this video, I’ll walk you through the process of installing Raspberry Pi Desktop on a virtual m…

Read more

Thanks Michael sharing for this great knowledge

Hi Michael,
I did this originally and it worked flawlessly.

Ive just had to rebuild my Mac and downloaded the latest version of VirtualBox and Rasbian x86.

I can get the Raspbian to “boot” in Virtual box but I cannot get the last bit working…

This line is the one causing me the head-aches:
sudo apt install virtualbox-guest-dkms virtualbox-guest-x11 linux-headers-$(uname -r)

I have attached a screenshot of the error I am getting. Any ideas? I have installed the Virtualbox extension pack as a quick google suggested that might be a problem, clearly it isn’t!!


Hey Jon,

Michael is away at the moment so he won’t be able to get back to you straight away. I’ll make sure he takes a swing at this as he’s had the most hands on time with this package.

Thanks Sam.

This morning, after a heap more Googling I found the solution and thought Id post here to hopefully save others major headaches in the future…

Firstly I came across this link - a quick shortcut to anyone needing to download the guest additions iso file (this technically isn’t needed as its available within the Content folder on the Mac once Virtualbox is installed) - Ive put it here for completeness.

The problem:
It seems that the problem is with the latest version of Rasbian (Stretch) and its repositories. In Raspbian Stretch (late 2017 onwards), the VirtualBox Guest Extensions are no longer in the standard Raspbian repositories. You need to enable the Debian Backports repsitory before the Guest Extensions can be installed. To do this, you will also need to install the Debian authentication keys. Type in the following. Press Enter at the end of each line.

sudo apt update 
sudo apt install -y dirmngr 
sudo apt-key adv --keyserver --recv-key 8B48AD6246925553 
sudo apt-key adv --keyserver --recv-key 7638D0442B90D010 
echo "deb stretch-backports main contrib non-free" \ | sudo tee /etc/apt/sources.list.d/backports.list 
sudo chmod 644 /etc/apt/sources.list.d/backports.list

The above is not my work, but taken from the page below:

With the Debian Backports repository enabled, Michael’s post can be followed once again.

sudo apt update
sudo apt install virtualbox-guest-dkms virtualbox-guest-x11 linux-headers-$(uname -r)
sudo reboot



Awesome stuff Jon! Thanks so much for sharing that, I’m sure it will help other makers if they run into the same problem.

Question for you: This step:

Storage > Controller: IDE: Select the Empty optical-drive entry, and select either the host drive that your CD is inserted into, or browse to the location of your virtual disk image file. I go over this step in more detail at the end of the video.

I am provided with four options:

  1. IDE Primary Master
  2. IDE Primary Slave
  3. IDE Secondary Master
  4. IDE Secondary Slave

I have a Canakit raspberry pi 3 complete starter kit that I’m hoping to run through my Windows laptop, but with the virtual machine. The kit came with a preloaded NOOBS Micro SD card, so I’m not loading anything from a CD (and my CD/DVD player doesn’t work on my laptop). Am I still able to use the VM? If so, which one of those four options, if any, would work? Thanks for your time.

Hi Leigh,

Perhaps some clarification for this topic. Running Raspbian as a Virtual Machine doesn’t mean connector your Pi up to your computer and controlling it from there. It is running an operating system (Raspbian) on another operating system to emulate a device. It is a separate process from a physical Pi board.

Ahh, okay. That’s helpful. Thanks, Sam. I think I’m better off just getting a separate monitor. I’m having very little luck getting the ‘headless’ set up to run on my Windows 10. It seems there are a lot of instructions out there but none of them fit having a RPi 3 kit.

Just confirming that when you say you’re trying to get it running on your Windows 10 computer, you mean you’re just configuring the text file with it? Everything is done on your Pi, and you just use your computer to SSH into it.

Hi Sam,

Yes, I think that’s right. I’m completely new to this. So I got my raspberry pi kit, plugged in the NOOB rasbian SD card and then went to look at what to plug in where and started getting confused right away! All I want to have happen is that my RPi 3 will boot up to my laptop (which I presume has to run rasbian).

I think perhaps you’re thinking about how to use your Pi the wrong way. I’m not sure what you mean when you say that it will boot up to your laptop, but the Pi 3 is a fully functioning, standalone micro computer that runs linux. When people refer to using it as a headless setup, all that means is that you are running the Pi without a screen, keyboard, or mouse. So you might have it embedded in a project, and you want to access the terminal without having to connect all that up. So you connect it to a network, and you can access the terminal remotely using another computer. That computer doesn’t have to run Raspbian, you just use an SSH client

Running Raspbian as a VM as described in this tutorial is completely separate from your physical Raspberry Pi.

Hi Jon
I was having same problem and followed your instructions worked up to last command then said directories not available.
Could you please help

1 Like

Hi Michael

Thank you for this tutorial and video it was very insightful. However, things didn’t quite work out as planned.
To state up front, I followed your initial directions, the additional information in the above comments and material that was referenced at

I’m running an Intel I7, 64bit Windows 10 (latgest vers with all updates), VirtualBox 5.1 (also latest release) and used 2017-11-16-rpd-x86-stretch.iso as the disc image.
Using the above resources, I managed get get the software loaded and commands run without any apparent error messages.

However, I find the following:

  • the screen doesn’t expand within the virtual window. (Also, I noticed that the “auto-resize guest display” is greyed out as are all the potential sizes of “Virtual Screen 1”)
  • The “Shared Clipboard” is set to bi-directional but cut and paste in either direction does not work
  • The shared folder is in the native environment and is correctly referenced in the virtual machine but the folder does not appear in Media folder of the Pi Desktop.

I have spent hours on this checking and rechecking without finding any error in what I have done. I have searched the web for each of the issues, without really getting any definitive answers.

Is it time to redo this tutorial with all the latest software and images?

Being able to run it as a virtual machine would be very useful and given the changes, the omissions of latest images etc. makes it overly complex to achieve the outcome if you don’t have indepth knowledge or experience


1 Like

Hi Geoff,

The problems you’re having are all related to the Guest Additions not being installed correctly. Make sure you’re using the same version of them as you have for Virtualbox, and if you update one you have to also update the other. If they are the same version, try uninstalling the Guest Additions and reinstalling them.

Let me know how you go.

Hi Josh

Before posting the last message I checked for updates on the Virtualbox and it said that it was up to date.

This morning, when starting it up to try your suggestions, it said that it had an update ready so I went ahead and installed it. Virtualbox is now V.5.2.12. The situation is the same as described above.
I tried reinstalling the Guest Additions removed the Guest Additions and situation is the same as described above.
I uninstalled the Guest Additions and then reinstalled them and situation is the same as described above.

The versions of the virtualbox-guest-dkms and virtualbox-guest-x11 are both 5.1.10


Hmmm, that’s interesting. I’ve just done a fresh installation of Virtualbox and made a Raspbian VM (didn’t have it on this machine), and the versions of virtualbox-guest-* installed are:

pi@raspberry:~ $ dpkg -l | grep virtualbox
ii virtualbox-guest-dkms 5.2.10-dfsg-6~bpo9+1 all x86 virtualization solution - guest addition module source for dkms
ii virtualbox-guest-utils 5.2.10-dfsg-6~bpo9+1 i386 x86 virtualization solution - non-X11 guest utilities
ii virtualbox-guest-x11 5.2.10-dfsg-6~bpo9+1 i386 x86 virtualization solution - X11 guest utilities

The screen didn’t change size until I restarted and then went into full screen mode (Host + F), but after that it works fine, full screen or not. If doing that doesn’t fix it, I suspect it could be related to Virtualbox being 5.2.x and the GA being 5.1.x. When you uninstalled the GA, did you use

sudo apt remove virtualbox*


sudo apt purge virtualbox*

because purge will also remove any config files that might be left behind. Also make sure to

sudo apt update

between uninstalling and reinstalling, just in case.

As a side note, I also installed the Extension Pack when installing Virtualbox, but the GA seemed to work correctly even after I removed it, so it may not actually have affected anything in this case. Just thought I’d mention it for completeness though.

See if any of that helps, and if not, try starting with a fresh VM.

Hi Josh

Firstly, I apologise, I made a typo in my last post - The Virtualbox components were 5.2.10.

Secondly, I have the the VirtualBox Extension pack installed (with the latest revisions). BTW, I also have a macOS 10.13 High Sierra VM that works fine with expanding the window to whatever size.

Thirdly, I just used the “sudo apt remove” command to remove the components.
I have now used sudo apt purge virtualbox* and after it completed sudo apt update.
I then reinstalled the components however, when looking at the terminal window noticed an error:


When looking in the Make.Log from where the errors started to appear this is what it showed:


I’m sorry, but I don’t have the necessary experience to properly interpret this.

Can you offer any sugestions?

Kind Regards

1 Like

Hi Geoff,

Can you try with a fresh VM, and see what that does?

Hi Josh

I uninstalled Oracles VM VirtualBox completely from my machine.
There was a new Windows 10 update available so I installed that update and then rebooted the machine

I downloaded a fresh copy of Oracles VM VirtualBox from their web site and installed it (including the Extension Pack)

The current environment is

I then followed the instructions in this tutorial and video installing from an image of
“2017-11-16-rpd-x86-stretch.iso” (obtained from down until the need to install the virtual-guest modules.

I then jumped to the instructions set out above by Jon13024. During the execution of

sudo apt install virtualbox-guest-dkms virtualbox-guest-x11 linux-headers-$(uname -r)

2 errors appeared on the screen output


When looking at the make.log, I found the following

Needless to say the window resizing doesn’t work (also option in VM greyed out) and nor does cut and paste - but would expect that to be the case given the errors on the install

I am at a bit of a loss as to the next steps