Installing VS Code and Logging in to Hazel
-
Download and install VS Code (do one of following: a. or b.)
- 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.
- Otherwise, if your machine is not managed by an NCSU configuration management service, download and install the software manually from: https://code.visualstudio.com/
- 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.
- 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.
- 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”.
-
Connect to Hazel
- Type
Command+Shift+P [Ctrl+Shift+p],
type in "Remote-SSH: Connect to Host...", and hit return [enter]
- Click "Add New SSH host"
- Type in <user_name>@login.hpc.ncsu.edu, where <user_name> is your Hazel login ID (unity ID), and press return [enter] on keyboard
- Press return [enter] again to select the default location for the config file
- 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.
- If it asks for for Platform of Remote Host, select Linux
- In the terminal, if it asks "Are you sure you want to continue connecting (yes/no/[fingerprint])?", then type yes and press return [enter]
- Type in your password to login to Hazel, and complete the Duo two-factor authentication
- If a Window pops up asking "You are about to connect to an OS version that is unsupported by Visual Studio Code", click Allow
- It may take a minute or two to login to Hazel
- 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.
- 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.
- 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]
- 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.
- Once logged in, issue the command:
killall -u $USER node
- 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
- 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.
If you have manually put important files into the directory $HOME/.vscode-server
, move them out before removing the directory.
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.
- Then try logging in to Hazel again through VS Code.