Link Search Menu Expand Document

Virtual machine setup

Table of contents

  1. Choosing your development environment
  2. Vagrant troubleshooting
  3. Windows troubleshooting
    1. Windows Subsystem for Linux (WSL)
    2. SSH client
    3. Bootup timeout
    4. Hyper-V

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.

  1. 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.
  2. M1 Mac 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. As a result, we highly recommend that students with M1 Macs use the instructional machine setup listed below.

  3. Instructional machine setup: if you prefer not to use a VM, you can use the EECS instructional machines instead.
  4. Cloud machine setup: an alternative to using the Hive machines.

Vagrant troubleshooting

After running 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'

If 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 vagrant up.

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 vim, emacs, or another text editor.

Windows troubleshooting

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.

SSH client

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.

Bootup timeout

If you get an error about your VM bootup timing out, you may need to enable VT-x (virtualization) on your CPU in BIOS.

Hyper-V

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