Installing VS Code and Logging in to Hazel

  1. Download and install VS Code (do one of following: a. or b.)
    1. If your computer is managed by an NCSU configuration management service, please use appropriate university configuration management system app (e.g., Jamf “Self Service” app for a Mac) to install VS Code.
    2. Otherwise, if your machine is not managed by an NCSU configuration management service, download and install the software manually from: https://code.visualstudio.com/
  2. Follow instructions at this website for installing the "Remote-SSH" VS Code extension, but do not connect to Hazel HPC yet: https://code.visualstudio.com/docs/remote/ssh.
  3. In the main VS Code window, press on your keyboard Command+Shift+X [Ctrl+Shift+X], click on "Remote-SSH" under "Installed" in the column on left side of the window, click the gear symbol from within the main window showing "Remote-SSH", and click "Extension Settings". Scroll down to remote.SSH.showLoginTerminal, and make sure the box is checked for this setting.
  4. In the main VS Code window, press on your keyboard Command+Shift+X [Ctrl+Shift+X], click on "Remote-SSH" under "Installed" in the column on left side of the window, click the gear symbol from within the main window showing "Remote-SSH", and click "Extension Settings". Scroll down to remote.SSH: Connect Timeout, and type “300”.
  5. Connect to Hazel
    1. Type Command+Shift+P [Ctrl+Shift+p], type in "Remote-SSH: Connect to Host...", and hit return [enter]
    2. Click "Add New SSH host"
    3. Type in <user_name>@login.hpc.ncsu.edu, where <user_name> is your Hazel login ID (unity ID), and press return [enter] on keyboard
    4. Press return [enter] again to select the default location for the config file
    5. Press Command+Shift+P [Ctrl+Shift+P] again, type in "Remote-SSH: Connect to Host...", and hit return [enter]. Click the connection you just created.
    6. If it asks for for Platform of Remote Host, select Linux
    7. In the terminal, if it asks "Are you sure you want to continue connecting (yes/no/[fingerprint])?", then type yes and press return [enter]
    8. Type in your password to login to Hazel, and complete the Duo two-factor authentication
    9. If a Window pops up asking "You are about to connect to an OS version that is unsupported by Visual Studio Code", click Allow
    10. It may take a minute or two to login to Hazel
    11. In the terminal window (in the menu bar click “View”, then “Terminal” if terminal section of window does not appear), click the "+" sign to get a new terminal window and bash shell in which to type your commands into Hazel login node (it may take a while for a terminal prompt to appear). Take note of which login node you are on (login01, login02, etc), you will need it later to clean up your lingering processes.
  6. When you are done using the login node, press Command+Shift+P [Ctrl+Shift+P], type in "Remote: Close Remote Connection", and press return [enter]. This should end your SSH connection to the login node.

Cleaning up Lingering Processes on Hazel Login Node (Required for use of VS Code):

We have found that VS Code does not shut down the ssh tunnel cleanly, thus, the user must manually kill any lingering VS Code processes left on the login node they were working on.

Issue the following commands with caution, as they will kill ALL VS Code processes (and any other process you have running called “node”) you have on the login node that you specify, including all old/lingering and current processes.

  1. Make sure you have ended your VS Code ssh login session to HPC. To end the session, press Command+Shift+P [Ctrl+Shift+P], type in "Remote: Close Remote Connection", and press return [enter]
  2. Login to <user_name>@<login_node>.hpc.ncsu.edu using an application other than VS Code. Replace <user_name> with your user name, and <login_node> with the login node that has the rogue “node” processes on it, e.g., login01, or login02, etc.
  3. Once logged in, issue the command: killall -u $USER node
  4. Confirm processes are killed by Typing in top -u $USER at the command prompt, and make sure there are no processes called "node" or "code-..."

Trouble logging in to Hazel using VS Code, Try the Following

  1. From some other application (see https://hpc.ncsu.edu/Documents/Login.php), while connected to a HPC login node, remove the $HOME/.vscode-server directory using the following instructions.

    Issue the following commands with caution, as they may kill ALL VS Code sessions and processes you have on all login nodes, including all old/lingering and current processes.

    1. If you have manually put important files into the directory $HOME/.vscode-server, move them out before removing the directory.

    2. rm -rf $HOME/.vscode-server. ####Note: The .vscode-server directory will just be downloaded again by VS Code next time you connect to Hazel using VSCode.
    3. Then try logging in to Hazel again through VS Code.