-1

For example, Raspberry Pi images can be "burned" to an SD card from an image file that contains a simple plain-text file tree that is the Raspbian (a Debian sub-flavor) filesystem (e.g., as discussed here)

And using VirtualBox,it's very convenient to do operations, such as installs of large packages, that would be slow on a Raspberry Pi.

But how to easily export the resulting o/s instance as a Raspbian image (e.g., without problems cause by proc and so on)?

  • virtualbox can't run a arm based os as far as I'm aware *`VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product`* - so, besides the fact that I have no idea what the first sentence is even saying, I can tell you that virtualbox is not a solution to "do operations that would be slow on a Raspberry Pi" – Jaromanda X Mar 12 '18 at 04:48
  • Are you looking for a "Virtual machine => Physical machine" conversion? – MatsK Mar 12 '18 at 05:02
  • @JaromandaX - I've clarified the question to be clear that I mean a o/s image. – christopherbalz Mar 12 '18 at 06:25
  • @MatsK - I am looking to create a Raspbian `.img` file from a VirtualBox instance. – christopherbalz Mar 12 '18 at 06:26
  • @JaromandaX - Separately: VirtualBox will run Raspbian, as I've got that running myself. – christopherbalz Mar 12 '18 at 06:27
  • are you sure that you are using virtualbox? https://www.virtualbox.org .... are you sure that you are running raspbian and not debian? – jsotola Mar 12 '18 at 07:14
  • Are you sure you are running Raspbian for the arm based Pi and not the desktop version for x86? – Steve Robillard Mar 12 '18 at 07:38
  • Yes, there is an x86 Raspbian - hardly useful for Raspberry Pi – Jaromanda X Mar 12 '18 at 22:05

1 Answers1

3

...from an image file that contains a simple plain-text file tree...

This is gobbledygook. You are confused. That is not what an operating system image file is. It is a binary, block-for-block duplication of either a single filesystem, or (as with the ones used for the Raspberry Pi), a block device containing multiple partitions and a boot sector.

This is why all you have to do with the Raspbian image to create a usable SD card is copy it to the card with dd.

e.g., as discussed here

What is discussed there is not anything to do with "a simple plain-text file tree". If you want a better understanding of what that script is for, here is an explanation of the exact same process.

using VirtualBox,it's very convenient to do operations, such as installs of large packages, that would be slow on a Raspberry Pi

VirtualBox is a hypervisor for x86(-64).1 It does not emulate foreign architectures such as ARM (the category the Pi falls into), therefore it is impossible to run an operating system in it that has been compiled for the Pi.

While Raspbian is available for PC hardware, you cannot use it to do what you want to do since these two versions are not binary compatible.

how to easily export the resulting o/s instance

In fact you can create an image file of the sort described above ("a binary, block-for-block duplication of a filesystem") from a VirtualBox using VBoxManage clonemedium --format RAW.

as a Raspbian image

You could, but this would not be an image that could be run on an actual Raspberry Pi.

You might have a look into QEMU, although note that the combination of hardware emulation and the less performance oriented ARM ISA will probably mean it is noticeably slower than VirtualBox. However, I believe you can run unadulterated Raspbian in it.


1. X86(-64) is by far the most widespread instruction set architecture (ISA) for contemporary PCs (desktops, laptops, inc. Apple machines). ISA's are used in hardware implementation, meaning they are carved in metal for specific physical systems. Software is compiled to machine code which corresponds with this. Software compiled for one ISA is unlikely to be compatible with another.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
  • Perhaps there's confusion because you can get Raspbian for x86 - https://www.raspberrypi.org/downloads/raspberry-pi-desktop/ – Jaromanda X Mar 12 '18 at 22:07
  • Thanks @JaromandaX -- I was not aware of that and will try to work in an appropriate edit! – goldilocks Mar 13 '18 at 01:45
  • The solution in qemu-raspbian-network.git worked for me to get headless raspbian running fine on qemu on Ubuntu 16.04 LTS [(how-to)](https://ownyourbits.com/2017/02/06/raspbian-on-qemu-with-network-access/) . This is using the rasbian_lite_latest image. So far I have not been able to get the standard raspbian desktop to show. I did ` sudo raspi-config` and followed the directions to install `lightdm`. But now, the system never gets past the initial login screen. I am pretty sure that the plain raspbian_latest image will work well, however. – christopherbalz Mar 17 '18 at 17:16
  • Even though the solution above requires a kernel cross-compiled to ARM Versatile, updates to the mounted image would seem to work on R Pi hardware because the solution just overrides the image's existing kernel. – christopherbalz Mar 17 '18 at 17:24