- Containerization:
- Keep Mission Pinball inside it's own container, without having to worry about outside packages or configurations causing problems
- Ensures dependencies are exactly what you expect them to be
- Standardization/ease of setup:
- Allows users to keep using host OS they are comfortable with, without having to dual boot or replace main OS
- Only part that might change between host OSes is setting up the virtual machine
- Making a new VM is easy with VirtualBox
- Once Debian is running, less weird OS specific bugs
- Portability:
- Move VM container to a different machine
- Host can have more/less resources as needed
- Can scale guest resources from VirtualBox Manager
- Can port to a real x86_64 machine from virtual machine
- Generate real disk image and copy to physical HDD
- Move VM container to a different machine
- Emulation:
- "Pinball Machine in a box" (inside your computer)
- Simulates what resources you'll have available on real/physical game
- Network managed by VirtualBox:
- No cables / WiFi drivers
- No host or guest configuration
- VirtualBox network configuration is easy
- "It just works"
- Development:
- Test code in simulated game environment
- Can develop on host OS and easily push to guest OS
- Test hardware driver code on host OS against real install of MPF on simulated pinball machine using virtual serial port pass through or
socatremote serial port device.
-
Resource intensive on host
- Need semi-decent computer to develop
-
Probably cannot port to ARM/RISC platforms (untested)
- This includes all Raspberry Pis and most SBCs
- Still useful for simulating resource limited environments
-
Not "true" emulation of real hardware (close but not 100%)
-
Takes longer to set up
- Open Source and Free
- Flexible to many guest OSes
- Powerful network tools
- Snapshot feature allows returning to last known good configuration
- Reliable passthrough USB and Serial support (for testing pinball hardware)
- Well supported; new releases available often
- Comfortability with running Linux commands
- Basic knowlege of SSH
- Host OS with VirtualBox 5+ installed and 10 GB+ of free space
- Internet Connection (Only required for Debian install)
-
In VirtualBox Manager, start a new machine.
- Name: Choose a name for your VM. This is the name that will be used in VirtualBox.
- Machine Folder: Choose a path
- Type:
Linux - Version:
Debian-64
-
Allocate at least 1 GB (1024 MB) of RAM
-
Hard Disk:
Create a Virtual Hard Disk Now
-
Hard Disk File type:
VDI (VirtualBox Disk Image)
-
Storage on physical hard disk
Dynamically Allocated
-
Select how much storage you want for the virtual machine. (At least 8GB, I used 16GB.)
-
Click
Create
Tip: Check out the available options in the ⚙️ Settings tab of VirtualBox. The more accustomed you become to these options, the better you will understand the powerful tools of VirtualBox.
-
Navigate to the official Debian download site.
-
Under the
Small CDs or USB sticksheader, click onamd64to download the latest version of Debian.(Latest Debian was 10.4.0 at time of writing)
-
An
.isofile of approximately 350 MB will be downloaded.
-
Select your Mission Pinball VM from the VirtualBox GUI
-
Click the green ➡️
Starticon -
If you have not yet attached the Debian ISO file to your VM, you will be prompted to select it now
-
Click the 📂 Folder icon and find your downloaded Debian.iso file:
debian-10.4.0-amd64-netinst.iso
-
-
Click
Start -
In the virtual machine window, highlight
Graphical Installand click enter -
Follow the prompts to install Debian. You may need to navigate using the keyboard (using
TabandEnter) because the VirtualBox Guest Additions are not yet installed. That will be done in the next few steps. -
Make sure to set a root password and setup a new user of your choice.
The sudo command is required for many of the following steps of this guide. It is likely the user that was created during the Debian install was not granted sudo access and you will be met with this error if you try to use sudo:
[your-user] is not in the sudoers file. This incident will be reported.
To fix this:
-
Open a new terminal window
-
First change into the root user:
-
su -
-
The
-is required to reset $PATH (usermodmay not work without it)
-
-
As root, add your username to the sudo group
-
usermod -aG sudo [your-user]
-
-
Exit the root user shell
-
exit
-
-
Verify your username was granted sudo access
-
sudo echo -
A reboot may be required for sudo access to take effect
-
The VirtualBox Guest Additions provide many benefits including but not limited to:
- Shared folders
- Shared clipboard
- Ability to resize the guest OS window
Full instructions for setting up the VirtualBox Guest Additions CD can be found here. An abbreviated version is listed below:
-
sudo apt update sudo apt install build-essential dkms linux-headers-$(uname -r) -
(Host Window) Devices -> “Insert Guest Additions CD Image”
-
sudo mkdir -p /mnt/cdrom sudo mount /dev/cdrom /mnt/cdrom
-
cd /mnt/cdrom sudo sh ./VBoxLinuxAdditions.run --nox11 -
Reboot
-
If necessary, confirm module is running after reboot:
lsmod | grep vboxguest
Now is a good time to configure the network cards so we can SSH into the virtual machine.
-
Create a new virtual network adapter
- Focus the main VirtualBox Manager window
- File > Host Network Manager
- ➕
Create - Default name is ok (
vboxnet0in my case) - Verify subnet mask is
255.255.255.0
-
In VirtualBox Manager, open the settings tab for the MPF VM.
- Navigate to the network settings tab
- Click on the
Adapter 2tab - Enable the adapter
- Select
Host Only Adapteras "Attached to" - Name is the Virtual Network we created earlier (
vboxnet0in my case)
-
In the host OS, verify the VirtualBox virtual network adapter is connected
-
The following is for macOS. Your command and output may look different
-
ifconfig vboxnet0
-
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 ether 0a:00:27:00:00:00 inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
-
-
In the guest OS (Debian), verify the VirtualBox virtual network adapter is connected
-
The following is for my installation. Your command and output may look different
-
ip addr
-
[...] 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:d8:b5:e6 brd ff:ff:ff:ff:ff:ff inet 192.168.56.101/24 brd 192.168.56.255 scope global dynamic noprefixroute enp0s8 valid_lft 805sec preferred_lft 805sec inet6 fe80::e970:3c21:bf92:1f16/64 scope link noprefixroute valid_lft forever preferred_lft forever [...]
-
Verify the IP address (
192.168.56.101in this case) is located in the same subnet as the host's IP address found earlier (192.168.56.1)
-
-
Verify you can SSH into the VM:
-
ssh [your-user]@192.168.56.101
-
Now is a good time to install tools such as git and any other environment tools you are accustomed with.
Verify that python is installed and using a version you expect:
python3 -VPython 3.7.3
Install pip3 and pkg-config (which MPF needs for mpf-mc):
sudo apt-get install python3-pip pkg-configFollow the installation guide for MPF on Linux.
Basic installation:
pip3 install pip setuptools --upgrade-
Clone the Debian installer
-
cd ~ git clone https://github.com/missionpinball/mpf-debian-installer/ cd mpf-debian-installer/ chmod +x install && sudo ./install
-
-
Setup the mpf directory and clone examples
-
cd ~ mkdir mpf cd mpf git clone https://github.com/missionpinball/mpf-examples
-
-
Run the Demo Man example. In the VBox Desktop, open terminal and execute:
-
cd ~/mpf/mpf-examples/demo_man mpf both -X
-
Verify mpf opens in terminal and mpf-mc opens in a new window.
-
Control Keys:
S- Start gameL- Launch ballX- Fire slingshot1- Drain ballESC- Close mpf-mc and quit
-
Follow the rest of the Demo Man example guide.
-
The full installation guide for setting up MPF-Monitor can be found here.
-
Install PyQt5 (may already be installed):
-
sudo apt-get install python3-pyqt5
-
-
Install mpf-monitor:
-
pip install mpf-monitor
-
-
Start mpf (with mc) and mpf monitor (in separate terminal tabs):
-
mpf both -X
-
mpf monitor
-
-
Adjust the size of switches and lights by adding the following to the first line of your
monitor.yamlfile:-
device_size: 0.1
-
More info at MPF Monitor docs.
-