Given a Balena app that can be downloaded as an image and flashed to a device using a USB stick, how can it be used to create a virtual machine? The idea is that it could be distributed to others as an alternative to shipping a physical device.
How do I create VMware or VirtualBox virtual machine from Balena app image?
1.3k views Asked by James Gentes At
1
There are 1 answers
Related Questions in VIRTUALBOX
- How do I fix VERR_INVALID_HANDLE (0X80004005) Error in VirtualBox?
- Seeking for the the method for adding the DL (data register) value to DX register
- Why when I want to open a folder from Visual Studio Code does the screen go crazy?
- Trouble Connecting USB Wireless Adapter via Bridged Adapter in VirtualBox for Kali Linux
- Behavior of the adress 0x7e00 in different sectors and their alternatives
- Assembly language adding two numbers code error issue
- No BIOS output from sector 1
- Building VirtualBox With Emscripten throws error: 'kmk: *** Exiting with status 2 emmake: error: 'kmk -p all' failed (returned 2)'
- Error when molecule through vagrant start VM in vbox (Windows, WSL2)
- Flask app in my Host machine connecting to an MySQL in a docker in a VM
- Bootloader are really in sector 0?
- Process finished with exit code 132 (interrupted by signal 4:SIGILL)
- NodePort Service not accepting connections : Error: connect ECONNREFUSED
- run adb from virtualbox with win11 host
- VirtualBox ErrorVkPhysicalDevice does not support GetPhysicalDeviceCalibrateableTimeDomainsKHR
Related Questions in VMWARE
- mkssecreenshotmgr taking a screenshot
- How can you get and update tags for a given VM using vCenter APIs?
- Moving Template or OVA to Datastore using vCenter API
- Azure Site Recover - Powershell Create Recovery Plan from Vmware to Azure
- .ova file to run in a Docker container
- I want to configure a report for specific VM in vrops/aria
- Unable to make itext5 pdf watermark non removable in VMware Workspace ONE Boxer email
- On the VMware. Unable to paste exe from a virtual machine to another virtual machine
- Need to retrieve vmware instance UUId for multiple instances
- Need to recover expired license on vmware API
- Azure Site Recovery - VMware to Azure - a few issues
- How to pass variables of deployed VM (vmware_guest) to roles for further config
- NumPad Not Working in Windows 10 VM on VMware Player with Bluetooth Keyboard
- Get the value from the dict in JSON output stored in a variable
- How to get the value from key `datacenter` from a JSON output which is stored in an variable?
Related Questions in BALENA
- Network Manager fix for Debian Buster
- ERROR: Could not build wheels for netifaces, which is required to install pyproject.toml-based projects
- balena does it automatically restart the service
- dd is writing my image wrong resulting in kernel panic
- Balena API device registration returns "API key must be used for registering"
- Curl container command into c#
- Grpc server and client work locally but not on different containers python - StatusCode.UNAVAILABLE
- Balena-Enginer (docker) error while copying file to container
- BalenaOS use Raspberry Pi Compute Module 4 IO board's Real-Time Clock inside container
- Is HTTPS secure if I always send the same message?
- Python ctypes can not locat existing lib in Docker on Balena
- Issues with installing librealsense with Balena. Unable to locate file after make install?
- Building with balena-cli (balena build) on travis-ci
- Populating and versioning docker named volume, used as persistent storage with balena.io
- How can I know which Debian libraries Electron needs to run?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
There are two main parts to achieving this:
Download an Intel-NUC based Balena device image
Install a very specific version of Docker that still supports AUFS
Windows: https://docs.docker.com/docker-for-windows/release-notes/#docker-community-edition-18061-ce-win73-2018-08-29
Mac: https://docs.docker.com/docker-for-mac/release-notes/#docker-community-edition-18061-ce-mac73-2018-08-29
Open the Docker Desktop settings panel and tick the checkbox
Expose daemon on tcp://localhost:2375 without TLS. Also go to the Shared Drives settings and be sure to share the C drive else you'll get adrive not sharederror when runningbalena preload.Pre-load the Balena image with your app (optional)
Docker must be running properly for the next step to work.
balena preload <img name>.img --app <app #> --splash-image logo.pngConvert the .IMG file to .VMDK
The image needs to be mounted in the virtual machine, similar to plugging in a USB drive, however you can't mount the .img file directly. Unfortunately VMware doesn't have a utility for this (please comment if so) but VirtualBox does.
It must be converted to a .vmdk (virtual disk) using the
VBoxManage convertddcommand.VBoxManage convertdd <img name>.img <img name>.vmdk --format VMDKCreate a VMware virtual machine image
Note: This appears to require VMware Workstation 15 for VMDK compatibility, however there could be ways to get it working with earlier versions if you're ambitious.. perhaps changing the VMDK file type?
You have to modify the VMDK file type from 5 (streamOptimized) to 2 (monolithicFlat). It doesn't matter here, but types 0, 1, and 3 would also work. This is not needed for VirtualBox.
vmware-vdiskmanager -r <source>.vmdk -t 2 <target>.vmdkThis creates a
-flat.vmdkfile that's 4x the size of the original. Note: We're going to attach the 1kb .vmdk file that references that -flat file, not the -flat file itself.Open VMware Workstation (you'll need a license or trial version) and create a new Virtual Machine. Use Custom (advanced) otherwise you won't get the option to specify disk controller type or select an existing disk.
Select a Disk Type- choose SATA as SCSI doesn't support AHCI and it will not boot properly.Select a Disk- choose 'Use an existing virtual disk'Click finish, then edit the virtual machine settings. You need to add a Click
Addon the Hardware tab and selectHard Disk.Note: It is critical that the original Balena VMDK is set to SATA 0:0 otherwise it will not boot properly. It should be already configured as such, but you can click the Advanced button to double check.
If the virtual machine does not boot (ie. gets stuck at a network boot prompt) go to the Settings of the virtual machine > Options tab > Advanced > Firmware type and make sure it is set for UEFI (not BIOS). This should fix the problem.
Click the
Optionstab and go toAdvanced- change the Firmware type fromBIOStoUEFI. If this is not done it will not boot to the Balena VMDK.Skip the next section.
Create a VirtualBox virtual machine image
You should now have a virtual machine created. Edit the settings:
Enable I/O APIC(will not boot otherwise)Enable EFIController: SATAController: SATAand add a new hard diskController: SATANATwhich is what you wantProvision the virtual machine with the Balena image
Now you should have the original VMDK attached for boot and a new virtual disk to provision with the Balena image. Start the virtual machine and open up the Balena dashboard to see it come online (https://dashboard.balena-cloud.com) Once it appears, you should name it something meaningful.
Note: If you see Network PXE as the bootloader and it just hangs, it means you likely haven't changed BIOS setting to UEFI.
The device will enter a Post-Provisioning state. Do not interrupt this process - it will take a few minutes and the virtual machine will power off. Be sure to let it power off on it's own. If it does not turn off, or if you accidentally turn it off, delete the device from Balena and start the virtual machine again - it should provision a new device.
Important: Once it is powered off, go to the virtual machine settings and remove the Balena VMDK disk, otherwise you will re-flash a new image every time you boot. This is the equivalent of removing the USB stick from the device. You should only have one virtual disk attached to
Controller: SATA.At this point you have a virtual machine image that is the equivalent of a physical device. Now the image can be packaged as a virtual appliance so that it can be easily distributed (and users can just double click on and load into VirtualBox or VMware).
Create a virtual appliance from a Balena image
Open VirtualBox or VMware (the process is the same):
File > ExportClick
Exportand that's it!One thing to note: If you send this appliance to 10 people, there will still only be 1 device in Balena, so you may want to create 10 separate appliances instead, which then provision 10 separate devices in Balena.