-
Notifications
You must be signed in to change notification settings - Fork 6
03 Run a RACK Box VM
After you follow these instructions, you will be able to run a RACK box in a virtual machine (VM) on a Linux, MacOS, or Windows computer.
You must install a hypervisor before your computer will be able to run a virtual machine. We use Oracle VirtualBox to run our virtual machine so you'll need to install it on your system.
If Oracle VirtualBox is not installed on your system, go to VirtualBox's downloads page, download the latest version, and run the VirtualBox installer. If you have VirtualBox installed but it is not up to date, you should consider updating it to the most recent version.
Caveat for Windows Users of VirtualBox
If you have a Window 10 computer, there is a chance your computer may be running under Microsoft's Hyper-V hypervisor. Installing Docker Desktop on Windows 10, for example, will enable the Hyper-V hypervisor automatically. If Hyper-V is running already and you are using a version of VirtualBox that is 6.1.16 or newer, you should have no problem running both Docker Desktop and VirtualBox together under the Hyper-V hypervisor. However, if your version of VirtualBox is older than 6.1.16, you will get an error message when you try to start your RACK box:
Failed to open a session for the virtual machine rack-box-v14.0.
VMMR0_DO_NEM_INIT_VM failed: VERR_NEM_MISSING_KERNEL_API (VERR_NEM_MISSING_KERNEL_API).
VT-x is not available (VERR_VMX_NO_VMX).
If you can't or don't want to update your VirtualBox to the latest version, you can run a Windows PowerShell command with Administrator privilege which will turn off the Hyper-V hypervisor at the next reboot. Once you run that command and reboot your computer, you'll be able to start your RACK box without getting the VT-x error. I'll also give you another Windows Powershell command to run as Administrator when you want to switch back to Docker. After another reboot, Docker will start working again although VirtualBox will have a VT-x error again.
- Open the Start Menu, expand the Windows PowerShell menu, right click on the Windows Powershell command, and select Run as Administrator.
- If you aren't sure whether the Hyper-V hypervisor is enabled, type
bcdedit
in the PowerShell window and look at the last line of its output which will sayhypervisorlaunchtype Auto
orhypervisorlaunchtype off
or display some CPU virtualization technology information if Hyper-V isn't even installed. - If you see
hypervisorlaunchtype Auto
in the output, typebcdedit /set hypervisorlaunchtype off
to disable the Hyper-V hypervisor so it won't launch at the next reboot. - VirtualBox will start working after you reboot your system.
- When you want to switch back, type
bcdedit /set hypervisorlaunchtype auto
to re-enable the hypervisor so it will launch at the next reboot. - Docker will start working after you reboot your system. You can toggle the hypervisor auto launch setting and reboot your system without harming either Docker or VirtualBox; one will stop working and the other will start working.
You will need cat
and unzip
programs to concatenate the split zip
files and unpack the virtual machine after you download the split zip
files. All Unix-like systems already have cat
since it is a
standard Unix programs and Windows computers can use the type
command in place of cat
in command.com, cmd.exe, and PowerShell
terminals. Nearly all computers have GUI file explorer programs which
can unpack zip files too. However, here are instructions to add cat
or unzip
programs to Mac, Linux, and Windows computers in case you
need them.
Linux
On Linux computers, you may need to add the unzip
program since some
distributions don't include them by default. On Debian and Ubuntu
distributions, type sudo apt install zip unzip
. On other Linux
distributions, the commands you type may differ slightly but will
nearly always be one-liners.
MacOS
On Mac computers, you can add the unzip
program using
Homebew. Type homebrew install zip
and
homebrew install unzip
.
Windows
On Windows computers, you can install Cygwin, Git Bash for Windows, or a Linux distribution in Windows Subsystem for Linux (WSL). I like to install WSL myself because Microsoft supports WSL well and provides easy to follow instructions for installing WSL on Windows 10.
Follow the instructions for installing WSL. Type the PowerShell command given in the instructions, restart your computer, follow or skip the “Update to WSL 2” instructions (note only recent versions of Windows 10 support WSL 2), and jump to “Install your Linux distribution of choice”. Click the “Ubuntu 20.04 LTS” link, visit the Microsoft Store page, and click the Get button to install Ubuntu 20.04. Read the “Set up a new distribution” instructions and follow its link to read more detailed instructions how to create a user account and password and install additional packages. You can enter your Windows username and password if you prefer to use the same username and password as Windows or you can pick a Unix-specific username; it’s up to you.
When the install is done, you’ll have Ubuntu 20.04 in your Start Menu
and clicking it will open a new window with a shell prompt. If you
type "zip" right after installing Ubuntu, you will be advised to type
"sudo apt install zip" since WSL's Ubuntu doesn't include zip and
unzip by default. Type sudo apt update
and sudo apt install zip unzip
to add these programs. By the way, your C drive will be
mounted in /mnt/c so that’s where you will cd to find your downloaded
split zip files.
To get a RACK box virtual machine, you will need to download two or more split zip files: rack-box-v14.0.zipaa, rack-box-v14.0.zipab, and rack-box-v14.0.zipac (if it exists). You will need to concatenate the split zip files back together into an unsplit zip file, then run unzip to unpack the rack-box virtual machine:
$ cat rack-box-v14.0.zip?? > rack-box-v14.0.zip
$ rm rack-box-v14.0.zip??
$ unzip rack-box-v14.0.zip
Archive: rack-box-v14.0.zip
creating: rack-box-v14.0/
inflating: rack-box-v14.0/rack-box-v14.0-disk001.vmdk
inflating: rack-box-v14.0/rack-box-v14.0-disk002.vmdk
inflating: rack-box-v14.0/rack-box-v14.0.ovf
To import the rack-box virtual machine into VirtualBox, perform the following steps:
- Start VirtualBox.
- Click "Import" to start importing the RACK box.
- Tell the import wizard where to find the unzipped rack-box-v14.0 folder and tell it to open the ".ovf" file in that folder.
- Keep clicking through the wizard to the end to let VirtualBox import the rack-box virtual machine.
- Once the import succeeds, you can remove the unzipped rack-box-v14.0 folder and the zip file to save disk space.
Once the import is complete, you will find the imported virtual machine with the name "rack-box-v14.0" in VirtualBox's list of virtual machines. Click on the virtual machine's name to select it and then click on "Start" to start the virtual machine. "Start" will pop up a new window and show you the virtual machine's console output while it is running (you will see all the boot messages in real time).
Visit http://localhost:8080 or type "localhost:8080" in your web browser's address bar, hit Enter, and you should see your RACK box's welcome page appear in your browser. The welcome page will tell you some things you can do with your RACK box.
Our virtual machine uses a NAT adapter and tells VirtualBox to forward several port numbers from your local machine to the RACK box to ensure that you will see no difference between running a RACK box in a Linux container with Docker and running a RACK box in a virtual machine with VirtualBox. However, you can run only one RACK box on your local machine at a time even if your local machine has both Docker and VirtualBox installed. You cannot run one RACK box with Docker and another RACK box with VirtualBox at the same time.
Copyright (c) 2021-2024, General Electric Company, Galois, Inc.
All Rights Reserved
This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. FA8750-20-C-0203.
Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Defense Advanced Research Projects Agency (DARPA).
Distribution Statement "A" (Approved for Public Release, Distribution Unlimited)