Virtual machine setup
Table of contents
- Choosing your development environment
- Vagrant troubleshooting
- Windows troubleshooting
We have prepared a virtual machine image that is preconfigured with all the development tools necessary to run and test your code for this class. Later in the course, we will discuss virtual machines; for now, you can think of it as a software version of actual hardware.
Choosing your development environment
To begin your setup, you must choose from one of the following four options. You must complete one of the following setup choices before moving onto Virtual Machine Configuration.
- VirtualBox setup: this is the choice that most students typically go with. You will run a VM using VirtualBox. Note that if you’re using an Apple M1 Mac, you cannot choose this option.
- Instructional machine setup: if you prefer not to use a VM, you can use the EECS instructional machines instead. Note that this is the officially supported option for students using M1 Macs; course staff will not provide setup assistance if you choose to use option 3 below.
QEMU setup: if you are unable to run an x86-based VM (notably, if you’re using an Apple M1 Mac), this is an alternative that allows you to still run a VM without relying on VirtualBox.
Note: Many students who’ve tested this setup have found it to run very slowly. This is because it requires emulating x86 on ARM. As a result, we highly recommend that students with M1 Macs use the instructional machine setup (option 2).
- Cloud machine setup: an alternative to using the Hive machines.
vagrant up, you may run into an error reading
The IP address configured for the host-only network is not within the allowed ranges. This can be fixed on macOS and Linux with
sudo mkdir -p /etc/vbox sudo sh -c 'printf "* 10.0.0.0/8 192.168.0.0/16\n* 2001::/64" >> /etc/vbox/networks.conf'
This appends the lines outlined in this Stack Overflow post to the file, so avoid running the command multiple times. If you would like to overwrite the contents of the file (i.e. you don’t care about the existing contents), you can replace the second command with
sudo sh -c 'printf "* 10.0.0.0/8 192.168.0.0/16\n* 2001::/64" > /etc/vbox/networks.conf'
vagrant up still fails, try running
vagrant provision and see if it fixes things. As a last resort, you can run
vagrant destroy to destroy the VM. Then, start over with
Note: Some shells may have issues with escaping newlines. Check that your
/etc/vbox/networks.conf file ends in something like this (the asterisks are necessary):
* 10.0.0.0/8 192.168.0.0/16 * 2001::/64
You can also edit the
/etc/vbox/networks.conf yourself if necessary, using
emacs, or another text editor.
Windows Subsystem for Linux (WSL)
We do not recommend using Vagrant and/or VirtualBox in WSL. If you choose to use Vagrant for Linux inside WSL, you should still have VirtualBox installed in Windows. Vagrant has documentation on the configuration necessary to support usage of Windows VirtualBox inside WSL.
On the latest version of Windows 10, the virtual machine should work on the default command line. If you are using an older version of Windows, your installation may not support SSH from the command line. In this case, the “vagrant ssh” command from the above steps will cause an error message prompting you to download Cygwin or something similar that supports an SSH client. Previous TAs have wrote a guide on setting up Vagrant with Cygwin in Windows. Alternatively, it is possible to use PuTTY instead of Cygwin.
If you get an error about your VM bootup timing out, you may need to enable VT-x (virtualization) on your CPU in BIOS.
If you get an error about Hyper-V being enabled, you should disable Hyper-V to use VirtualBox. Alternatively, you can set up Vagrant to utilize Hyper-V as the provider instead of VirtualBox, and create the VM yourself (see CS 162 VM provisioner above for details).
Table of contents
- VirtualBox setup
- QEMU setup
- Instructional machine setup (VM alternative)
- Cloud machine setup (VM alternative)