[Freedombox-discuss] Running an existing FreedomBox SD card under virtualbox.

Sunil Mohan Adapa sunil at medhas.org
Sun Feb 6 21:59:34 GMT 2022

On 2/6/22 13:09, A. F. Cano wrote:
> When I start virtualbox, I can start creating a virtual machine.  The
> Name and Machine Folder I can enter.  I select Type: Linux and Version:
> Debian (32 bit) and here's the first issue: I'm running an amd64 kernel
> natively on this machine and the FreedomBox on the SD card also runs an
> amd64 kernel.  Thnn I select the memory size: 4GB (same as the apu1d4 on
> which the sdcard ran), and then I come to the show stopper.  The only
> options for "Hard disk" are "Do not add a virtual hard disk", "Create a
> virtual hard disk now" and "Use an existing virtual hard disk file".

I don't know of a way to make to VirtualBox work with disks attached to 
the machine. So, take a dump of your drive into a image and use that 

umount /dev/sdd1
dd if=/dev/sdd of=/my/path/mydisk.raw bs=1M status=progress

However, VirtualBox can't work with raw images either. So, you need to 
convert to VirtualBox disk format. You can use VBoxManage command or 
qemu-img for doing this.

VBoxManage convertdd /my/path/mydisk.raw /my/path/mydisk.vdi

Add this file into VirtualBox's Virtual Media Manager during creation of 
new VM or beforehand and use the option "Use an existing virtual hard 
disk file".

If you don't see Debian (64 bit) during VM creation, then it most likely 
means that virtualization CPU feature (AMD-V or Intel VT-X) is disabled 
in BIOS/UEFI. Reboot and change that setting. Confirm that it has been 
enabled with the presence of 'svm' for AMD systems and 'vmx' for Intel 
systems in the flags list present in the output of `cat /proc/cpuinfo`. 
The other possibility is that the your CPU is too old support 
virtualization (> 15 years?).

> If virtualbox won't work in this scenario, is there another way to run
> the FreefomBox SD card in some kind of isolated enviromnment? a
> container? qemu and associated software? The native architecture and the
> the FreedomBox architecture are the same (amd64 kernels) so this
> shouldn't be too hard, right?  But I've never tried to run anything in a
> virtual machine/emulator/container.

I think qemu might be able to boot directly from disk (but with learning 
curve, use virt-manager for GUI). It will also emulate CPU (slow) if 
virtualization is not available.

umount /dev/sdd1
qemu-system-x86_64 -enable-kvm -smp 4 -m 4G /dev/sdd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x36C361440C9BC971.asc
Type: application/pgp-keys
Size: 19153 bytes
Desc: OpenPGP public key
URL: <http://alioth-lists.debian.net/pipermail/freedombox-discuss/attachments/20220206/b5adf6cd/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/freedombox-discuss/attachments/20220206/b5adf6cd/attachment-0001.sig>

More information about the Freedombox-discuss mailing list