Windows (AMD/Intel x86)

Set up VM

  • Install vitrualbox and vagrant. After installation, reboot your machine.

  • Set up a directory for csc3150 (make sure the full path does not include space or Chinese, e.g. D:\csc3150)

  • Launch powershell with Administrator previlege (run as administrator) and change current directory to the one you set up (e.g. cd D:\csc3150)

  • Execute vagrant init cyzhu/csc3150

  • Then execute vagrant up. It may take a while to download the system image. After that a virtualbox window may pop up. Leave it open but put it aside.

  • The VM is set up. Now we can set up the ssh to connect to the VM. (You may try to connect to VM via vagrant ssh, and you can switch back to the host terminal via logout). Don't close the PowerShell yet.

Set up VS Code

To simplified the workflow, you are recommended to set up Remote SSH plugin in VS Code.

After installing, go to the remote explorer tab, click config in SSH-TARGETS

Now, go back to powershell (make sure you are still in the csc3150 directory) and execute vagrant ssh-config. Copy everything but the last line (Loglevel) to the ssh config and save the file, as is demostrated in the picture.

Now you can find SSH Target called default (if not, may sure you have save the config or you can click the refresh button). Click the icon to connect to the VM and launch a new window.

The first time you connect to the VM via VS Code, it may take some time for it to load. Wait patiently. After it finshes loading, start a terminal.

In the terminal you just opened, install essential dependencies and libraries: sudo apt update && sudo apt install -y build-essential (it may take a while). After it finishes, create a directory for the course: mkdir -p ~/csc3150

After everything, you can open a folder in the VS Code window to locate to the directory you create:

Finally, try a hello world program on the VM

As usual, open a (remote) terminal in VS Code and compile the hello world program (gcc hello.c -o hello) and try to run it.

Shutdown the VM

To shutdown the VM gracefully, go to PowerShell (on your host machine, not in VM/VS Code) and cd to your csc3150 diretory, and execute vagrant halt.

Symmetrically, next time you want to re-launch the VM, go to PowerShell (on your host machine, not in VM/VS Code) and cd to your csc3150 diretory, and execute vagrant up

Trouble Shootings

Troubles in "vagrant up"

vagrant up download the system image from the cloud and may involve network problems. In common case where you encounter a network problem, you may retry and succeed. However, if the problem persists, there is an alternative solution:

  • Remove the directory and create it again

  • Download the image manually here

  • In PowerShell, cd to the directory and execute

    vagrant box add csc3150 /the/path/to/the/box/you/just/download
    vagrant init csc3150
    vagrant up

Troubles in "Error relaunching VirtualBox VM process: 5"

Error relaunching VirtualBox VM process: 5 Command line: '60eaff78-4bdd-042d-2e72-669728efd737-suplib-3rdchild --comment intelios --startvm 53f35ed5-907b-4e1f-a86b-e971c2f866d0 --no-startvm-errormsgbox "--sup-hardening-log=C:\SPB_Data\VirtualBox VMs\WinXP\Logs\VBoxHardening.log" (rc=-104)

Please try reinstalling VirtualBox.

where: supR3HardenedWinReSpawn what: 5 VERR_INVALID_NAME (-104) - Invalid (malformed) file/path name.

Try uninstall Virtualbox and reinstall with older version.

Vagrant up: Cannot use the requested machine because it is locked

On windows, with "tasklist" find the process id of your "vagrant.exe" and "ruby.exe". Now kill both the processes with "taskkill /PID /F" command (in either PowerShell or CMD). Then you may try vagrant up again.

Incompatible character encodings gbk and utf8

Go to virtualbox -> General Settings -> Change Default Machine Folder into a path with no Chinese Character.

SSH Failed to Connect when the VM starts successfully

Remember the identify file in "vagrant ssh-config" (I will refer it to <private_key> below, remember to replace it with the identify file value).

Go to powershell and run:

# Set Key File Variable
  New-Variable -Name Key -Value "<private_key>"

# Remove Inheritance:
  Icacls $Key /c /t /Inheritance:d

# Set Ownership to Owner:
  # Key's within $env:UserProfile:
    Icacls $Key /c /t /Grant ${env:UserName}:F

# Key's outside of $env:UserProfile:
# TakeOwn /F $Key
# Icacls $Key /c /t /Grant:r ${env:UserName}:F

# Remove All Users, except for Owner:
  Icacls $Key /c /t /Remove:g Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users

# Verify:
  Icacls $Key

# Remove Variable:
  Remove-Variable -Name Key

Last updated